mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Break needs_animations_update into pieces.
To hopefully make some sense out of it.
This commit is contained in:
parent
e30a4d2ad2
commit
f2a808ad58
1 changed files with 35 additions and 18 deletions
|
@ -238,26 +238,43 @@ trait PrivateMatchMethods: TElement {
|
||||||
None => return has_new_animation_style,
|
None => return has_new_animation_style,
|
||||||
};
|
};
|
||||||
|
|
||||||
let has_animations = self.has_css_animations();
|
|
||||||
let old_box_style = old.get_box();
|
let old_box_style = old.get_box();
|
||||||
let old_display_style = old_box_style.clone_display();
|
|
||||||
let new_display_style = new_box_style.clone_display();
|
|
||||||
|
|
||||||
// If the traverse is triggered by CSS rule changes, we need to
|
let keyframes_could_have_changed =
|
||||||
// try to update all CSS animations on the element if the element
|
context.shared.traversal_flags.contains(TraversalFlags::ForCSSRuleChanges);
|
||||||
// has or will have CSS animation style regardless of whether the
|
|
||||||
// animation is running or not.
|
// If the traversal is triggered due to changes in CSS rules changes, we
|
||||||
// TODO: We should check which @keyframes changed/added/deleted
|
// need to try to update all CSS animations on the element if the
|
||||||
// and update only animations corresponding to those @keyframes.
|
// element has or will have CSS animation style regardless of whether
|
||||||
(context.shared.traversal_flags.contains(TraversalFlags::ForCSSRuleChanges) &&
|
// the animation is running or not.
|
||||||
(has_new_animation_style || has_animations)) ||
|
//
|
||||||
!old_box_style.animations_equals(new_box_style) ||
|
// TODO: We should check which @keyframes were added/changed/deleted and
|
||||||
(old_display_style == Display::None &&
|
// update only animations corresponding to those @keyframes.
|
||||||
new_display_style != Display::None &&
|
if keyframes_could_have_changed &&
|
||||||
has_new_animation_style) ||
|
(has_new_animation_style || self.has_css_animations())
|
||||||
(old_display_style != Display::None &&
|
{
|
||||||
new_display_style == Display::None &&
|
return true;
|
||||||
has_animations)
|
}
|
||||||
|
|
||||||
|
// If the animations changed, well...
|
||||||
|
if !old_box_style.animations_equals(new_box_style) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
let old_display = old_box_style.clone_display();
|
||||||
|
let new_display = new_box_style.clone_display();
|
||||||
|
|
||||||
|
// If we were display: none, we may need to trigger animations.
|
||||||
|
if old_display == Display::None && new_display != Display::None {
|
||||||
|
return has_new_animation_style;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we are becoming display: none, we may need to stop animations.
|
||||||
|
if old_display != Display::None && new_display == Display::None {
|
||||||
|
return self.has_css_animations();
|
||||||
|
}
|
||||||
|
|
||||||
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a SequentialTask for resolving descendants in a SMIL display property
|
/// Create a SequentialTask for resolving descendants in a SMIL display property
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue