[Webkit-unassigned] [Bug 73334] New: getComputedStyle returns wrong value for margin-*

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 29 10:34:08 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=73334

           Summary: getComputedStyle returns wrong value for margin-*
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: CSS
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: mike.sherov at gmail.com


Since the change in: https://bugs.webkit.org/show_bug.cgi?id=13343 , getComputedStyle() returns the wrong value for margins. 

This is now against how IE9, FF3.6+, and Opera implements getComputedStyle() for margins. Open up the following jsfiddle in FF3.6+, Opera, IE9, and Chrome: http://jsfiddle.net/u4F8m/9/

It is also against the CSSOM editor's draft: http://dev.w3.org/csswg/cssom/#resolved-value
http://www.w3.org/TR/css3-values/

It also now makes margin inconsistent with how padding, width, and height work for resolved values in Webkit itself.

I would also argue that the comment in https://bugs.webkit.org/show_bug.cgi?id=13343 "Having getComputedStyle return the size of the gap between the element's edge and the associated edge of its container is just not a *useful* operation." is not true. It's very useful to now the exact pixel dimensions of a box. Why would I ever want to know that a margin is "10%"? 10% of what? The actual pixel value used is way more relevant.

I understand that https://bugs.webkit.org/show_bug.cgi?id=13343 was implemented so that when the margin is not-defined it doesn't report the distance between the margin and it's parents edge. However, I believe there is a middle ground that when a pixel is explicitly specified, it should convert to px. It should still report 0px if unspecified (although unfortunately, IE9 doesn't do that). The following fiddles deals illustrate that case: http://jsfiddle.net/pyeNX/1/

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



More information about the webkit-unassigned mailing list