[Webkit-unassigned] [Bug 18300] New: getComputedStyle() -> length values floored

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Apr 3 10:18:15 PDT 2008


           Summary: getComputedStyle() ->  length values floored
           Product: WebKit
           Version: 525.x (Safari 3.1)
          Platform: PC
               URL: http://dhtmlkitchen.com/ape/test/tests/dom/position-f-
        OS/Version: Mac OS X 10.5
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: HTML DOM
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: dhtmlkitchen at gmail.com

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"

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,

This creates problems when attempting to measure the dimensions of an element,
or find it's position.

Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

More information about the webkit-unassigned mailing list