Bug 189518
Summary: | Wrong getComputedStyle for 'auto' value of inset properties in fixed positioned elements | ||
---|---|---|---|
Product: | WebKit | Reporter: | Oriol Brufau <obrufau> |
Component: | CSS | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | ahmad.saleem792, bfulgham, simon.fraser, webkit-bug-importer, zalan |
Priority: | P2 | Keywords: | BrowserCompat, InRadar |
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Oriol Brufau
Run this code: http://jsfiddle.net/msz9Lpfe/
```css
#container {
transform: scale(1);
border: 25px solid;
height: 100px;
}
#fixed {
position: fixed;
}
```
```html
<div id="container">
<div id="fixed"></div>
</div>
```
```js
fixed.append("top: ", getComputedStyle(fixed).top);
```
If the containing block of a fixed positioned element is derived from an ancestor element, then it should be the ancestor's padding area (*).
This means that "top: auto" should resolve to "top: 0px", but getComputedStyle says "25px" instead.
Note that if you set "top: 0", the element stays at the same position as with "top: auto", and with "top: 25px" it's shifted downwards.
So the element is painted at the right position, this is just a getComputedStyle problem.
Neither Firefox nor Chromium have this problem.
(*) The spec doesn't define that for fixed positioning, but it's how browsers behave and is consistent with absolutely positioning, which is properly defined in the spec.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Oriol Brufau
In fact, all values are currently affected. However, in https://bugs.webkit.org/show_bug.cgi?id=188711 I plan to fix all cases except for 'auto' values.
Ahmad Saleem
I am able to reproduce this bug using attached JSFiddle from Comment 0 and it shows "25px" for Safari 15.6.1 and STP 152 while it shows "0px" for Chrome Canary 107 and Firefox Nightly 106. Thanks!
Radar WebKit Bug Importer
<rdar://problem/99533470>