diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-05-24 19:53:48 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-24 19:53:48 -0500 |
commit | 1f323f8848e47b01779de5145dd21d0f74ed16ca (patch) | |
tree | e6255957ec4d4055f033d7f039cf1c6adc3563ad /components/style/rule_tree/mod.rs | |
parent | e457d22f81ac0f45c4dc96867162f276de7bd291 (diff) | |
parent | f12af6c8d606f63fbba32e1dc3580f38604da24a (diff) | |
download | servo-1f323f8848e47b01779de5145dd21d0f74ed16ca.tar.gz servo-1f323f8848e47b01779de5145dd21d0f74ed16ca.zip |
Auto merge of #17032 - jryans:stylo-visited, r=emilio
Stylo: visited pseudo-class support
Reviewed in https://bugzilla.mozilla.org/show_bug.cgi?id=1328509
<!-- 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/17032)
<!-- Reviewable:end -->
Diffstat (limited to 'components/style/rule_tree/mod.rs')
-rw-r--r-- | components/style/rule_tree/mod.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/components/style/rule_tree/mod.rs b/components/style/rule_tree/mod.rs index 866eb9adab9..bb13836c2a6 100644 --- a/components/style/rule_tree/mod.rs +++ b/components/style/rule_tree/mod.rs @@ -16,6 +16,7 @@ use std::ptr; use std::sync::atomic::{AtomicPtr, AtomicUsize, Ordering}; use stylearc::Arc; use stylesheets::StyleRule; +use stylist::ApplicableDeclarationList; use thread_state; /// The rule tree, the structure servo uses to preserve the results of selector @@ -215,6 +216,18 @@ impl RuleTree { current } + /// Given a list of applicable declarations, insert the rules and return the + /// corresponding rule node. + pub fn compute_rule_node(&self, + applicable_declarations: &mut ApplicableDeclarationList, + guards: &StylesheetGuards) + -> StrongRuleNode + { + let rules = applicable_declarations.drain().map(|d| (d.source, d.level)); + let rule_node = self.insert_ordered_rules_with_important(rules, guards); + rule_node + } + /// Insert the given rules, that must be in proper order by specifity, and /// return the corresponding rule node representing the last inserted one. pub fn insert_ordered_rules<'a, I>(&self, iter: I) -> StrongRuleNode @@ -632,6 +645,8 @@ struct WeakRuleNode { /// A strong reference to a rule node. #[derive(Debug, PartialEq)] pub struct StrongRuleNode { + // TODO: Mark this as NonZero once stable to save space inside Option. + // https://github.com/rust-lang/rust/issues/27730 ptr: *mut RuleNode, } |