merge_pr_54043
版本发布时间: 2025-08-01 01:49:33
web-platform-tests/wpt最新发布版本:merge_pr_59116(2026-04-11 15:31:06)
Fix offsetParent computation for elements with fixed position (#54043)
Consider this test case:
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
positionvalue 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}
Co-authored-by: zhoupeng zhoupeng.1996@bytedance.com
1、 MANIFEST-ae114742821d016d3dc6cf2e816d801847b78193.json.bz2 2.62MB
2、 MANIFEST-ae114742821d016d3dc6cf2e816d801847b78193.json.gz 3.23MB
3、 MANIFEST-ae114742821d016d3dc6cf2e816d801847b78193.json.zst 2.59MB
4、 WEB_FEATURES_MANIFEST-ae114742821d016d3dc6cf2e816d801847b78193.json.bz2 95.15KB
5、 WEB_FEATURES_MANIFEST-ae114742821d016d3dc6cf2e816d801847b78193.json.gz 110.34KB
6、 WEB_FEATURES_MANIFEST-ae114742821d016d3dc6cf2e816d801847b78193.json.zst 93.32KB