Bug 1447870 - Don't flush throttled animations in nsIDOMWindowUtils.updateLayerTree. r?mattwoodrow
updateLayerTree() is called from the callback of MozAfterPaint in
reftest-content.js all the time except when we specify reftest-no-sync-layers
or reftest-no-flush. If there is a throttled animation,
FlushPendingNotifications flushes the animation, thus it will fire another
MozAfterPaint event. It means we will end up waiting for the throttled
animation to finish. This reiteration MozAfterPaint events can be easily
observed in WebRender since WebRender fires MozAfterPaint event without
checking invalidation change. Whereas current Gecko fires MozAfterPaint only
if invalidation change happens and reftests for such throttled animations
specify the same value for 'from' and 'to' value, so it hasn't been a problem
there.
The FlushPendingNotifications in updateLayerTree() was introduced in
bug
1083635 <https://hg.mozilla.org/mozilla-central/rev/5bebfbefb3c2> to
sync-decode images so it shouldn't matter if there are still throttled
animations.
MozReview-Commit-ID: B9KgNCX0kWq
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -377,17 +377,21 @@ nsDOMWindowUtils::Redraw(uint32_t aCount
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsDOMWindowUtils::UpdateLayerTree()
{
if (nsIPresShell* presShell = GetPresShell()) {
- presShell->FlushPendingNotifications(FlushType::Display);
+ // Don't flush throttled animations since it might fire MozAfterPaint event
+ // (in WebRender it constantly does), thus the reftest harness can't take
+ // any snapshot until the throttled animations finished.
+ presShell->FlushPendingNotifications(
+ ChangesToFlush(FlushType::Display, false /* flush animations */));
RefPtr<nsViewManager> vm = presShell->GetViewManager();
nsView* view = vm->GetRootView();
if (view) {
presShell->Paint(view, view->GetBounds(),
nsIPresShell::PAINT_LAYERS | nsIPresShell::PAINT_SYNC_DECODE_IMAGES);
presShell->GetLayerManager()->WaitOnTransactionProcessed();
}
}