On legacy layout tree, NGInlineNode::GetOffsetMapping() doesn't collapse leading white space inside LI element. For <li id=target> abc</li>. target.innerText returns " abc". See https://jsfiddle.net/co5r2bj0/1/
In review: crrev.com/c/1357555
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e commit bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e Author: Xiaocheng Hu <xiaochengh@chromium.org> Date: Tue Dec 04 07:35:33 2018 Fix whitespace collapsing with LI for NGOffsetMapping on legacy layout When using NGOffsetMapping on legacy layout, it preserves leading white space in LI as it treats the list marker as normal atomic inline. This patch makes inline collection aware of legacy list markers so that they stop affecting whitespace collapsing. Bug: 908339 Change-Id: If1490d69686a81ad1fa8457904cd351e33e76598 Reviewed-on: https://chromium-review.googlesource.com/c/1357555 Reviewed-by: Koji Ishii <kojii@chromium.org> Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org> Cr-Commit-Position: refs/heads/master@{#613462} [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/renderer/core/editing/element_inner_text_test.cc [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.cc [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/web_tests/editing/pasteboard/copy-crash-expected.txt [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/web_tests/fast/block/block-add-child-crash-expected.txt [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/web_tests/fast/block/positioning/complex-percentage-height-expected.txt [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/web_tests/fast/borders/border-color-visited-expected.txt [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/web_tests/fast/css/first-letter-capitalized-edit-select-crash-expected.txt [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/web_tests/fast/dom/horizontal-scrollbar-in-rtl-expected.txt [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/web_tests/fast/dom/left-overflow-in-ltr-expected.txt [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/web_tests/fast/dom/right-overflow-in-rtl-expected.txt [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/web_tests/fast/dom/set-outer-html-expected.txt [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/web_tests/fast/dom/set-outer-text-expected.txt [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/web_tests/fast/forms/textarea/textarea-scrollbar-height-expected.txt [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/web_tests/fast/inline/inline-box-adjust-position-crash-expected.txt [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/web_tests/fast/lists/calc-width-with-space-expected.txt [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/web_tests/fast/lists/item-not-in-list-line-wrapping-expected.txt [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/web_tests/fast/lists/list-marker-set-overflow-line-box-crash-expected.txt [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/web_tests/fast/overflow/scrollbar-restored-and-then-locked-expected.txt [modify] https://crrev.com/bf8f6ab0cbb412f752ce46cd05bb4bbbd17b2c4e/third_party/blink/web_tests/fast/text/whitespace/whitespace-and-margin-wrap-after-list-marker-crash-expected.txt [delete] https://crrev.com/432976afd3b4952ad28595b561febd4eaa572ef6/third_party/blink/web_tests/virtual/layout_ng/fast/inline/inline-box-adjust-position-crash-expected.txt
Comment 1 by xiaoche...@chromium.org
, Dec 3Status: Assigned (was: Available)