diff --git a/Cargo.lock b/Cargo.lock index 0dab4a44412..ddfe3f76f4a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5096,7 +5096,8 @@ checksum = "a871f1e45a3a3f0c73fb60343c811238bb5143a81642e27c2ac7aac27ff01a63" [[package]] name = "raqote" version = "0.8.2" -source = "git+https://github.com/jrmuizel/raqote#7b235e9a7721d5db6dbfd82ec69e390111653081" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5b6cb89f8be6a645e5834f3ad44a7960d12343d97b5b7fb07cb0365ae36aa2d" dependencies = [ "euclid", "font-kit", diff --git a/components/canvas/Cargo.toml b/components/canvas/Cargo.toml index 96872adeda8..114dbde8810 100644 --- a/components/canvas/Cargo.toml +++ b/components/canvas/Cargo.toml @@ -33,7 +33,7 @@ lyon_geom = "1.0.4" num-traits = "0.2" pathfinder_geometry = "0.5" pixels = { path = "../pixels" } -raqote = { git = "https://github.com/jrmuizel/raqote" } +raqote = "0.8.2" servo_arc = { path = "../servo_arc" } servo_config = { path = "../config" } sparkle = "0.1.25" diff --git a/components/script/animations.rs b/components/script/animations.rs index cd581ed3cb3..73131763430 100644 --- a/components/script/animations.rs +++ b/components/script/animations.rs @@ -40,7 +40,7 @@ pub(crate) struct Animations { pub sets: DocumentAnimationSet, /// Whether or not we have animations that are running. - have_running_animations: Cell, + has_running_animations: Cell, /// A list of nodes with in-progress CSS transitions or pending events. rooted_nodes: DomRefCell>>, @@ -53,7 +53,7 @@ impl Animations { pub(crate) fn new() -> Self { Animations { sets: Default::default(), - have_running_animations: Cell::new(false), + has_running_animations: Cell::new(false), rooted_nodes: Default::default(), pending_events: Default::default(), } @@ -97,6 +97,7 @@ impl Animations { } self.unroot_unused_nodes(&sets); + //self.update_running_animations_presence(window); } /// Cancel animations for the given node, if any exist. @@ -142,17 +143,25 @@ impl Animations { } fn update_running_animations_presence(&self, window: &Window, new_value: bool) { - let have_running_animations = self.have_running_animations.get(); - if new_value == have_running_animations { + let had_running_animations = self.has_running_animations.get(); + if new_value == had_running_animations { return; } - self.have_running_animations.set(new_value); - let state = match new_value { + self.has_running_animations.set(new_value); + self.handle_animation_presence_or_pending_events_change(window); + } + + fn handle_animation_presence_or_pending_events_change(&self, window: &Window) { + let has_running_animations = self.has_running_animations.get(); + let has_pending_events = !self.pending_events.borrow().is_empty(); + + // Do not send the NoAnimationCallbacksPresent state until all pending + // animation events are delivered. + let state = match has_running_animations || has_pending_events { true => AnimationsPresentState::AnimationsPresent, false => AnimationsPresentState::NoAnimationsPresent, }; - window.send_to_constellation(ScriptMsg::ChangeRunningAnimationsState(state)); } @@ -425,10 +434,13 @@ impl Animations { }); } - pub(crate) fn send_pending_events(&self) { + pub(crate) fn send_pending_events(&self, window: &Window) { // Take all of the events here, in case sending one of these events // triggers adding new events by forcing a layout. let events = std::mem::replace(&mut *self.pending_events.borrow_mut(), Vec::new()); + if events.is_empty() { + return; + } for event in events.into_iter() { // We root the node here to ensure that sending this event doesn't @@ -488,6 +500,10 @@ impl Animations { .fire(node.upcast()); } } + + if self.pending_events.borrow().is_empty() { + self.handle_animation_presence_or_pending_events_change(window); + } } } diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 506cd5d6bf2..b417f453cdf 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -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(document.window()); } } diff --git a/python/servo/gstreamer.py b/python/servo/gstreamer.py index 612697ffef6..5eb491c98e5 100644 --- a/python/servo/gstreamer.py +++ b/python/servo/gstreamer.py @@ -65,10 +65,9 @@ GSTREAMER_PLUGINS = [ ("gstrtpmanager", "gst-plugins-good"), ("gsttheora", "gst-plugins-base"), ("gsttypefindfunctions", "gst-plugins-base"), - ("gstvideoconvert", "gst-plugins-base"), + ("gstvideoconvertscale", "gst-plugins-base"), ("gstvideofilter", "gst-plugins-good"), ("gstvideoparsersbad", "gst-plugins-bad"), - ("gstvideoscale", "gst-plugins-base"), ("gstvorbis", "gst-plugins-base"), ("gstvolume", "gst-plugins-base"), ("gstvpx", "gst-plugins-good"), diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index cbb7a753297..8eb3d7dd00f 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -12980,6 +12980,13 @@ ] ] }, + "css-transition-cancel-event.html": [ + "23400c556d58bb21b78a9cbed3b56028c7d299c3", + [ + null, + {} + ] + ], "empty-keyframes.html": [ "9f8935fb7f51219bb3ee07335e208a63c9edde81", [ diff --git a/tests/wpt/mozilla/tests/css/css-transition-cancel-event.html b/tests/wpt/mozilla/tests/css/css-transition-cancel-event.html new file mode 100644 index 00000000000..23400c556d5 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/css-transition-cancel-event.html @@ -0,0 +1,68 @@ + + + + + + + + + + + + + +