Bug 1192910 - Ensure we flush paints on the main thread during an APZ flush. r=mstange. reland because backout didn't fix the issue

MozReview-Commit-ID: 61dyeqxxtVP
This commit is contained in:
Kartikaya Gupta 2016-03-07 16:27:44 -05:00
parent cf4896ee92
commit 7a65557850
4 changed files with 18 additions and 4 deletions

View File

@ -892,9 +892,19 @@ APZCCallbackHelper::NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrol
}
void
APZCCallbackHelper::NotifyFlushComplete()
APZCCallbackHelper::NotifyFlushComplete(nsIPresShell* aShell)
{
MOZ_ASSERT(NS_IsMainThread());
// In some cases, flushing the APZ state to the main thread doesn't actually
// trigger a flush and repaint (this is an intentional optimization - the stuff
// visible to the user is still correct). However, reftests update their
// snapshot based on invalidation events that are emitted during paints,
// so we ensure that we kick off a paint when an APZ flush is done. Note that
// only chrome/testing code can trigger this behaviour.
if (aShell && aShell->GetRootFrame()) {
aShell->GetRootFrame()->SchedulePaint();
}
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
MOZ_ASSERT(observerService);
observerService->NotifyObservers(nullptr, "apz-repaints-flushed", nullptr);

View File

@ -161,7 +161,7 @@ public:
static void NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId, const nsString& aEvent);
/* Notify content that the repaint flush is complete. */
static void NotifyFlushComplete();
static void NotifyFlushComplete(nsIPresShell* aShell);
/* Temporarily ignore the Displayport for better paint performance. */
static void SuppressDisplayport(const bool& aEnabled);

View File

@ -232,5 +232,5 @@ void
ChromeProcessController::NotifyFlushComplete()
{
MOZ_ASSERT(NS_IsMainThread());
APZCCallbackHelper::NotifyFlushComplete();
APZCCallbackHelper::NotifyFlushComplete(GetPresShell());
}

View File

@ -151,7 +151,11 @@ APZChild::RecvNotifyAPZStateChange(const ViewID& aViewId,
bool
APZChild::RecvNotifyFlushComplete()
{
APZCCallbackHelper::NotifyFlushComplete();
nsCOMPtr<nsIPresShell> shell;
if (nsCOMPtr<nsIDocument> doc = mBrowser->GetDocument()) {
shell = doc->GetShell();
}
APZCCallbackHelper::NotifyFlushComplete(shell.get());
return true;
}