CSSOM clarifying used value for box model attributes, and specifically margins

I had some questions and comments with regards to the
http://dev.w3.org/csswg/cssom/  editor's draft, specifically the section
regarding resolved values and used values, and what getComputedStyle()
should be reporting in regards to margin values. I contacted the editor
listed on the draft, who pointed me here since she has resigned. I'm sure
there are edge cases I am not considering, but I wanted to present the
findings I have, and seek clarification on desired behavior.

In any case, the problems can be demonstrated by looking at a few examples,
which I lay out in the webkit bug tracker:
https://bugs.webkit.org/show_bug.cgi?id=73334

1. Basically, there is some confusion around whether getComputedStyle() for
box model attributes, and specifically margins, should always return a
pixel value or not. Currently, webkit reports percentages if a percentage
was specified, which can be seen by opening http://jsfiddle.net/u4F8m/9/ in
a webkit browser. I'd argue that this should return a pixel value. Perhaps
the CSSOM spec could be revised to clarify further what a used value means
with regards to box model attributes, and in
http://dev.w3.org/csswg/cssom/#resolved-values specifically mention pixel
value. You can see the problem even further by opening this fiddle in O,
FF, Webkit, IE9: http://jsfiddle.net/u4F8m/13/ they all report different
values!

2. There is confusion amongst the browsers over what value to report in
getComputedStyle() for margins when the value is set to "auto". Now, it
*may* be that every browser except IE9 is correct in reporting 0px for
margin-right when margin is set to auto, as it is here:
http://jsfiddle.net/pyeNX/13/ . However, isn't the margin here, expressed
as pixels, greater than 0? Now, I know everyone but IE9 reports 0px, but I
believe that "used value" would dictate this margin to be the actual pixel
value used, which seems like it's clearly greater than 0! That's how the
inner div gets centered, right?

I'm sure there are many considerations which I have not considered in
presenting this information or I may be missing something, but I'd love
some feedback on this.

Received on Saturday, 3 December 2011 17:00:26 UTC