DescriptionDo not de-select text across continuations
When determining the end position for a selection ending on a
continuation's margin, we would incorrectly de-select all content
below the continuation's containing block.
This affects sites like hackernews, such as selecting text in:
https://news.ycombinator.com/item?id=347261
This patch is a buy-one-get-one-free with two fixes in one patch (both
fixes are required):
1) Continuations should be tested immediately because ancestors of a
continuation will not check them. In LayoutInline::positionForPoint, we
need to check our continuations first, before an early return, because
the containing block will not return to test the continuations.
2) Continuations do not need an adjustment for their position to
"translate the coords from the pre-anonymous block to the post-anonymous
block." This code was not tested and seems wrong because the point is
already in the correct coordinate space.
Here's an example of a layout tree dump (included as a new test as well):
LayoutView
LayoutBlockFlow
LayoutBlockFlow (anonymous)
LayoutInline continuation=(next block flow) FONT
LayoutText #text "AAAAAAAAAA"
LayoutBlockFlow (anonymous) continuation=(next sibling block flow)
LayoutBlockFlow P
LayoutText #text "BBBBBBBBBB"
LayoutBlockFlow P
LayoutText #text "CCCCCCCCCC"
LayoutBlockFlow (anonymous)
LayoutInline FONT
This patch is solving a bug when selecting from the beginning of AA...AA
to the margin between BB...BB and CC...CC. Before this patch, BB...BB
would not be selected.
BUG=468497
Committed: https://crrev.com/084f254759294c0789432816d2516b70abae3b9d
Cr-Commit-Position: refs/heads/master@{#423639}
Patch Set 1 #Patch Set 2 : Make failures more obvious #Patch Set 3 : Add tests for different editing behaviors #
Total comments: 2
Patch Set 4 : Switch to non-pixel tests #
Messages
Total messages: 26 (18 generated)
|