Closed Bug 1980051 Opened 1 month ago Closed 28 days ago

[wpt-sync] Sync PR 54043 - Fix offsetParent computation for elements with fixed position

Categories

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

task

Tracking

()

RESOLVED FIXED
143 Branch
Tracking Status
firefox143 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Attachments

(1 file)

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

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

zhoupeng <zhoupeng.1996@bytedance.com> wrote:

Fix offsetParent computation for elements with fixed position

Consider this test case: <div style="transform: translate(50px, 50px);" id="transform">
<div style="position: fixed;" id="fixed"></div>
</div>

Observed behavior: div#fixed has offsetParent = null, but its offsetLeft and offsetTop are relative to div#transform (both values = 0).

Specification conflict, current CSSOM spec states:

The element’s computed value of the position property is fixed.
This contradicts the observed behavior since transform establishes a containing block for fixed-position descendants. Other properties like will-change and contain can trigger this too.

Proposed Specification Update of offsetParent:

If any of the following holds true return null and terminate this algorithm:

  • The element’s computed value of the position property is fixed and no ancestor establishes a fixed position containing block.

Let ancestor be the parent of the element in the flat tree and repeat these substeps:

  • If ancestor is closed-shadow-hidden from the element, the element has a computed position value of fixed, and no ancestor establishes a fixed position containing block, terminate this algorithm and return null.

Implement it in Chromium first, then update the spec. See https://github.com/w3c/csswg-drafts/issues/12352 for more details.

Bug: 40694036
Change-Id: I4bf32a9a5ab73c44051d13fd9c79eac7515c973e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6774502
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Peng Zhou <zhoupeng.1996@bytedance.com>
Cr-Commit-Position: refs/heads/main@{#1492432}

PR 54043 applied with additional changes from upstream: 18c64a74b16bbbbe124eedf9855fcd44baf679f6
Component: web-platform-tests → CSS Parsing and Computation
Product: Testing → Core
Attached file Notable wpt changes
# CI Results Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI Total 784 tests ## Status Summary ### Firefox `OK` : 3[GitHub] 604[Gecko-android-em-7.0-x86_64-lite-qr-opt-geckoview, Gecko-android-em-7.0-x86_64-qr-debug-geckoview, Gecko-android-em-7.0-x86_64-qr-opt-geckoview] 606[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-24h2-debug, Gecko-windows11-32-24h2-opt, Gecko-windows11-64-24h2-debug, Gecko-windows11-64-24h2-opt] `PASS` : 21[GitHub] 37[Gecko-linux2204-64-wayland-debug, Gecko-linux2204-64-wayland-opt] 24253[Gecko-android-em-7.0-x86_64-lite-qr-opt-geckoview, Gecko-android-em-7.0-x86_64-qr-debug-geckoview, Gecko-android-em-7.0-x86_64-qr-opt-geckoview] 24274[Gecko-windows11-32-24h2-debug, Gecko-windows11-32-24h2-opt] 24324[Gecko-linux2404-64-debug] 24325[Gecko-linux2404-64-opt, Gecko-windows11-64-24h2-debug, Gecko-windows11-64-24h2-opt] `FAIL` : 15[GitHub] 5628[Gecko-windows11-32-24h2-debug, Gecko-windows11-32-24h2-opt] 5713[Gecko-linux2404-64-opt, Gecko-windows11-64-24h2-debug, Gecko-windows11-64-24h2-opt] 5714[Gecko-linux2404-64-debug] 5734[Gecko-android-em-7.0-x86_64-lite-qr-opt-geckoview, Gecko-android-em-7.0-x86_64-qr-debug-geckoview, Gecko-android-em-7.0-x86_64-qr-opt-geckoview] `ERROR`: 2 ### Chrome `OK` : 3 `PASS` : 23 `FAIL` : 13 ### Safari `OK` : 3 `PASS` : 21 `FAIL` : 15 ## Links [Gecko CI (Treeherder)](https://treeherder.mozilla.org/#/jobs?repo=try&revision=b82d41eeff3b48b1d89ccb9571e1b8361ae44b37) [GitHub PR Head](https://wpt.fyi/results/?sha=d1a171c085d7d3e7777c42c4c8941076cbe3aa12&label=pr_head) [GitHub PR Base](https://wpt.fyi/results/?sha=d1a171c085d7d3e7777c42c4c8941076cbe3aa12&label=pr_base) ## Details ### Firefox-only Failures * [/css/css-anchor-position/anchor-position-multicol-002.html](https://wpt.live/css/css-anchor-position/anchor-position-multicol-002.html) [[wpt.fyi](https://wpt.fyi/results/css/css-anchor-position/anchor-position-multicol-002.html)] * .target 6: `FAIL` linked bug:Bug 1816183 * .target 10: `FAIL` linked bug:Bug 1816183 * [/css/cssom-view/offsetParent-fixed.html](https://wpt.live/css/cssom-view/offsetParent-fixed.html) [[wpt.fyi](https://wpt.fyi/results/css/cssom-view/offsetParent-fixed.html)] * If the containing block for a fixed positioned element is viewport, the offsetParent should be null.: `FAIL` * [/shadow-dom/offsetParent-across-shadow-boundaries.html](https://wpt.live/shadow-dom/offsetParent-across-shadow-boundaries.html) [[wpt.fyi](https://wpt.fyi/results/shadow-dom/offsetParent-across-shadow-boundaries.html)] * offsetParent must return null when the context object is assigned to a slot without a fixed containing block in shadow tree of open mode: `FAIL` * offsetParent must return null when the context object is assigned to a slot without a fixed containing block in shadow tree of closed mode: `FAIL` (See attachment for full changes)
Status: NEW → RESOLVED
Closed: 28 days ago
Resolution: --- → FIXED
Target Milestone: --- → 143 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: