W3C home > Mailing lists > Public > public-web-perf@w3.org > April 2013

Re: requestAnimationFrame behavior on display:none iframes

From: Jonas Sicking <jonas@sicking.cc>
Date: Sat, 13 Apr 2013 05:48:14 +0200
Message-ID: <CA+c2ei8oGG7uS3tigLC1sQCNJAZMJeXapYrab2ziFOp7nLMEoA@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: James Robinson <jamesr@google.com>, "public-web-perf@w3.org" <public-web-perf@w3.org>
On Thu, Apr 11, 2013 at 2:45 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 4/10/13 6:32 PM, James Robinson wrote:
>>
>> 1.) Gmail loads up a large portion of its script in an iframe styled to
>> be 0x0.  While this iframe is not display:none, it's hidden for any
>> practical definition of hidden.
>
> That's not quite true.
>
> For example, it has a well-defined CSS viewport and hence can do media
> queries and selector matching and other CSS things, unlike a display:none
> iframe...

It seems to me that by making display:none iframes slow down the rate
of rAF callbacks we cover the common usecase of saving CPU and battery
by slowing down animations inside of iframes, while also enabling the
use case of allowing hidden iframes to animate parent iframes by doing
a little bit of extra work by using a 0x0 iframe rather than a
display:none one.

I.e. we're optimizing for the common use case, while also enabling the
not-as-common use case.

Note that I'm listing it as not-as-common here since the only use case
mentioned so far is using iframes to work around the blocking-script
issue, which we nowadays have better solutions for using the async
attribute. So we can expect websites to in the long term migrate
towards that solution.

/ Jonas
Received on Saturday, 13 April 2013 03:49:13 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:04:35 UTC