Struct style::rule_tree::RuleTree [] [src]

pub struct RuleTree { /* fields omitted */ }

The rule tree, the structure servo uses to preserve the results of selector matching.

This is organized as a tree of rules. When a node matches a set of rules, they're inserted in order in the tree, starting with the less specific one.

When a rule is inserted in the tree, other elements may share the path up to a given rule. If that's the case, we don't duplicate child nodes, but share them.

When the rule node refcount drops to zero, it doesn't get freed. It gets instead put into a free list, and it is potentially GC'd after a while in a single-threaded fashion.

That way, a rule node that represents a likely-to-match-again rule (like a :hover rule) can be reused if we haven't GC'd it yet.

See the discussion at https://github.com/servo/servo/pull/15562 and the IRC logs at http://logs.glob.uno/?c=mozilla%23servo&s=3+Apr+2017&e=3+Apr+2017 logs from http://logs.glob.uno/?c=mozilla%23servo&s=3+Apr+2017&e=3+Apr+2017#c644094 to se a discussion about the different memory orderings used here.

Methods

impl RuleTree
[src]

[src]

Construct a new rule tree.

[src]

Get the root rule node.

[src]

Dump the rule tree to stdout.

[src]

Inserts the given rules, that must be in proper order by specifity, and returns the corresponding rule node representing the last inserted one.

!important rules are detected and inserted into the appropriate position in the rule tree. This allows selector matching to ignore importance, while still maintaining the appropriate cascade order in the rule tree.

[src]

Given a list of applicable declarations, insert the rules and return the corresponding rule node.

[src]

Insert the given rules, that must be in proper order by specifity, and return the corresponding rule node representing the last inserted one.

[src]

This can only be called when no other threads is accessing this tree.

[src]

This can only be called when no other threads is accessing this tree.

[src]

Replaces a rule in a given level (if present) for another rule.

Returns the resulting node that represents the new path, or None if the old path is still valid.

[src]

Returns new rule nodes without Transitions level rule.

[src]

Returns new rule node without rules from declarative animations.

[src]

Returns new rule node by adding animation rules at transition level. The additional rules must be appropriate for the transition level of the cascade, which is the highest level of the cascade. (This is the case for one current caller, the cover rule used for CSS transitions.)

Trait Implementations

impl Debug for RuleTree
[src]

[src]

Formats the value using the given formatter. Read more

impl MallocSizeOf for RuleTree
[src]

[src]

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself. Read more

impl Drop for RuleTree
[src]

[src]

Executes the destructor for this type. Read more

impl Sync for RuleTree
[src]

impl Send for RuleTree
[src]