Re: Beginning of a spec on style batching/flushing?

On Wednesday 2013-12-11 15:27 +1100, Tab Atkins Jr. wrote:
>   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.

This seems to require ordering of the processing of changes, which
in turn forbids coalescing.  Gecko certainly does coalescing, and I
believe such coalescing is necessary for the performance
characteristics required by Web content.  (You then allow that
coalescing with a "may" in the last paragraph below, but it's not
clear how many of the requirements above that paragraph overrides.
It seems better not to present the ordering requirement at all if
it's not actually something we'd expect any implementation to do.)

>   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.

Rather than defining things in an absolutely precise order in terms
of a queue, and then saying that user agents may do "reasonable"
batching, I think it's better to describe a model that only has the
necessary ordering constraints.

I'd also note that http://dev.w3.org/csswg/css-transitions/#starting
defines some terminology related to batching of style changes.

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                          https://www.mozilla.org/   𝄂
             Before I built a wall I'd ask to know
             What I was walling in or walling out,
             And to whom I was like to give offense.
               - Robert Frost, Mending Wall (1914)

Received on Wednesday, 11 December 2013 06:01:33 UTC