Commit 21c7700
Bug 1980051 [wpt PR 54043] - Fix offsetParent computation for elements with fixed position, a=testonly
Automatic update from web-platform-tests
Fix offsetParent computation for elements with fixed position (#54043)
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
w3c/csswg-drafts#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>
--
wpt-commits: ae114742821d016d3dc6cf2e816d801847b78193
wpt-pr: 540431 parent fe9a008 commit 21c7700
File tree
3 files changed
+133
-6
lines changed- testing/web-platform/tests
- css
- css-anchor-position
- cssom-view
- shadow-dom
3 files changed
+133
-6
lines changedLines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | | - | |
| 119 | + | |
| 120 | + | |
121 | 121 | | |
Lines changed: 61 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
Lines changed: 66 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
84 | 150 | | |
85 | 151 | | |
86 | 152 | | |
| |||
0 commit comments