RE: Canvas Visibility API

We have talked about Element Visibility a few times now. Sounds like we should start specing it out. Let's discuss on the call tomorrow.

From: Arvind Jain [mailto:arvind@google.com]
Sent: Tuesday, August 13, 2013 11:49 AM
To: Yury Delendik
Cc: public-web-perf
Subject: Re: Canvas Visibility API

Thanks for bringing this up. I've also seen other requests e.g. this one for iframe:
https://www.w3.org/Bugs/Public/show_bug.cgi?id=22931

We'll discuss this in our next call.

Arvind

On Tue, Aug 13, 2013 at 8:39 AM, Yury Delendik <ydelendik@mozilla.com<mailto:ydelendik@mozilla.com>> wrote:
Hello,

We have the following use case. The animation is performed at the specific frame rate and requires some computations be executed each frame. The frame painting is performed at requestAnimationFrame on the canvas and might take some time to do it, and it will be useful to not perform any painting at all to avoid unnecessary operations.

Is there an interest to add an API similar to Page Visibility [1] to the DOM elements (at least for canvas elements)? Basically to allow scripts to query visibility state of the particular DOM element and receive event notifications when the element is about to be visible/hidden (or even, if possible, "near-the-view"). Also, in the past I met multiple cases where event notifications about elements visibility could help illuminate bulky JavaScript solutions using resize/scroll event handlers that use offsetLeft/getBoundingClientRect/scrollX-style checks (e.g. pdf.js [2] or floating headers).

This proposal is somewhat similar to "support an element parameter to requestAnimationFrame()" issue [3]. However this solution doesn't let us to detect if the element is about to be hidden.

Thank you,
Yury Delendik

  [1] https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.html
  [2] http://mozilla.github.io/pdf.js/web/viewer.html
  [3] http://www.w3.org/2010/webperf/track/issues/4
  [4] https://bugzilla.mozilla.org/show_bug.cgi?id=903575

Received on Tuesday, 20 August 2013 23:11:15 UTC