Bug 839103 - part 1 - factor out StyleSheet{Added,Removed} notifications into separate nsDocument methods; r=bz

This commit is contained in:
Nathan Froyd 2013-03-27 11:20:54 -04:00
Родитель a73e8f039d
Коммит 650dfde0db
2 изменённых файлов: 21 добавлений и 7 удалений

Просмотреть файл

@ -3658,6 +3658,18 @@ nsDocument::AddStyleSheetToStyleSets(nsIStyleSheet* aSheet)
}
}
void
nsDocument::NotifyStyleSheetAdded(nsIStyleSheet* aSheet, bool aDocumentSheet)
{
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetAdded, (this, aSheet, aDocumentSheet));
}
void
nsDocument::NotifyStyleSheetRemoved(nsIStyleSheet* aSheet, bool aDocumentSheet)
{
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetRemoved, (this, aSheet, aDocumentSheet));
}
void
nsDocument::AddStyleSheet(nsIStyleSheet* aSheet)
{
@ -3669,7 +3681,7 @@ nsDocument::AddStyleSheet(nsIStyleSheet* aSheet)
AddStyleSheetToStyleSets(aSheet);
}
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetAdded, (this, aSheet, true));
NotifyStyleSheetAdded(aSheet, true);
}
void
@ -3697,7 +3709,7 @@ nsDocument::RemoveStyleSheet(nsIStyleSheet* aSheet)
RemoveStyleSheetFromStyleSets(aSheet);
}
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetRemoved, (this, aSheet, true));
NotifyStyleSheetRemoved(aSheet, true);
}
aSheet->SetOwningDocument(nullptr);
@ -3733,7 +3745,7 @@ nsDocument::UpdateStyleSheets(nsCOMArray<nsIStyleSheet>& aOldSheets,
AddStyleSheetToStyleSets(newSheet);
}
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetAdded, (this, newSheet, true));
NotifyStyleSheetAdded(newSheet, true);
}
}
@ -3752,7 +3764,7 @@ nsDocument::InsertStyleSheetAt(nsIStyleSheet* aSheet, int32_t aIndex)
AddStyleSheetToStyleSets(aSheet);
}
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetAdded, (this, aSheet, true));
NotifyStyleSheetAdded(aSheet, true);
}
@ -3810,7 +3822,7 @@ nsDocument::AddCatalogStyleSheet(nsCSSStyleSheet* aSheet)
}
}
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetAdded, (this, aSheet, false));
NotifyStyleSheetAdded(aSheet, false);
}
void
@ -3905,7 +3917,7 @@ nsDocument::LoadAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheetUR
// Passing false, so documet.styleSheets.length will not be affected by
// these additional sheets.
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetAdded, (this, sheet, false));
NotifyStyleSheetAdded(sheet, false);
EndUpdate(UPDATE_STYLE);
return NS_OK;
@ -3935,7 +3947,7 @@ nsDocument::RemoveAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheet
// Passing false, so documet.styleSheets.length will not be affected by
// these additional sheets.
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetRemoved, (this, sheetRef, false));
NotifyStyleSheetRemoved(sheetRef, false);
EndUpdate(UPDATE_STYLE);
sheetRef->SetOwningDocument(nullptr);

Просмотреть файл

@ -1316,6 +1316,8 @@ private:
friend class nsUnblockOnloadEvent;
// Recomputes the visibility state but doesn't set the new value.
mozilla::dom::VisibilityState GetVisibilityState() const;
void NotifyStyleSheetAdded(nsIStyleSheet* aSheet, bool aDocumentSheet);
void NotifyStyleSheetRemoved(nsIStyleSheet* aSheet, bool aDocumentSheet);
void PostUnblockOnloadEvent();
void DoUnblockOnload();