W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2014

[whatwg] Size of non-rendered viewports

From: Ian Hickson <ian@hixie.ch>
Date: Sat, 1 Mar 2014 00:13:59 +0000 (UTC)
To: Boris Zbarsky <bzbarsky@MIT.EDU>
Message-ID: <alpine.DEB.2.00.1402282351200.32463@ps20323.dreamhostps.com>
Cc: whatwg@lists.whatwg.org
On Tue, 7 Jan 2014, Boris Zbarsky wrote:
> On 1/7/14 2:24 PM, Ian Hickson wrote:
> > It's probably just a matter of saying, in the rendering section, that 
> > nested browsing contexts that aren't _being_rendered_ (or that are 
> > <frame>s outside <frameset>s) get a 0x0 viewport.
> 
> That doesn't seem unreasonable.

Done.


> > (Viewports that are being rendered seem to have an unambiguous 
> > dimension
> 
> Actually, nothing defines this either.  It should be the content box of 
> the <iframe>, assuming iframes can't get fragmented.  If they can be 
> fragmented, I have no idea.

Fixed (well, not the fragmented case).

   http://html5.org/tools/web-apps-tracker?from=8517&to=8518


> How about this testcase:
> 
> <!DOCTYPE html>
> <style>
>   div { color: purple; }
> </style>
> <link rel="stylesheet" href="data:text/css,%23one { color: yellow; }"
>       media="(min-width: 300px)">
> <link rel="stylesheet" href="data:text/css,%23two { color: yellow; }"
>       media="(max-width: 300px)">
> <div id="one"></div>
> <div id="two"></div>
> <script>
>   window.onload = function() {
>     alert(getComputedStyle(document.getElementById("one"), "").color +
>           " | " +
>           getComputedStyle(document.getElementById("two"), "").color);
>   }
> </script>
> 
> and variants on it.  From my testing, in a display:none iframe:
> 
> 1)  Presto-based Opera treats the viewport width as 300px for purposes of the
> media queries and reports a document.body.offsetWidth of 0.
> 
> 2)  Blink and WebKit both seems to treat the viewport width as 0 when measured
> using either method.
> 
> 3)  Gecko doesn't allow creation of computed style objects in an iframe that's
> not being rendered and reports a document.body.offsetWidth of 0.
> 
> 4)  IE11 seems to do what Blink/WebKit do.

Making the viewport 0x0 makes Blink, WebKit, Gecko, and IE11 consistent 
here, right? Whether or not computed style objects are created is 
something I'll leave up to the CSSOM spec.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Saturday, 1 March 2014 00:14:23 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:17 UTC