Commit graph

18 commits

Author SHA1 Message Date
Simon Sapin
f70a49974a Make PropertyDeclarationBlock fields private 2017-03-07 23:37:32 +01:00
Bobby Holley
ae87b8a910 Switch from error! and println! to warn!, and set the default log level to warn on debug builds. 2017-02-14 17:19:01 -08:00
Bobby Holley
0e3aeac922 Stop returning rule nodes from match_element and overhaul style calculation logic. 2017-02-10 10:34:28 -08:00
Emilio Cobos Álvarez
2594cb9c33
style: Refactor the traversal so it's more easy to read and straight-forward. 2017-02-02 11:58:36 +01:00
Emilio Cobos Álvarez
8859aa004f
style: Avoid selector-matching when only the style attribute is changed. 2017-02-02 11:58:08 +01:00
Emilio Cobos Álvarez
314f2ce714
style: Define a CascadeLevel enum, and make the rule tree operate on it.
We'll use this level to know where to stop replacing nodes in the tree.
2017-01-30 23:53:53 +01:00
Emilio Cobos Álvarez
9a8c94b998
style: Document a bit better the rule tree code. 2016-12-31 12:16:59 +01:00
Emilio Cobos Álvarez
fc6bed28ff
style: Use a HashSet in free-list check. 2016-12-19 09:47:00 +01:00
Emilio Cobos Álvarez
e67ea42c3f
style: Add simple rule-tree benchmarks. Fix rule node drop race. 2016-12-19 09:46:59 +01:00
Cameron McCormack
d92cc8ecd0 Don't assert when we do a rule tree GC and the root nodes still has strong references.
It could still have children.
2016-11-21 17:04:58 +08:00
Emilio Cobos Álvarez
5c98dffea6
style: Don't assert when the final rule tree GC happens in script. 2016-11-20 14:13:18 +01:00
Cameron McCormack
4e52bb49b9 GC the rule tree only when the free list gets to a certain size. 2016-11-18 17:12:33 +08:00
Emilio Cobos Álvarez
181208a4e4 rule tree: Avoid yet another dumb assertion when dropping the rule tree. 2016-11-18 17:10:09 +08:00
Emilio Cobos Álvarez
65f239c9e1
style: Don't assume siblings are alive in the rule tree when removing ourselves from the child list.
We can't assume all our siblings are alive because they may very well be in the
free list too.

This tempts to happen when the rule nodes are destroyed as part of the last GC,
the one that runs in the root destructor.

Also, properly put the next sibling back into the list when the rules are GCd.
2016-11-10 17:56:54 +01:00
Simon Sapin
1a18161006 rule tree: more descriptive field names 2016-11-05 17:29:56 +01:00
Simon Sapin
2dd2c9cedd Simplify rule_tree::StyleSourceGuardHandle 2016-11-05 17:29:55 +01:00
Simon Sapin
98bd99b74c rule tree: Remove unsound transmute()
RuleTreeDeclarationsIterator would yield &PropertyDeclaration
with the lifetime of the rule tree, but the reference would only
be valid as long as the iterator was holding the corresponding lock.

The lock would be released when the iterator’s `.next()` method
moves to the next rule tree node, or when  the iterator is dropped.

Also change apply_declaration to not require a `Clone` iterator
(since closures unfortunately don’t implement `Clone`).
Instead have it take a callable that returns a fresh iterator.
2016-11-05 17:29:54 +01:00
Emilio Cobos Álvarez
de4fe6e2b6 Concurrent rule tree, v1
This patch introduces infrastructure for the rule tree, and constructs it.

We don't use it yet, nor have good heuristics for GC'ing it, but this should not
happen anymore once we store the rule node reference in the node.

I haven't messed up with memory orders because I want to do a try run with it,
then mess with them.

Take down the ApplicableDeclarationsCache, use the rule tree for doing the cascade.
2016-11-05 17:29:52 +01:00