In the following page, clicking on "Hi" shows Computed: normal element: 20 This is true both on 419.3/MacOS and 522.13.1/Windows. On Firefox 2.0, it displays: Computed: 20 element: 20 Can't see where the string "normal" comes from, as legal values seem to be "inherit", "auto", and integers. "normal" shows whether or not the z-index property is set. <html> <head> <script> function testHtml() { var elem = document.getElementById('someId'); var compStyle = elem.ownerDocument.defaultView.getComputedStyle(elem, null); alert("Computed:" + compStyle.zIndex + ", off element: " + elem.style.zIndex); } </script> </head> <body> <div style="z-index:20" id ='someId' onclick="testHtml()">Hi</div> </body> </html>
Confirmed with a local debug build of WebKit r23737 with Safari 3.0 (522.12) on Mac OS X 10.4.10 (8R218). Note that this also occurs with Safari 2.0.4 (419.3) on Mac OS X 10.4.10 (8R218), so it is not a regression. Both Opera 9.21 and Firefox 2.0.0.4 work as expected.
Created attachment 15200 [details] Test case Please attach test cases to a bug in the future--makes them easier to test! :)
<rdar://problem/5290095>
Since the div is not positioned nor transparent, it actually renders as 'auto', so I don't think it should return '20'. That it returns 'normal' instead of auto looks like a simple typo in CSSComputedStyleDeclaration: if (style->hasAutoZIndex()) return new CSSPrimitiveValue(CSS_VAL_NORMAL); should be CSS_VAL_AUTO.
Created attachment 15204 [details] patch
Comment on attachment 15204 [details] patch Code change looks fine, but please improve the logging function in the test as discussed on IRC.
Created attachment 15205 [details] updated patch
Comment on attachment 15205 [details] updated patch r=me
Landed in r23754.