W3C home > Mailing lists > Public > public-web-perf@w3.org > July 2012

Re: requestAnimationFrame behavior on display:none iframes

From: Nat Duca <nduca@chromium.org>
Date: Mon, 9 Jul 2012 16:11:39 -0700
Message-ID: <CAAMsTOs37iE-VLPsy+33q1RhQfUC_wE=F25oF87WStYSW1QFuw@mail.gmail.com>
To: Jatinder Mann <jmann@microsoft.com>
Cc: Boris Zbarsky <bzbarsky@mit.edu>, "public-web-perf@w3.org" <public-web-perf@w3.org>
Thanks Jatinder, Boris. That url is fixed now. Hosting issues.
(http://www.jankfree.com/raf/iframes_and_visibility_when_hidden.html)

Here's the use case that got me thinking about document.visibility,
iframes and rAF.

A week ago, I was working on a HTML5 slide deck where we would add
demo content to the deck as iframes. E.g.
<slide>
   <title> blahblah</title>
   <iframe src="./fps/measure_my_fps.html">
</slide>
<slide>
   <title> blahblah</title>
   <iframe src="./game1/game1.html">
</slide>

This slide deck toggles between slides by adding/removing a class that
puts a display:none on the slide element. The iframe is indirectly
hidden from that. A full deck is here to toy with:
http://www.jankfree.com/jank-busters-io/index.html

The problem, of course, is a browser that ticks iframes that aren't
visible, these slides start burning CPU time even though they're
hidden. And, because you dont get visibility changes events on the
iframe's content document for this case, I dont think you can even
work around this with custom js code.

Firefox does what I think is the right thing here... it doesn't tick
those hidden iframes.

Thoughts?


- N

On Fri, Jul 6, 2012 at 10:35 AM, Jatinder Mann <jmann@microsoft.com> wrote:
> On 7/3/12 1:30 AM, Nat Duca wrote:
>> Should requestAnimationFrame tick on display:none iframes?
>>
>> A simple test:
>> http://www.jankfree.com/raf/iframes_and_visibility_when_hidden.html
>>
>> FF and Chrome differ:
>> -  FF doesn't tick
>> - Webkit does
>>
>> Not sure what IE does.
>
> IE will tick for display:none iframes, as the document.hidden is false.
>
> Thanks,
> Jatinder
>
>
>
Received on Monday, 9 July 2012 23:12:07 UTC

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