RESOLVED INVALID 18300
getComputedStyle() -> length values floored
https://bugs.webkit.org/show_bug.cgi?id=18300
Summary getComputedStyle() -> length values floored
Garrett Smith
Reported 2008-04-03 10:18:15 PDT
When getting the computed style, values are rounded. This sets the border width of the element in EM units, then gets the value of the computed border width in px, using getComputedStyle. The problem seems to be that the value is floored. The expected value would be: "11.8px" borderWidth: javascript:(function(){var c1 =document.getElementsByTagName("div")[0], style=c1.style; style.border ="1.18em solid"; style.fontSize = "10px"; var cs = getComputedStyle(c1, ""); alert([cs.borderTopWidth, cs.borderRightWidth, cs.borderBottomWidth, cs.borderLeftWidth]);})(); The actual value: "11px" javascript:(function(){var c1 =document.getElementsByTagName("div")[0], style=c1.style; style.margin ="1.18em"; style.fontSize = "10px"; var cs = getComputedStyle(c1, ""); alert([cs.marginTop, cs.marginLeft, cs.marginBottom, cs.marginRight]);})(); This creates problems when attempting to measure the dimensions of an element, or find it's position.
Attachments
test case demonstrating that our behavior matches FF3 (621 bytes, text/html)
2009-03-05 17:06 PST, Eric Seidel (no email)
no flags
Garrett Smith
Comment 1 2008-04-03 10:48:54 PDT
updated URL
Eric Seidel (no email)
Comment 2 2009-03-05 17:05:49 PST
I've made a test case from the JS you posted. Your test case was a URL to your local harddrive, which isn't accessible to me. ;)
Eric Seidel (no email)
Comment 3 2009-03-05 17:06:10 PST
Created attachment 28338 [details] test case demonstrating that our behavior matches FF3
Eric Seidel (no email)
Comment 4 2009-03-05 17:06:29 PST
as far as I can tell, our behavior matches FF3, they also round. Closing this bug as invalid.
Note You need to log in before you can comment on or make changes to this bug.