mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Handle importance when inserting into the rule tree.
This commit is contained in:
parent
48b5e5ebc4
commit
e9d4110ad4
4 changed files with 141 additions and 143 deletions
|
@ -26,6 +26,7 @@ use selector_parser::{PseudoElement, RestyleDamage, SelectorImpl};
|
|||
use selectors::bloom::BloomFilter;
|
||||
use selectors::matching::{ElementSelectorFlags, StyleRelations};
|
||||
use selectors::matching::AFFECTED_BY_PSEUDO_ELEMENTS;
|
||||
use shared_lock::StylesheetGuards;
|
||||
use sink::ForgetfulSink;
|
||||
use stylearc::Arc;
|
||||
use stylist::ApplicableDeclarationBlock;
|
||||
|
@ -858,11 +859,12 @@ trait PrivateMatchMethods: TElement {
|
|||
}
|
||||
|
||||
fn compute_rule_node<E: TElement>(rule_tree: &RuleTree,
|
||||
applicable_declarations: &mut Vec<ApplicableDeclarationBlock>)
|
||||
applicable_declarations: &mut Vec<ApplicableDeclarationBlock>,
|
||||
guards: &StylesheetGuards)
|
||||
-> StrongRuleNode
|
||||
{
|
||||
let rules = applicable_declarations.drain(..).map(|d| (d.source, d.level));
|
||||
let rule_node = rule_tree.insert_ordered_rules(rules);
|
||||
let rule_node = rule_tree.insert_ordered_rules_with_important(rules, guards);
|
||||
rule_node
|
||||
}
|
||||
|
||||
|
@ -1007,12 +1009,13 @@ pub trait MatchMethods : TElement {
|
|||
smil_override,
|
||||
animation_rules,
|
||||
implemented_pseudo.as_ref(),
|
||||
&context.shared.guards,
|
||||
&mut applicable_declarations,
|
||||
&mut set_selector_flags);
|
||||
|
||||
let primary_rule_node =
|
||||
compute_rule_node::<Self>(&stylist.rule_tree, &mut applicable_declarations);
|
||||
compute_rule_node::<Self>(&stylist.rule_tree,
|
||||
&mut applicable_declarations,
|
||||
&context.shared.guards);
|
||||
|
||||
return data.set_primary_rules(primary_rule_node);
|
||||
}
|
||||
|
@ -1061,13 +1064,14 @@ pub trait MatchMethods : TElement {
|
|||
None,
|
||||
AnimationRules(None, None),
|
||||
Some(&pseudo),
|
||||
&guards,
|
||||
&mut applicable_declarations,
|
||||
&mut set_selector_flags);
|
||||
|
||||
if !applicable_declarations.is_empty() {
|
||||
let new_rules =
|
||||
compute_rule_node::<Self>(rule_tree, &mut applicable_declarations);
|
||||
compute_rule_node::<Self>(rule_tree,
|
||||
&mut applicable_declarations,
|
||||
&guards);
|
||||
if pseudos.has(&pseudo) {
|
||||
rule_nodes_changed = pseudos.set_rules(&pseudo, new_rules);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue