Skip to content

[Gecko Bug 2036298] Make nsIFrame::MoveCaretToEventPoint compare with the inclusive flattened tree ancestor element to consider if during a drag gesture#59610

Merged
moz-wptsync-bot merged 1 commit intomasterfrom
gecko/2036298
May 1, 2026
Merged

[Gecko Bug 2036298] Make nsIFrame::MoveCaretToEventPoint compare with the inclusive flattened tree ancestor element to consider if during a drag gesture#59610
moz-wptsync-bot merged 1 commit intomasterfrom
gecko/2036298

Conversation

@moz-wptsync-bot
Copy link
Copy Markdown
Collaborator

EventStateManager::mGestureDownContent needs to be a Text if the
drag gestures started from the Text even though the event target
should be its parent element. The reason is, various places maintain
Selection with the Text node.

On the other hand, nsIFrame::MoveCaretToEventPoint considers whether
it's in a drag gesture with checking mGestureDownContent is different
from its mContent. However, this is not enough if the text frame is
reframed by a mousedown listener. In that case, we handle the
eMouseDown event with the parent element's frame. Therefore, current
code does not work with the editable Text in <input> and
<textarea> (the drag starting to select from start of the Text and
cannot collapse the non-collapsed selection). Therefore, we should
check whether the frame content is different from the parent element of
mGestureDownContent too.

Differential Revision: https://phabricator.services.mozilla.com/D297855

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=2036298
gecko-commit: b44c377383cd9f9df5b064a13b258cf071fe91ed
gecko-reviewers: emilio, layout-reviewers

…ttened tree ancestor element to consider if during a drag gesture

`EventStateManager::mGestureDownContent` needs to be a `Text` if the
drag gestures started from the `Text` even though the event target
should be its parent element. The reason is, various places maintain
`Selection` with the `Text` node.

On the other hand, `nsIFrame::MoveCaretToEventPoint` considers whether
it's in a drag gesture with checking `mGestureDownContent` is different
from its `mContent`. However, this is not enough if the text frame is
reframed by a `mousedown` listener. In that case, we handle the
`eMouseDown` event with the parent element's frame. Therefore, current
code does not work with the editable `Text` in `<input>` and
`<textarea>` (the drag starting to select from start of the `Text` and
cannot collapse the non-collapsed selection). Therefore, we should
check whether the frame content is different from the parent element of
`mGestureDownContent` too.

Differential Revision: https://phabricator.services.mozilla.com/D297855

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=2036298
gecko-commit: b44c377383cd9f9df5b064a13b258cf071fe91ed
gecko-reviewers: emilio, layout-reviewers
Copy link
Copy Markdown
Collaborator

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

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 Firefox project.

@moz-wptsync-bot moz-wptsync-bot merged commit 66d4323 into master May 1, 2026
18 checks passed
@moz-wptsync-bot moz-wptsync-bot deleted the gecko/2036298 branch May 1, 2026 20:24
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