W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2009

[whatwg] defer on style, depends

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Sun, 15 Feb 2009 16:21:57 -0500
Message-ID: <49988775.4000909@mit.edu>
Garrett Smith wrote:
> I can see why rule matching would happen for all nodes in the document.
> 
> On what occasion(s) do(es) that algorithm run?

Depends on the UA, probably.

For Gecko in particular, any time a stylesheet is added to or removed 
from the document, any time a rule is added to or removed from a 
stylesheet via the CSSOM, and any time a rule is changed via the CSSOM. 
  The one exception is inline style; changing that only performs style 
recomputation (which includes selector matching) on the subtree rooted 
at the node whose inline style has changed.

In general, the whole setup in Gecko is optimized around changes to 
nodes being common and changes to stylesheets being rare.

So far this is a good working assumption; if that ever changes we'll 
look into optimizing changes to stylesheets more.

> Could such a strategy for rule-matching help performance, or would it
> hinder performance or be too much work to maintain?

To a first approximation it'd have no effect on performance.

>> Too complicated for whom?  The author or the implementation?
> 
> For the implementation, I do not actually know because I have not
> worked on that code. What are your thoughts?

I haven't thought about this enough to have any useful ones yet.

-Boris
Received on Sunday, 15 February 2009 13:21:57 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:47 UTC