Commit graph

145 commits

Author SHA1 Message Date
bors-servo
433b7bf9fa Auto merge of #17221 - aethanyc:support-xbl-stylesheet, r=heycam
stylo: Get rules from Gecko XBL stylesheets in cascading (Bug 1290276)

The change was reviewed in https://bugzilla.mozilla.org/show_bug.cgi?id=1290276

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17221)
<!-- Reviewable:end -->
2017-06-08 00:19:27 -07:00
Ting-Yu Lin
2411749fcf stylo: Get rules from Gecko XBL stylesheets in cascading (Bug 1290276) 2017-06-08 11:18:44 +08:00
Xidorn Quan
7568a19688 Merge CSSColor into Color. 2017-06-08 12:59:22 +10:00
Bobby Holley
b3a61b7a1c Use NonZeroPtrMut for {Strong,Weak}RuleNode.
MozReview-Commit-ID: Da4Ds7SIcCD
2017-06-06 21:38:52 -07:00
Emilio Cobos Álvarez
3ebd48039e
style: Allow StyleSource to be compared. 2017-05-29 21:31:04 +02:00
Brian Birtles
4deab0f06a Fix calculation of base styles to drop animation rules
It seems that changeset 97ce9ed5b0
mistakenly changed the check that a cascade level to keep is *not* an
animation level to a check that it *is* an animation level.
2017-05-26 13:53:23 +09:00
J. Ryan Stinnett
a7882cfeb9 Match and cascade visited styles
To support visited styles, we match and cascade a separate set of styles any
time we notice that an element has a relevant link.

The visited rules and values are held in `ComputedStyle` alongside the
regular rules and values, which simplifies supporting various APIs like
`cascade_primary_and_pseudos` which expect easy access to previously matched
rules.

To simplify passing the additional values around, an additional reference to the
visited `ComputedValues` is placed inside the regular `ComputedValues`.

MozReview-Commit-ID: 2ebbjcfkfWf
2017-05-24 18:07:44 -05:00
Manish Goregaokar
a19dd8142e Rollup merge of #17014 - hiikezoe:animation-rules-in-norma-restyle, r=emilio,birtles
Animation rules in norma restyle

<!-- Please describe your changes on the following line: -->

This is a PR for https://bugzilla.mozilla.org/show_bug.cgi?id=1366631 and https://bugzilla.mozilla.org/show_bug.cgi?id=1367225

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes do not require tests because it's for stylo

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17014)
<!-- Reviewable:end -->
2017-05-24 11:59:28 -07:00
Hiroyuki Ikezoe
4935d972e5 Use animation values that have been processed during animation-only restyle for normal restyle. 2017-05-24 11:11:57 +09:00
Hiroyuki Ikezoe
d30c4fe79d Use SMIL override value that has been processed during animation-only restyles for normal restyle.
In the case where we process an element which has SMIL animations in normal travesal
the SMIL styles must have been computed in animation-only restyles. So we
have only to pick the computed styles instead of recomputing it.
2017-05-24 11:11:26 +09:00
Emilio Cobos Álvarez
99e5bb7a48
style: Rewrap some comments to be consistent with the rest of the file. 2017-05-21 03:06:40 +02:00
Emilio Cobos Álvarez
50c022f91a
style: Prefer is_null to comparison with ptr::null_mut. 2017-05-21 03:06:39 +02:00
Emilio Cobos Álvarez
cf6b3a0fcb
style: Simplify the rule tree GC code a bit. 2017-05-21 03:06:37 +02:00
Emilio Cobos Álvarez
e448c4a27e
style: Fix whitespace issue in the rule tree code. 2017-05-21 03:02:53 +02:00
Boris Chiou
60e7a89d57 Add Servo_GetProperties_Overriding_Animation.
We add one FFI, Servo_GetProperties_Overriding_Animation, which calls
StrongRuleNode::get_properties_overriding_animations() to get a LonghandIdSet,
which may override animation properties running on compositor.
2017-05-20 14:29:47 +08:00
Emilio Cobos Álvarez
737c7f1f63
Bug 1364412: Simplify Servo_HasAuthorSpecifiedRules looking at the pseudo style. r=bholley
MozReview-Commit-ID: HpV92ttZGJz
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-05-16 02:49:34 +02:00
Bobby Holley
e9d4110ad4 Handle importance when inserting into the rule tree. 2017-05-11 17:37:17 +02:00
Matt Brubeck
32d37795a2 Bug 1349651 - stylo: Implement HasAuthorSpecifiedRules. 2017-05-09 10:01:46 -07:00
Bobby Holley
d78ca4c4f9 Use StyleArc in the style system.
MozReview-Commit-ID: flF0fv9E9M
2017-05-02 17:35:44 -07:00
Brian Birtles
ba118dfe69 Rename remove_animation_and_transition_rules to just remove_animation_rules
Now this method covers SMIL override rules, CSS animation / script
animation rules, and CSS transition rules so we should just use
"animation" in the generic sense.
2017-04-27 13:20:36 +09:00
Brian Birtles
97ce9ed5b0 Add SMIL override cascade level 2017-04-27 12:35:12 +09:00
Emilio Cobos Álvarez
1d94a68e54
style: Tweak rule tree memory ordering.
I've commented on the ones that I think are the most tricky. Note that this code
is stress-tested in the style tests (tests/unit/style/rule_tree/bench.rs).
2017-04-03 21:47:39 +02:00
Hiroyuki Ikezoe
aa6433b6d6 Add a function that returns new rules by removing transition and animation level rules.
This will be used for additive animations and SMIL.
2017-03-24 10:39:44 +09:00
Hiroyuki Ikezoe
959f1c8360 Add a function that returns new rules by removing transition level rule.
This will be used for after-change-style of CSS Transition.
2017-03-24 09:57:00 +09:00
Simon Sapin
d5074136e3 Rename ReadGuards to StylesheetGuards 2017-03-19 22:30:42 +01:00
Simon Sapin
1bacd0eb15 Move all PropertyDeclarationBlock from RwLock<_> to Locked<_> 2017-03-19 22:30:38 +01:00
Simon Sapin
aeffca2a59 Replace RwLock<StyleRule> with Locked<StyleRule> 2017-03-19 22:30:37 +01:00
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