Fix selection jumping when drag-selecting out of a float#60413
Merged
Conversation
wpt-pr-bot
approved these changes
Jun 5, 2026
wpt-pr-bot
left a comment
Collaborator
There was a problem hiding this comment.
The review process for this patch is being conducted in the Chromium project.
1c21567 to
2ab4afb
Compare
When text lives inside a floated container, drag-selecting and moving the cursor outside the container caused the selection extent to jump to the document start, inverting the highlight to cover everything above the mousedown point. PhysicalBoxFragment::PositionForPoint() has short-circuited to Position(block, 0) for any LayoutBlockFlow with ChildrenInline() and no FragmentItems. Hit-tests in the empty area around a float resolved to such a block and collapsed the focus to block start. Removing the short-circuit lets PositionForPointByClosestChild() recurse into the nearest float and return a sensible position inside its line. The short-circuit existed only to satisfy WebFrameTest.SmartClipData; its behaviour is reapplied locally at the SmartClip caller site so clip_html output is unchanged. Bug: 41340914 Change-Id: Ia2b4ccdc281757ec746bca6a730ca118e8be671c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7893568 Commit-Queue: Seokho Song <seokho@chromium.org> Reviewed-by: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/main@{#1642166}
2ab4afb to
e997c99
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When text lives inside a floated container, drag-selecting and moving
the cursor outside the container caused the selection extent to jump to
the document start, inverting the highlight to cover everything above
the mousedown point.
PhysicalBoxFragment::PositionForPoint() has short-circuited to
Position(block, 0) for any LayoutBlockFlow with ChildrenInline() and no
FragmentItems. Hit-tests in the empty area around a float resolved to
such a block and collapsed the focus to block start. Removing the
short-circuit lets PositionForPointByClosestChild() recurse into the
nearest float and return a sensible position inside its line.
The short-circuit existed only to satisfy WebFrameTest.SmartClipData;
its behaviour is reapplied locally at the SmartClip caller site so
clip_html output is unchanged.
Bug: 41340914
Change-Id: Ia2b4ccdc281757ec746bca6a730ca118e8be671c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7893568
Commit-Queue: Seokho Song <seokho@chromium.org>
Reviewed-by: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1642166}