RESOLVED FIXED 14321
getComputedStyle(...).zIndex returns string "normal"
https://bugs.webkit.org/show_bug.cgi?id=14321
Summary getComputedStyle(...).zIndex returns string "normal"
Adam Winer
Reported 2007-06-22 16:39:23 PDT
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>
Attachments
Test case (378 bytes, text/html)
2007-06-23 11:10 PDT, David Kilzer (:ddkilzer)
no flags
patch (4.86 KB, patch)
2007-06-23 23:41 PDT, Sam Weinig
mitz: review-
updated patch (4.72 KB, patch)
2007-06-23 23:54 PDT, Sam Weinig
mitz: review+
David Kilzer (:ddkilzer)
Comment 1 2007-06-23 11:08:43 PDT
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.
David Kilzer (:ddkilzer)
Comment 2 2007-06-23 11:10:43 PDT
Created attachment 15200 [details] Test case Please attach test cases to a bug in the future--makes them easier to test! :)
David Kilzer (:ddkilzer)
Comment 3 2007-06-23 11:11:35 PDT
mitz
Comment 4 2007-06-23 12:27:45 PDT
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.
Sam Weinig
Comment 5 2007-06-23 23:41:03 PDT
mitz
Comment 6 2007-06-23 23:51:10 PDT
Comment on attachment 15204 [details] patch Code change looks fine, but please improve the logging function in the test as discussed on IRC.
Sam Weinig
Comment 7 2007-06-23 23:54:05 PDT
Created attachment 15205 [details] updated patch
mitz
Comment 8 2007-06-23 23:58:18 PDT
Comment on attachment 15205 [details] updated patch r=me
Sam Weinig
Comment 9 2007-06-24 13:54:02 PDT
Landed in r23754.
Note You need to log in before you can comment on or make changes to this bug.