Support non-atomic inline in LayoutNG offset mapping |
||
Issue descriptionPositions anchored to non-atomic inlines can still be mapped to NGInlineNode canonical text. For example: DOM: <div><span>foo<img></span> bar<div> Canonical text: foo# bar (# denotes object replacement character) We should support mapping SPAN@BeforeNode to canonical text offset 0, and SPAN@AfterNode to offset 4 Motivation: This reduces DOM traversal (or canonicalization, TextIterator, ...) when, e.g., searching word/sentence/line boundaries and caret positioning. While we still need to traverse through block boundaries, we no longer need to traverse among inlines.
,
Nov 6 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/178bdd683de4e97e0f18df4e109683e190a10393 commit 178bdd683de4e97e0f18df4e109683e190a10393 Author: Xiaocheng Hu <xiaochengh@chromium.org> Date: Mon Nov 06 07:06:50 2017 [LayoutNG] Support non-atomic inlines in offset mapping This patch adds support of non-atomic inlines in offset mapping. Given a non- atomic inline node |node|, now we can use: 1. NGOffsetMapping::GetMappingUnitsForDOMRange(range), where range is an EphemeralRange with node@BeforeAnchor and node@AfterAnchor as range start and end, respectively. The API returns all NGOffsetMappingUnits that are laid out as descendants of node. 2. NGOffsetMapping::GetTextContentOffset(position), where position can be node@BeforeAnchor or node@AfterAnchor, that returns the offset before/after the first/last non-generated non-collapsed character in the canonical text. See the unit tests for details. Bug: 776843 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_layout_ng Change-Id: Icfbd88786955faa090b1253e475a1105b0a5907b Reviewed-on: https://chromium-review.googlesource.com/748103 Reviewed-by: Koji Ishii <kojii@chromium.org> Reviewed-by: Yoshifumi Inoue <yosin@chromium.org> Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org> Cr-Commit-Position: refs/heads/master@{#514096} [modify] https://crrev.com/178bdd683de4e97e0f18df4e109683e190a10393/third_party/WebKit/Source/core/layout/ng/inline/empty_offset_mapping_builder.h [modify] https://crrev.com/178bdd683de4e97e0f18df4e109683e190a10393/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_items_builder.cc [modify] https://crrev.com/178bdd683de4e97e0f18df4e109683e190a10393/third_party/WebKit/Source/core/layout/ng/inline/ng_offset_mapping.cc [modify] https://crrev.com/178bdd683de4e97e0f18df4e109683e190a10393/third_party/WebKit/Source/core/layout/ng/inline/ng_offset_mapping.h [modify] https://crrev.com/178bdd683de4e97e0f18df4e109683e190a10393/third_party/WebKit/Source/core/layout/ng/inline/ng_offset_mapping_builder.cc [modify] https://crrev.com/178bdd683de4e97e0f18df4e109683e190a10393/third_party/WebKit/Source/core/layout/ng/inline/ng_offset_mapping_builder.h [modify] https://crrev.com/178bdd683de4e97e0f18df4e109683e190a10393/third_party/WebKit/Source/core/layout/ng/inline/ng_offset_mapping_test.cc
,
Oct 26
|
||
►
Sign in to add a comment |
||
Comment 1 by xiaoche...@chromium.org
, Oct 20 2017