Re: [CSS2.1][CSSOM] "Used Value" and "auto"

On Thu, Jul 12, 2012 at 12:35 AM, Mike Sherov <mike.sherov@gmail.com> wrote:

> I'm working with Ryosuke Niwa on correcting the behavior of
> getComputedStyle(elem).top/left/right/bottom in Chrome. It led us to a
> discussion about whether or not "auto" is a valid used value, and whether
> it should be returned by getComputedStyle if get computed style is
> returning a "used value" for a specific property. The discussion is
> https://bugs.webkit.org/show_bug.cgi?id=29084 and
> https://www.w3.org/Bugs/Public/show_bug.cgi?id=16389
>
> Basically, IE9/FF/Opera/Webkit all currently have different behaviors with
> regards to this test:
> https://bug-29084-attachments.webkit.org/attachment.cgi?id=151525
> Opera 11.6: Passes all tests as written
> FF13: Converts "auto" to pixels so fails when expecting "auto".
> IE9/IE10: incorrectly accounts for padding so fails on the padding tests.
> Webkit: doesn't convert to pixels so fails when expecting pixels.
>
> Obviously, we want Webkit to return pixels when percentages are specified.
> This makes us believe "used value" should be used, and more specifically,
> that the "resolved value" for top/left/bottom/right should be brought into
> line with margin/padding/border (in that they all use "used value" if
> display is not "none"). However, we're unsure if "auto" is a "used value",
> or if "used value" should be pixels, as is seen in FF13's current
> implementation.
>
> I summed up the argument thusly:
>
>
> According to http://www.w3.org/TR/CSS2/cascade.html#used-value, " The
> used value is the result of taking the computed value and resolving any
> remaining dependencies into an absolute value." and then subsequently "A
> used value is in principle the value used for rendering,"
> Is "auto" an absolute value or the value used for rendering? I don't
> personally believe so.
>
>
Agreed. DOM-2 Style specifies that computed value is returned, referring to
the CSS2 (1998) definition of computed value, which specifically cites
'auto' and percentages as relative values, to which the following applies:

"Relative values, on the other hand, must be transformed into computed
values: percentages must be multiplied by a reference value (each property
defines which value that is), values with relative units (em, ex, px) must
be made absolute by multiplying with the appropriate font or pixel size,
'auto' values must be computed by the formulas given with each property,
certain keywords ('smaller', 'bolder', 'inherit') must be replaced
according to their definitions."


>
> Is "auto" a useful value to return? I personally don't believe so.
>
>
Not only is it not useful, but it is inconsistent with older (pre CSSOM)
specs.


> Is "auto" consistent with MOST of the other browsers? yes.
>
>
IMO, the browsers that are returning 'auto' are incorrect, and need to be
rectified.


> The crux of my question is this: is "auto" considered a "used value"? If
> not, should it be converted to pixels for top/left/bottom/right (like FF13)?


Yes.


> Any insights here would be extremely helpful.

Received on Thursday, 12 July 2012 08:13:22 UTC