Bug 1367225 - Don't process style attribute changes in animation-only restyle. r?birtles
MozReview-Commit-ID: DcBewFSVBxg
--- a/servo/components/style/matching.rs
+++ b/servo/components/style/matching.rs
@@ -969,32 +969,45 @@ pub trait MatchMethods : TElement {
context: &StyleContext<Self>,
data: &mut ElementData)
-> bool {
use properties::PropertyDeclarationBlock;
use shared_lock::Locked;
let element_styles = &mut data.styles_mut();
let primary_rules = &mut element_styles.primary.rules;
- let mut result = false;
let replace_rule_node = |level: CascadeLevel,
pdb: Option<&Arc<Locked<PropertyDeclarationBlock>>>,
path: &mut StrongRuleNode| -> bool {
let new_node = context.shared.stylist.rule_tree()
.update_rule_at_level(level, pdb, path, &context.shared.guards);
match new_node {
Some(n) => {
*path = n;
level.is_important()
},
None => false,
}
};
+ if !context.shared.traversal_flags.for_animation_only() {
+ let mut result = false;
+ if replacements.contains(RESTYLE_STYLE_ATTRIBUTE) {
+ let style_attribute = self.style_attribute();
+ result |= replace_rule_node(CascadeLevel::StyleAttributeNormal,
+ style_attribute,
+ primary_rules);
+ result |= replace_rule_node(CascadeLevel::StyleAttributeImportant,
+ style_attribute,
+ primary_rules);
+ }
+ return result;
+ }
+
// Animation restyle hints are processed prior to other restyle
// hints in the animation-only traversal.
//
// Non-animation restyle hints will be processed in a subsequent
// normal traversal.
if replacements.intersects(RestyleReplacements::for_animations()) {
debug_assert!(context.shared.traversal_flags.for_animation_only());
@@ -1018,27 +1031,19 @@ pub trait MatchMethods : TElement {
replace_rule_node_for_animation(CascadeLevel::Transitions,
primary_rules);
}
if replacements.contains(RESTYLE_CSS_ANIMATIONS) {
replace_rule_node_for_animation(CascadeLevel::Animations,
primary_rules);
}
- } else if replacements.contains(RESTYLE_STYLE_ATTRIBUTE) {
- let style_attribute = self.style_attribute();
- result |= replace_rule_node(CascadeLevel::StyleAttributeNormal,
- style_attribute,
- primary_rules);
- result |= replace_rule_node(CascadeLevel::StyleAttributeImportant,
- style_attribute,
- primary_rules);
}
- result
+ false
}
/// Attempts to share a style with another node. This method is unsafe
/// because it depends on the `style_sharing_candidate_cache` having only
/// live nodes in it, and we have no way to guarantee that at the type
/// system level yet.
unsafe fn share_style_if_possible(&self,
context: &mut StyleContext<Self>,