W3C home > Mailing lists > Public > www-style@w3.org > June 2013

Re: [css-display]? Compositing, expensive things, and laziness

From: François REMY <francois.remy.dev@outlook.com>
Date: Fri, 21 Jun 2013 19:38:43 +0200
Message-ID: <DUB120-DS205683C0D18E7F21A67E18A58F0@phx.gbl>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: "Ali Juma" <ajuma@chromium.org>, "Robert O'Callahan" <robert@ocallahan.org>, "www-style list" <www-style@w3.org>
> Note that Ali is an implementor for Blink, and the proposal doesn't
> interrupt the renderer at any point - the event just informs script
> when the element has been rendered.

Yes, I misunderstood the fact the event was asynchronous, not synchronous. 
But still, I'm wondering whether an event is the right way to deal with 

This is just a random thought, but would 
"HTMLElement:requestAnimationFrame(callback)" do the trick? The callback 
would be called roughly at the same time as window.requestAnimationFrame, 
but only whenever the element is ready for his next paint. That way, you can 
know how much time it takes to render that element (ie: the specific frame 
rate of the 'lazy' element). In the case of non-lazy elements, calls would 
be synced with the nearest lazy element, or the window. The advantage of 
this solution is that it's easy to polyfill:

    // this browser does not support lazy elements
    HTMLElement.prototype.requestAnimationFrame = 
    HTMLElement.prototype.cancelAnimationFrame = 

A positive point of this this solution would be that it enables further 
optimizations like not firing the element's rAF when the element is 
offscreen. A negative point is that it's less useful to provide an 
alternative content (but the alternative content of a lazy element could be 
defined as the last frame ever being rendered, or an empty bitmap if it 
never was). 
Received on Friday, 21 June 2013 17:39:14 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:31 UTC