fix: don't force layout from LayoutSelection::Commit() - #52670
Open
codebytere wants to merge 2 commits into
Open
fix: don't force layout from LayoutSelection::Commit()#52670codebytere wants to merge 2 commits into
codebytere wants to merge 2 commits into
Conversation
deepak1556
reviewed
Aug 6, 2026
deepak1556
left a comment
Member
There was a problem hiding this comment.
Not much familiar with this code path, the upstream test doesn't seem to validate the pending selection gets committed on the next update. Is that intentional ?
If possible waiting for upstream review before merging would be good to get additional confidence.
Backports https://chromium-review.googlesource.com/c/chromium/src/+/8187581. LayoutSelection::Commit() runs during the compositing-inputs lifecycle phase and reaches FrameSelection::SelectionHasFocus(), which forces Document::UpdateStyleAndLayout(). Style can be dirty at that point without the lifecycle having rewound (a due animation timing update is enough), and then the recalc runs while tree mutations are disallowed and the renderer dies on CHECK(Lifecycle().StateAllowsTreeMutations()) - in the field a plain drag-select mouse-up crash. Keep the selection pending and schedule another frame instead, so the next frame commits against clean style.
codebytere
force-pushed
the
fix-blink-selection-commit
branch
from
August 6, 2026 18:27
3e73d93 to
543d58c
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.
Description of Change
Backports https://chromium-review.googlesource.com/c/chromium/src/+/8187581 (in review upstream; the patch drops out when it merges and rolls).
LayoutSelection::Commit()runs during the compositing-inputs lifecycle phase and reachesFrameSelection::SelectionHasFocus(), which unconditionally forcesDocument::UpdateStyleAndLayout(). If the layout tree is still dirty at that point, the recalc runs while tree mutations are disallowed and the renderer dies onCHECK(Lifecycle().StateAllowsTreeMutations())- in the field this is a plain drag-select mouse-up crash. The fix keeps the selection pending and schedules another frame, so the next frame's compositing-inputs step commits against a clean tree.Checklist
npm testpassesRelease Notes
Notes: Fixed a renderer crash when finishing a drag selection while a layout update was still pending.