зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #17951 - Make replace_rules_internal return true only if important rules changed (from hiikezoe:import-rule-check); r=emilio
<!-- Please describe your changes on the following line: --> https://bugzilla.mozilla.org/show_bug.cgi?id=1367975 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors Source-Repo: https://github.com/servo/servo Source-Revision: 45cba6a650d9cd75d0321dff00893b70f5ed3d75 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : ed95b409b99690fcd485c1569286a0f6e7fd953b
This commit is contained in:
Родитель
2b42c50319
Коммит
b5e831e121
|
@ -744,15 +744,17 @@ pub trait MatchMethods : TElement {
|
|||
let replace_rule_node = |level: CascadeLevel,
|
||||
pdb: Option<ArcBorrow<Locked<PropertyDeclarationBlock>>>,
|
||||
path: &mut StrongRuleNode| -> bool {
|
||||
let mut important_rules_changed = false;
|
||||
let new_node = stylist.rule_tree()
|
||||
.update_rule_at_level(level, pdb, path, guards);
|
||||
match new_node {
|
||||
Some(n) => {
|
||||
*path = n;
|
||||
level.is_important()
|
||||
},
|
||||
None => false,
|
||||
.update_rule_at_level(level,
|
||||
pdb,
|
||||
path,
|
||||
guards,
|
||||
&mut important_rules_changed);
|
||||
if let Some(n) = new_node {
|
||||
*path = n;
|
||||
}
|
||||
important_rules_changed
|
||||
};
|
||||
|
||||
if !context.shared.traversal_flags.for_animation_only() {
|
||||
|
|
|
@ -310,12 +310,14 @@ impl RuleTree {
|
|||
level: CascadeLevel,
|
||||
pdb: Option<ArcBorrow<Locked<PropertyDeclarationBlock>>>,
|
||||
path: &StrongRuleNode,
|
||||
guards: &StylesheetGuards)
|
||||
guards: &StylesheetGuards,
|
||||
important_rules_changed: &mut bool)
|
||||
-> Option<StrongRuleNode> {
|
||||
debug_assert!(level.is_unique_per_element());
|
||||
// TODO(emilio): Being smarter with lifetimes we could avoid a bit of
|
||||
// the refcount churn.
|
||||
let mut current = path.clone();
|
||||
*important_rules_changed = false;
|
||||
|
||||
// First walk up until the first less-or-equally specific rule.
|
||||
let mut children = SmallVec::<[_; 10]>::new();
|
||||
|
@ -335,6 +337,8 @@ impl RuleTree {
|
|||
// special cases, and replacing them for a `while` loop, avoiding the
|
||||
// optimizations).
|
||||
if current.get().level == level {
|
||||
*important_rules_changed |= level.is_important();
|
||||
|
||||
if let Some(pdb) = pdb {
|
||||
// If the only rule at the level we're replacing is exactly the
|
||||
// same as `pdb`, we're done, and `path` is still valid.
|
||||
|
|
Загрузка…
Ссылка в новой задаче