mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
style: Do not re-expire animations.
If we're restyling a page with animations and layout takes too long, we might still have the expired animations from the last restyle, without these being cleared out by layout on `tick_animations`. Unfortunately it's hard (near to impossible?) to make a reduced test case for this, since it heavily depends on the speed of the build and conditions that only happen under heavy loads. Mainly, it depends on how accurately the `TickAllAnimations` message is sent from the constellation. Thus, we can't just re-expire an animation, and we should re-check for it as a previous animation. Fixes #12171
This commit is contained in:
parent
194fb3e199
commit
62345ae14d
2 changed files with 18 additions and 5 deletions
|
@ -498,9 +498,22 @@ trait PrivateMatchMethods: TNode
|
|||
if had_running_animations {
|
||||
let mut all_running_animations = context.running_animations.write().unwrap();
|
||||
for mut running_animation in all_running_animations.get_mut(&this_opaque).unwrap() {
|
||||
animation::update_style_for_animation::<Self::ConcreteRestyleDamage,
|
||||
<Self::ConcreteElement as Element>::Impl>(context, running_animation, style, None);
|
||||
running_animation.mark_as_expired();
|
||||
// This shouldn't happen frequently, but under some
|
||||
// circumstances mainly huge load or debug builds, the
|
||||
// constellation might be delayed in sending the
|
||||
// `TickAllAnimations` message to layout.
|
||||
//
|
||||
// Thus, we can't assume all the animations have been already
|
||||
// updated by layout, because other restyle due to script might
|
||||
// be triggered by layout before the animation tick.
|
||||
//
|
||||
// See #12171 and the associated PR for an example where this
|
||||
// happened while debugging other release panic.
|
||||
if !running_animation.is_expired() {
|
||||
animation::update_style_for_animation::<Self::ConcreteRestyleDamage,
|
||||
<Self::ConcreteElement as Element>::Impl>(context, running_animation, style, None);
|
||||
running_animation.mark_as_expired();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue