Bug 1383001: Don't try to do an animation-only restyle if we're styling newly-inserted content. r?heycam
It makes just no sense, and I'd rather not complicate the logic in the traversal
implementations, seems easy to just handle it here.
MozReview-Commit-ID: 3PnT2Jyta8g
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -270,23 +270,29 @@ pub extern "C" fn Servo_TraverseSubtree(
(Root::UnstyledChildrenOnly, Restyle::Normal) |
(Root::UnstyledChildrenOnly, Restyle::ForNewlyBoundElement)
=> UNSTYLED_CHILDREN_ONLY,
(Root::Normal, Restyle::ForCSSRuleChanges) => FOR_CSS_RULE_CHANGES,
(Root::Normal, Restyle::ForReconstruct) => FOR_RECONSTRUCT,
_ => panic!("invalid combination of TraversalRootBehavior and TraversalRestyleBehavior"),
};
- let needs_animation_only_restyle = element.has_animation_only_dirty_descendants() ||
- element.has_animation_restyle_hints();
- if needs_animation_only_restyle {
- traverse_subtree(element,
- raw_data,
- traversal_flags | ANIMATION_ONLY,
- unsafe { &*snapshots });
+ // It makes no sense to do an animation restyle when we're restyling
+ // newly-inserted content.
+ if !traversal_flags.contains(UNSTYLED_CHILDREN_ONLY) {
+ let needs_animation_only_restyle =
+ element.has_animation_only_dirty_descendants() ||
+ element.has_animation_restyle_hints();
+
+ if needs_animation_only_restyle {
+ traverse_subtree(element,
+ raw_data,
+ traversal_flags | ANIMATION_ONLY,
+ unsafe { &*snapshots });
+ }
}
if restyle_behavior == Restyle::ForThrottledAnimationFlush {
return element.has_animation_only_dirty_descendants() ||
element.borrow_data().unwrap().restyle.is_restyle();
}
traverse_subtree(element,