mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Trigger restyle if important rules are changed.
If we add/remove important rules, we may need to update a list of all important rules (in Gecko) which overrides animation properties. Therefore, we need to set a flag if we update the primary rules which includes important ones. If we have animations on this element, we update its effect properties, and also send a task to update cascade results. Calling get_properties_overriding_animations() might cases some impact on performance because we need to walk the rule tree, so if possible, we could just store this set into TNode to avoid finding the properties for both old and new rules each time. This could be a future work if necessary.
This commit is contained in:
parent
60e7a89d57
commit
63dc43648e
5 changed files with 111 additions and 28 deletions
|
@ -747,12 +747,12 @@ fn compute_style<E, D>(_traversal: &D,
|
|||
element.match_and_cascade(context, &mut data, StyleSharingBehavior::Allow);
|
||||
}
|
||||
CascadeWithReplacements(hint) => {
|
||||
let _rule_nodes_changed =
|
||||
element.replace_rules(hint, context, &mut data);
|
||||
element.cascade_primary_and_pseudos(context, &mut data);
|
||||
let rules_changed = element.replace_rules(hint, context, &mut data);
|
||||
element.cascade_primary_and_pseudos(context, &mut data,
|
||||
rules_changed.important_rules_changed());
|
||||
}
|
||||
CascadeOnly => {
|
||||
element.cascade_primary_and_pseudos(context, &mut data);
|
||||
element.cascade_primary_and_pseudos(context, &mut data, false);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue