[wpt-sync] Sync PR 64203 - [Blink] Fix layout lifecycle crash on gesture long-press
Categories
(Core :: DOM: Selection, task, P4)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox162 | --- | fixed |
People
(Reporter: wpt-sync, Unassigned)
References
()
Details
(Whiteboard: [wptsync downstream])
Attachments
(1 file)
|
137.89 KB,
text/plain
|
Details |
Sync web-platform-tests PR 64203 into mozilla-central (this bug is closed when the sync is complete).
PR: https://github.com/web-platform-tests/wpt/pull/64203
Details from upstream follow.
Samuel Huang <huangs@chromium.org> wrote:
[Blink] Fix layout lifecycle crash on gesture long-press
Fix a layout lifecycle assertion crash in
HitTestResult::GetPosition()
during touch long-press gestures.When a touch long-press occurs,
HandleGestureLongPress()calls
SelectClosestWordFromHitTestResult()to select the word. If word
selection fails or is cancelled by aselectstartevent listener, it
falls back to placing a caret viaSetCaretAtHitTestResult(). Both
methods queryHitTestResult::GetPosition(), which asserts (DCHECK)
that the document lifecycle is at leastkPrePaintClean.However, gesture selection previously lacked proper layout lifecycle
updates:
HandleGestureLongPress()only invokedUpdateStyleAndLayoutTree(),
skipping layout geometry and pre-paint property tree updates needed
bySelectClosestWordFromHitTestResult().- When
SelectClosestWordFromHitTestResult()dispatchesselectstart,
author JavaScript can mutate styles or DOM and cancel selection.
This re-dirties the document lifecycle mid-gesture before the
fallback caret placement inSetCaretAtHitTestResult().While mouse press paths were long ago guarded with full lifecycle
updates inMouseEventManager::HandleMousePressEvent(), gesture paths
were missing these guards.Change details: In
blink::SelectionController:
HandleGestureLongPress(): Advance all lifecycle phases through
pre-paint by replacingUpdateStyleAndLayoutTree()call with
UpdateAllLifecyclePhasesExceptPaint().SetCaretAtHitTestResult(): Add the same call to ensure any
mid-gesture mutations (and other callers like
HandleGestureTwoFingerTap()) operate on clean layout geometry.- Add regression unit tests in
selection_controller_test.cc, covering
both pre-gesture dirty layout and mid-gesture selectstart mutations.- Add WPT crashtest in
longpress-selection-crash.html.Bug: 570656468
Change-Id: Ic00654959ef8b61e7645a0f55a780d634133a05e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8520941
Commit-Queue: Samuel Huang \<huangs@chromium.org>
Reviewed-by: Robert Flack \<flackr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1726736}
| Assignee | ||
Updated•1 month ago
|
| Assignee | ||
Updated•1 month ago
|
| Assignee | ||
Updated•26 days ago
|
| Assignee | ||
Comment 1•26 days ago
|
||
Pushed to try (stability) https://treeherder.mozilla.org/jobs?repo=try&landoInstance=lando-prod-2025&landoCommitID=114222
| Assignee | ||
Comment 2•24 days ago
|
||
CI Results
Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI
Total 194 tests
Status Summary
Firefox
OK : 1[GitHub] 134[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS: 1[GitHub] 36[Gecko-linux2204-64-wayland-debug, Gecko-linux2204-64-wayland-opt] 33610[Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt] 33629[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt] 33633[Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
FAIL: 847[Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt] 848[Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt] 851[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview] 852[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt]
Chrome
OK : 1
PASS: 1
Safari
OK : 1
PASS: 1
Links
Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base
Details
(See attachment for full changes)
Comment 4•18 days ago
|
||
| bugherder | ||
Description
•