Skip to content

layout: Remove box damage for parent when we can reuse the box#58075

Merged
servo-wpt-sync merged 1 commit intoweb-platform-tests:masterfrom
servo:servo_export_42847
Feb 26, 2026
Merged

layout: Remove box damage for parent when we can reuse the box#58075
servo-wpt-sync merged 1 commit intoweb-platform-tests:masterfrom
servo:servo_export_42847

Conversation

@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

@servo-wpt-sync servo-wpt-sync commented Feb 26, 2026

This fixes an oversight from #42783: when detecting that a box can be reused, we weren't clearing the box damage propagated to ancestors, so ancestors were still recollecting children.

This exposed some problems in rebuild_box_tree_from_independent_formatting_context():

  1. When reusing a block-level box that established an independent formatting context, we weren't checking that the new style was still block-level.
  2. When reusing a block-level abspos box, we weren't checking if the new original display was inline-level, preventing it from being handled as a block-level because of the static position.
  3. When reusing a flex item, we weren't checking if the order had changed.

Testing: we have test coverage for the 3 problems above:

  1. Covered by /html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display.html, and also adding a new /css/css-display/display-flow-root-dynamic.html.
  2. Covered by /css/CSS2/abspos/hypothetical-box-dynamic.html
  3. Covered by /css/css-display/order-dynamic.html.
    Reviewed in layout: Remove box damage for parent when we can reuse the box servo/servo#42847

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

This fixes an oversight from web-platform-tests#42783: when detecting that a box can be
reused, we weren't clearing the box damage propagated to ancestors, so
ancestors were still recollecting children.

Co-authored-by: Luke Warlow <[email protected]>
Co-authored-by: Martin Robinson <[email protected]>
Signed-off-by: Oriol Brufau <[email protected]>
@servo-wpt-sync servo-wpt-sync merged commit 5c3a694 into web-platform-tests:master Feb 26, 2026
24 of 25 checks passed
@servo-wpt-sync servo-wpt-sync deleted the servo_export_42847 branch February 26, 2026 21:42
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