[wpt-sync] Sync PR 54043 - Fix offsetParent computation for elements with fixed position
Categories
(Core :: CSS Parsing and Computation, task, P4)
Tracking
()
Tracking | Status | |
---|---|---|
firefox143 | --- | fixed |
People
(Reporter: wpt-sync, Unassigned)
References
()
Details
(Whiteboard: [wptsync downstream])
Attachments
(1 file)
720.75 KB,
text/plain
|
Details |
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
hasoffsetParent = null
, but itsoffsetLeft
andoffsetTop
are relative todiv#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 offixed
, 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}
Assignee | ||
Comment 1•1 month ago
|
||
Assignee | ||
Updated•1 month ago
|
Assignee | ||
Comment 2•1 month ago
|
||
Assignee | ||
Comment 3•1 month ago
|
||
Comment 5•28 days ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/cb321226f77f
https://hg.mozilla.org/mozilla-central/rev/1c4dd719d8d4
Description
•