Repository navigation
script: More carefully handle dirty root and descendant damage marking - #61656
Merged
servo-wpt-sync merged 1 commit intoAug 4, 2026
Merged
Conversation
wpt-pr-bot
approved these changes
Jul 31, 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 Servo project.
servo-wpt-sync
force-pushed
the
servo_export_46906
branch
2 times, most recently
from
July 31, 2026 16:09
485e297 to
26a254b
Compare
Script passes a dirty root to layout along with setting the HAS_DIRTY_DESCENDANTS flag on elements at or below that root indicating that children need to be traversed. There was an undocumented invariant that no nodes above that dirty root were marked with HAS_DIRTY_DESCENDANTS, as the flag itself was used to determine when the dirty root is raised to some common ancestor of the old dirty root and a damaged node. There were some problems with the old implementation and this change fixes them by hewing closer to Gecko (from which we took this design). Notably: - In the complex situation where we cannot trivially calculate the dirty root, we now calculate it by walking up from the old dirty root and finding the first element which already has the flag set. - When removing nodes from the flat tree, if they were the previous dirty root, the dirty root is cleared. - Ensure that all marking traversals for HAS_DIRTY_DESCENDANTS flag marking happen in the flat tree. - When slotting nodes into `<slot>` elements, the style and layout data of fallback content is cleared, and the dirty root is potentially reset. - Comments are added everywhere in this tricky algorithm explaining what the heck is going on. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
servo-wpt-sync
force-pushed
the
servo_export_46906
branch
from
August 4, 2026 13:26
26a254b to
16c8830
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.
Script passes a dirty root to layout along with setting the
HAS_DIRTY_DESCENDANTS flag on elements at or below that root indicating
that children need to be traversed. There was an undocumented invariant
that no nodes above that dirty root were marked with
HAS_DIRTY_DESCENDANTS, as the flag itself was used to determine
when the dirty root is raised to some common ancestor of the old dirty
root and a damaged node.
There were some problems with the old implementation and this change
fixes them by hewing closer to Gecko (from which we took this design).
Notably:
root, we now calculate it by walking up from the old dirty root and
finding the first element which already has the flag set.
dirty root, the dirty root is cleared.
marking happen in the flat tree.
<slot>elements, the style and layout dataof fallback content is cleared, and the dirty root is potentially reset.
the heck is going on.
triggering restyles too late before a relayout -- when setting selection flags.
This is moved earlier in the method.
Testing: This change adds a new WPT crash test.
Fixes: #46024.
Fixes: #46883.
Reviewed in servo/servo#46906