mirror of
https://github.com/servo/servo
synced 2026-05-08 16:12:15 +02:00
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`. Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Luke Warlow <lwarlow@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>