Hi everybody,

I'm looking at this section of the Style System Documentation:

https://developer.mozilla.org/en/Mozilla_Style_System_Documentation#Style_contexts_and_the_rule_tree

I realise this is a fairly old document (2003) and if you know a newer
version please let me know.

I wonder if the tree is the "happiest" metaphor for the structure of
the rule tree or if maybe its type should be further qualified/
clarified. When I think to a tree I think to a graph in which each
node has only one parent but may have many children. However, when I
think to a possible rule tree I can only think to a more generalized
directed graph, were a child -may- share more than one parent. In fact
it seems to me that the rule tree is dependent on the structure of the
document and this kind of messes up my brain because it seems to
suggest that every time the document structure changes the rule tree
must be refreshed too. Take these four rules:

1) div {background-color:red}
2) div.blue {color:blue}
3) div.pink {color:pink}
4) div#mark {border:1px solid orange}

To me, the rule tree of these four rules can take all sorts of
different shapes depending on the specifics of the document. Take the
following examples as isolated, in separate documents:

This uses rules 4 and then 1, the rule tree is a simple graph with one
segment:
<div id="mark" />

Uses rules 4, 3 and finally 1, the rule tree is a simple graph with
two consecutive segments:
<div id="mark" class="pink" />

My understanding is that in this case the rule tree is effectively a
diamond, with rule 1 at the top, rule 4 at the bottom and rule 2 and 3
being children of 1 and parents of 4:

<div>
    <div id="mark" class="pink" />
    <div id="mark" class="blue" />
</div>

Am I correct? Does the rule tree change shape depending on the
structure of the document? Is it true that children rules may
potentially share parent rules? I'm trying to understand how the rule
tree is generated but all I can imagine is, rather than a tree, a
braid of rules, each strand starting with a document's element, each
strand ending at the "null" rule and each strand made of a list of
rules, some of which may or may not be shared by other strands.

Manu
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout

Reply via email to