Skip to content

Fix selection jumping when drag-selecting out of a float#60413

Merged
chromium-wpt-export-bot merged 1 commit into
masterfrom
chromium-export-cl-7893568
Jun 5, 2026
Merged

Fix selection jumping when drag-selecting out of a float#60413
chromium-wpt-export-bot merged 1 commit into
masterfrom
chromium-export-cl-7893568

Conversation

@chromium-wpt-export-bot

@chromium-wpt-export-bot chromium-wpt-export-bot commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

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}

@wpt-pr-bot wpt-pr-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

@chromium-wpt-export-bot chromium-wpt-export-bot force-pushed the chromium-export-cl-7893568 branch from 1c21567 to 2ab4afb Compare June 5, 2026 07:12
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}
@chromium-wpt-export-bot chromium-wpt-export-bot force-pushed the chromium-export-cl-7893568 branch from 2ab4afb to e997c99 Compare June 5, 2026 07:35
@chromium-wpt-export-bot chromium-wpt-export-bot merged commit df0e36b into master Jun 5, 2026
27 checks passed
@chromium-wpt-export-bot chromium-wpt-export-bot deleted the chromium-export-cl-7893568 branch June 5, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants