Closed Bug 2072003 Opened 2 months ago Closed 1 month ago

[wpt-sync] Sync PR 62682 - layout: Stop reusing a box that has become absolutely positioned

Categories

(Core :: CSS Parsing and Computation, task, P4)

task

Tracking

()

RESOLVED FIXED
159 Branch
Tracking Status
firefox159 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 62682 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/62682
Details from upstream follow.

mxmgorin <102797145+mxmgorin@users.noreply.github.com> wrote:

layout: Stop reusing a box that has become absolutely positioned

This rebuilds an element through its ancestor when it becomes absolutely positioned, instead of reusing its existing in-flow box. rebuild_box_tree_from_independent_formatting_context normally reuses the existing box, but BlockLevelBox::Independent checks only the display when deciding whether it still matches the new style. Unlike the out-of-flow arms, it does not check is_absolutely_positioned(). An element that becomes absolutely positioned is therefore rebuilt in place as an in-flow formatting context, so it never joins its containing block's out-of-flow list.

The element then generates no fragment: getBoundingClientRect() returns 0x0 and nothing paints, while its computed position and clientWidth/clientHeight still report a box. This affects flex and grid containers, display: flow-root, and block-level replaced elements. A plain block is a SameFormattingContextBlock, which falls through to _ => false and is rebuilt by an ancestor; Independent now takes that same path when the new style is absolutely positioned.

Testing: New css/css-position/position-absolute-dynamic-formatting-context.html, which lays an element out in flow and then takes it out of flow. Eight of its twelve subtests fail without this change.
Reviewed in servo/servo#48081

Component: web-platform-tests → Layout: Positioned
Product: Testing → Core
Component: Layout: Positioned → CSS Parsing and Computation

CI Results

Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 537 tests

Status Summary

Firefox

OK : 2[GitHub] 131[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: 24[GitHub] 44[Gecko-linux2204-64-wayland-debug, Gecko-linux2204-64-wayland-opt] 1519[Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt] 1804[Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt] 1811[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] 1817[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt]
FAIL: 128[Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt] 192[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt] 194[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] 204[Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]

Chrome

OK : 2
PASS: 24

Safari

OK : 2
PASS: 24

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

Tests Disabled in Gecko Infrastructure

  • /css/css-position/fixed-z-index-blend.html [wpt.fyi]: PASS [Gecko-linux2404-64-debug, Gecko-linux2404-64-opt], SKIP [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-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 159 Branch
You need to log in before you can comment on or make changes to this bug.