From 805988e839217ccea19e9bdec86462cd8739bf14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 5 Aug 2016 13:38:58 -0700 Subject: [PATCH] compositor: Send animation ticks to layout even if there are script animation frames. The script tick ends up only processing JS callbacks related to animation frames, so CSS transitions/animations end up not working as expected. This could have accidentally worked before #12563 because we over-restyled, but now this is no longer the case. Other possible way to do it is making a layout reflow with RAF handle CSS animations/transitions too, but that may not work if the reflow ends up being suppressed (that could very well be the case), and we'd need to handle a lot more state in the document, so this solution (assuming it doesn't break try) seems a bit less flacky. Fixes #12749. --- components/compositing/compositor.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 60b64a03047..653fb219447 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -1786,12 +1786,15 @@ impl IOCompositor { fn tick_animations_for_pipeline(&mut self, pipeline_id: PipelineId) { self.schedule_delayed_composite_if_necessary(); let animation_callbacks_running = self.pipeline_details(pipeline_id).animation_callbacks_running; - let animation_type = if animation_callbacks_running { - AnimationTickType::Script - } else { - AnimationTickType::Layout - }; - let msg = ConstellationMsg::TickAnimation(pipeline_id, animation_type); + if animation_callbacks_running { + let msg = ConstellationMsg::TickAnimation(pipeline_id, AnimationTickType::Script); + if let Err(e) = self.constellation_chan.send(msg) { + warn!("Sending tick to constellation failed ({}).", e); + } + } + + // We still need to tick layout unfortunately, see things like #12749. + let msg = ConstellationMsg::TickAnimation(pipeline_id, AnimationTickType::Layout); if let Err(e) = self.constellation_chan.send(msg) { warn!("Sending tick to constellation failed ({}).", e); }