[Webkit-unassigned] [Bug 67422] Document reflows with height:auto in CSS and HTML image dimensions

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Oct 19 20:48:41 PDT 2011


Shane Stephens <shanestephens at google.com> changed:

           What    |Removed                     |Added
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Shane Stephens <shanestephens at google.com>  2011-10-19 20:48:41 PST ---
After talking to Tab Atkins (our CSS/HTML5 expert) this isn't a bug.

Tracing things through:

"The width and height attributes on applet, embed, iframe, img, object or video elements, and input elements with a type attribute in the Image Button state, map to the dimension properties 'width' and 'height' on the element respectively." (http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#images-0).

This means that "the user agent is expected to use the parsed dimension as the value for a presentational hint" (http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#maps-to-the-dimension-property).

A presentational hint is "author-level zero-specificity" (http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#presentational-hints).

In other words, setting the width and height in HTML and "width: 100%; height: auto;" in CSS is exactly equivalent to just setting "width: 100%; height: auto;" in CSS (because the latter overrides the former).

However, "if 'height' has a computed value of 'auto', and the element has an intrinsic ratio then the used value of 'height' is: (used width) / (intrinsic ratio)" (http://www.w3.org/TR/CSS2/visudet.html#inline-replaced-height).

What this means is that the height can't be known until the image is loaded and its aspect ratio determined, which means that WebKit can't lay out the page until the image is loaded.

Use "onload" instead of "ready".

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