style: Fix cascade order of !important in Shadow DOM.

No cleaner ideas right now that carrying that counter around... Maybe a custom
type may be cleaner?

This makes ApplicableDeclarationBlock a bit bigger. I could probably try to make
the counter a 4 / 5-bit number or something and pack the counter there in the
SourceOrderAndCascadeLevel somehow...

But doesn't seem really worth the churn, and can be done as a followup in any
case. Let me know if you want to block on that.

Bug: 1454162
Reviewed-by: heycam
MozReview-Commit-ID: 1LdW9S4xA6f
This commit is contained in:
Emilio Cobos Álvarez 2018-04-18 09:56:33 +02:00
parent 78f9672b6c
commit 84d6c13871
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
6 changed files with 133 additions and 44 deletions

View file

@ -14,7 +14,7 @@ use hash::{HashMap, HashSet};
use hash::map as hash_map;
use hashglobe::FailedAllocationError;
use precomputed_hash::PrecomputedHash;
use rule_tree::CascadeLevel;
use rule_tree::{CascadeLevel, ShadowCascadeOrder};
use selector_parser::SelectorImpl;
use selectors::matching::{matches_selector, ElementSelectorFlags, MatchingContext};
use selectors::parser::{Combinator, Component, SelectorIter};
@ -163,6 +163,7 @@ impl SelectorMap<Rule> {
context: &mut MatchingContext<E::Impl>,
flags_setter: &mut F,
cascade_level: CascadeLevel,
shadow_cascade_order: ShadowCascadeOrder,
) where
E: TElement,
F: FnMut(&E, ElementSelectorFlags),
@ -185,6 +186,7 @@ impl SelectorMap<Rule> {
context,
flags_setter,
cascade_level,
shadow_cascade_order,
)
}
}
@ -198,6 +200,7 @@ impl SelectorMap<Rule> {
context,
flags_setter,
cascade_level,
shadow_cascade_order,
)
}
});
@ -210,6 +213,7 @@ impl SelectorMap<Rule> {
context,
flags_setter,
cascade_level,
shadow_cascade_order,
)
}
@ -220,6 +224,7 @@ impl SelectorMap<Rule> {
context,
flags_setter,
cascade_level,
shadow_cascade_order,
);
// Sort only the rules we just added.
@ -235,6 +240,7 @@ impl SelectorMap<Rule> {
context: &mut MatchingContext<E::Impl>,
flags_setter: &mut F,
cascade_level: CascadeLevel,
shadow_cascade_order: ShadowCascadeOrder,
) where
E: TElement,
F: FnMut(&E, ElementSelectorFlags),
@ -248,7 +254,7 @@ impl SelectorMap<Rule> {
context,
flags_setter,
) {
matching_rules.push(rule.to_applicable_declaration_block(cascade_level));
matching_rules.push(rule.to_applicable_declaration_block(cascade_level, shadow_cascade_order));
}
}
}