RE: requestAnimationFrame behavior on display:none iframes

Page Visibility solves the larger performance problem of web pages unnecessarily using system resources even when they are not visible to the user. Prior to Page Visibility, developers had to design their sites as if they were always visible, even if they were in a background tab. With Page Visibility, developers will know when there site isn't visible and can throttle down their applications to reduce the strain on resources. This is definitely a useful API.

I actually like the idea of element visibility, but we didn't want to complicate an otherwise simple concept of page visibility. Now that we have solved the larger problem of background tabs not using system resources, we can focus on the page in the foreground tab and the visibility of elements on that page. I like the idea that one should be able to stop animations or advertisements that are below the fold on a foreground visible tab.

I believe the last time this topic was raised, the working group agreed that we can consider Element Visibility in a future specification. If we do develop an Element Visibility, requestAnimationFrame should use that interface to ensure that below the fold animations throttle down. As Element Visibility isn't available now, I recommend we consider that change in the Timing for Script Based Animations Level 2 spec. 

I'll raise defining an Element Visibility API in our next conference call.

Jatinder

-----Original Message-----
From: Boris Zbarsky [mailto:bzbarsky@MIT.EDU] 
Sent: Friday, February 15, 2013 2:48 PM
To: James Robinson
Cc: public-web-perf@w3.org
Subject: Re: requestAnimationFrame behavior on display:none iframes

On 2/15/13 1:56 PM, Boris Zbarsky wrote:
> On 2/15/13 1:51 PM, James Robinson wrote:
>> Sounds like feedback to provide for the PageVisibility specification.
>
> Oh, I did.  It was more or less ignored by the editors under the 
> heading of "keeping things simple", which I suppose is better than 
> things being useful.

Let me be more clear.

The way PageVisibility was done picked a simple-to-specify and simple-to-implement and better than nothing but worse than it could be definition of "hidden".

I didn't have the energy to fight the stop energy on that topic, because it just wasn't that important to me in the end, but I strongly believe that requiring requestAnimationFrame to tick in iframes that do not have a CSS box is wrong, and I object to the spec requiring that behavior. 
That does mean we can't use the "hidden" definition from PageVisibility, but that's what we get for having a poor definition of "hidden" in that specification...

-Boris

Received on Friday, 15 February 2013 23:15:10 UTC