mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
fix(script): update animation timeline before processing pending events
This commit reverses the order of the `send_pending_events` and `update_animation_timeline` calls in `ScriptThread::update_animations_ send_events` so that animation-related events pended by the latter are processed by the former. The new calling order is more compliant with the "update animations and send events" algorithm steps from [the Web Animations specification][1]. The old implementation was prone to blocking for an indefinite period while holding pending events. Due to complex interaction with other events and timing behavior, I was only able to reproduce the problem under the following conditions: - *The `maybe_observe_paint_time` call in `LayoutThread::compute_abs_ pos_and_build_display_list` is removed from the code*. While performance events may seem irrelevant to the issue, they would bombard the script thread with events. *Any* extra messages received would unblock the event loop and prevent the manifestation of the issue. (But, of course, we aren't supposed to count on that to avoid the issue.) - Servo is running in a headless mode, which somehow makes it less likely for the script thread to receive a `TickAllAnimations` event after sending `AnimationState::NoAnimationsPresent`. With the above conditions met and the stars aligned, you can reproduce the problem by running the WPT test `/css/css-transitions/events-001. html`. [1]: https://drafts.csswg.org/web-animations-1/#update-animations-and-send-events
This commit is contained in:
parent
aa2e1433d2
commit
af1b0b0f14
1 changed files with 2 additions and 2 deletions
|
@ -1705,11 +1705,11 @@ impl ScriptThread {
|
|||
// Perform step 11.10 from https://html.spec.whatwg.org/multipage/#event-loops.
|
||||
fn update_animations_and_send_events(&self) {
|
||||
for (_, document) in self.documents.borrow().iter() {
|
||||
document.animations().send_pending_events();
|
||||
document.update_animation_timeline();
|
||||
}
|
||||
|
||||
for (_, document) in self.documents.borrow().iter() {
|
||||
document.update_animation_timeline();
|
||||
document.animations().send_pending_events();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue