Add an observer service notification for the first widget paint message. (bug 1173117 part 2, r=roc)

This commit is contained in:
David Anderson 2015-06-18 13:42:39 -07:00
parent 5035751346
commit 127048bb86
2 changed files with 17 additions and 0 deletions

View File

@ -806,6 +806,7 @@ PresShell::PresShell()
mPaintingIsFrozen = false;
mHasCSSBackgroundColor = true;
mIsLastChromeOnlyEscapeKeyConsumed = false;
mHasReceivedPaintMessage = false;
}
NS_IMPL_ISUPPORTS(PresShell, nsIPresShell, nsIDocumentObserver,
@ -8560,6 +8561,19 @@ PresShell::DidPaintWindow()
// about compositing of popups.
return;
}
if (!mHasReceivedPaintMessage) {
mHasReceivedPaintMessage = true;
nsCOMPtr<nsIObserverService> obsvc = services::GetObserverService();
if (obsvc && mDocument) {
nsPIDOMWindow* window = mDocument->GetWindow();
nsCOMPtr<nsIDOMChromeWindow> chromeWin(do_QueryInterface(window));
if (chromeWin) {
obsvc->NotifyObservers(chromeWin, "widget-first-paint", nullptr);
}
}
}
}
bool

View File

@ -881,6 +881,9 @@ protected:
// Whether the last chrome-only escape key event is consumed.
bool mIsLastChromeOnlyEscapeKeyConsumed : 1;
// Whether the widget has received a paint message yet.
bool mHasReceivedPaintMessage : 1;
static bool sDisableNonTestMouseEvents;
};