Bug 1183786 - Part 2: Delay updating after prefs changed if detached. r=tn r=dholbert

This commit is contained in:
Eric Rahm 2015-07-30 20:47:26 -07:00
parent 9287574901
commit 0a5b83be7b
2 changed files with 17 additions and 0 deletions

View File

@ -948,6 +948,12 @@ nsPresContext::UpdateAfterPreferencesChanged()
{
mPrefChangedTimer = nullptr;
if (!mContainer) {
// Delay updating until there is a container
mNeedsPrefUpdate = true;
return;
}
nsCOMPtr<nsIDocShellTreeItem> docShell(mContainer);
if (docShell && nsIDocShellTreeItem::typeChrome == docShell->ItemType()) {
return;
@ -1569,7 +1575,15 @@ void
nsPresContext::SetContainer(nsIDocShell* aDocShell)
{
if (aDocShell) {
NS_ASSERTION(!(!!mContainer && mNeedsPrefUpdate),
"Should only need pref update if mContainer is null.");
mContainer = static_cast<nsDocShell*>(aDocShell);
if (mNeedsPrefUpdate) {
if (!mPrefChangedTimer) {
InitTimer(mPrefChangedTimer, nsPresContext::PrefChangedUpdateTimerCallback, 0);
}
mNeedsPrefUpdate = false;
}
} else {
mContainer = WeakPtr<nsDocShell>();
}

View File

@ -1377,6 +1377,9 @@ protected:
// Have we added quirk.css to the style set?
unsigned mQuirkSheetAdded : 1;
// Is there a pref update to process once we have a container?
unsigned mNeedsPrefUpdate : 1;
#ifdef RESTYLE_LOGGING
// Should we output debug information about restyling for this document?
bool mRestyleLoggingEnabled;