Skip to content

Commit

Permalink
compositing: Only make the compositor responsible for initiating reflow
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pcwalton committed Dec 1, 2016
1 parent 0e338d5 commit f378f28
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions components/compositing/compositor.rs
Expand Up @@ -1191,10 +1191,13 @@ impl<Window: WindowMethods> IOCompositor<Window> {
}
}

// 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);
}
}
}

Expand Down

0 comments on commit f378f28

Please sign in to comment.