Beginning of a spec on style batching/flushing?

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