Bug 189518

Summary: Wrong getComputedStyle for 'auto' value of inset properties in fixed positioned elements
Product: WebKit Reporter: Oriol Brufau <obrufau>
Component: CSSAssignee: 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
Reported 2018-09-11 12:59:08 PDT
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
Oriol Brufau
Comment 1 2018-09-12 08:09:03 PDT
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
Comment 2 2022-09-03 14:21:59 PDT
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
Comment 3 2022-09-03 17:04:35 PDT
Note You need to log in before you can comment on or make changes to this bug.