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

Beginning of a spec on style batching/flushing?

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 11 Dec 2013 15:27:50 +1100
Message-ID: <CAAWBYDDnU9o3q4qSj=OpZnQn+w4WUvPia2=jCxTvMgzD4VbE0A@mail.gmail.com>
To: www-style list <www-style@w3.org>
I'm helping write a spec on Layout Transitions that I'll present
soonish, and I needed to formalize the concept of batched styles and
whatnot to ensure that we can precisely talk about when certain
operations occur.  (Pretending they're synchronous isn't a good thing,
and we don't want to force style flushing more than necessary.)

Here's a first draft of my attempt at formalizing the idea of batching
style updates, and having operations depend on accurate style
information.  Could I get some review?



  Each element in a document is associated with a <dfn export>style
updates queue</dfn>,
  containing <a>style updates</a> and <a>style-dependent actions</a>.
  A <dfn>style update</dfn> is a pending currently-unapplied change
made to the style of an element on the page
  which might have an effect on the style, layout, or rendering of the element.
  A <dfn>style-dependent action</dfn> is an operation which relies on
the element's style, layout, and/or rendering
  being fully up-to-date.

  Whenever a change is made to the page's style that may affect an element,
  a <a>style update</a> must be pushed onto the element's <a>style
updates queue</a>.
  The element's style, layout, and/or rendering must not be updated
  unless a corresponding <a>style update</a> is at the front of the
<a>style updates queue</a>.
  When a <a>style update</a> is applied,
  it must be popped from the queue.

  Similarly, <a>style-dependent actions</a> must not be executed
  unless they are at the front of the <a>style updates queue</a>.
  When they are executed,
  they must be popped from the queue.

  User agents may delay applying <a>style updates</a> as long as they
consider reasonable
  so as to batch any work caused by updating styles, layout, and rendering.
  User agents should prioritize applying <a>style updates</a>
  that precede a <a>style-dependent action</a>
  when a <a>style-dependent action</a> is in the queue.



~TJ
Received on Wednesday, 11 December 2013 04:28:37 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:17 UTC