From f378f2807e7854ca684a1b959f42426362cbbca0 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 29 Nov 2016 17:45:01 -0800 Subject: [PATCH] compositing: Only make the compositor responsible for initiating reflow for CSS transitions and animations, not `requestAnimationFrame()` callbacks. In the case of the latter, the script thread will kick off the reflow if it's necessary, so there's no need for the compositor to do it. Some pages, like nytimes.com, like to call `requestAnimationFrame()` without actually mutating the DOM in the callback. We should avoid reflowing in this case. --- components/compositing/compositor.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 29f51edc0d80..8f0c12e5bf7e 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -1191,10 +1191,13 @@ impl IOCompositor { } } - // 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); + // We may need to tick animations in layout. (See #12749.) + let animations_running = self.pipeline_details(pipeline_id).animations_running; + if animations_running { + let msg = ConstellationMsg::TickAnimation(pipeline_id, AnimationTickType::Layout); + if let Err(e) = self.constellation_chan.send(msg) { + warn!("Sending tick to constellation failed ({}).", e); + } } }