зеркало из https://github.com/mozilla/gecko-dev.git
Bug 676054: part3: nsStyleSheetService::GetInstance. r=bz
This commit is contained in:
Родитель
a731451bde
Коммит
5d3a0e3c38
|
@ -2340,12 +2340,6 @@ nsDocument::FillStyleSet(nsStyleSet* aStyleSet)
|
||||||
NS_PRECONDITION(mStyleAttrStyleSheet, "No style attr stylesheet?");
|
NS_PRECONDITION(mStyleAttrStyleSheet, "No style attr stylesheet?");
|
||||||
NS_PRECONDITION(mAttrStyleSheet, "No attr stylesheet?");
|
NS_PRECONDITION(mAttrStyleSheet, "No attr stylesheet?");
|
||||||
|
|
||||||
nsCOMPtr<nsIStyleSheetService> dummy =
|
|
||||||
do_GetService(NS_STYLESHEETSERVICE_CONTRACTID);
|
|
||||||
|
|
||||||
nsStyleSheetService *sheetService = nsStyleSheetService::gInstance;
|
|
||||||
|
|
||||||
|
|
||||||
aStyleSet->AppendStyleSheet(nsStyleSet::ePresHintSheet, mAttrStyleSheet);
|
aStyleSet->AppendStyleSheet(nsStyleSet::ePresHintSheet, mAttrStyleSheet);
|
||||||
|
|
||||||
aStyleSet->AppendStyleSheet(nsStyleSet::eStyleAttrSheet,
|
aStyleSet->AppendStyleSheet(nsStyleSet::eStyleAttrSheet,
|
||||||
|
@ -2359,6 +2353,7 @@ nsDocument::FillStyleSet(nsStyleSet* aStyleSet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
|
||||||
if (sheetService) {
|
if (sheetService) {
|
||||||
sheetService->AuthorStyleSheets()->EnumerateForwards(AppendAuthorSheet,
|
sheetService->AuthorStyleSheets()->EnumerateForwards(AppendAuthorSheet,
|
||||||
aStyleSet);
|
aStyleSet);
|
||||||
|
|
|
@ -2232,10 +2232,7 @@ DocumentViewerImpl::CreateStyleSet(nsIDocument* aDocument,
|
||||||
styleSet->PrependStyleSheet(nsStyleSet::eAgentSheet,
|
styleSet->PrependStyleSheet(nsStyleSet::eAgentSheet,
|
||||||
nsLayoutStylesheetCache::UASheet());
|
nsLayoutStylesheetCache::UASheet());
|
||||||
|
|
||||||
nsCOMPtr<nsIStyleSheetService> dummy =
|
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
|
||||||
do_GetService(NS_STYLESHEETSERVICE_CONTRACTID);
|
|
||||||
|
|
||||||
nsStyleSheetService *sheetService = nsStyleSheetService::gInstance;
|
|
||||||
if (sheetService) {
|
if (sheetService) {
|
||||||
sheetService->AgentStyleSheets()->EnumerateForwards(AppendAgentSheet,
|
sheetService->AgentStyleSheets()->EnumerateForwards(AppendAgentSheet,
|
||||||
styleSet);
|
styleSet);
|
||||||
|
|
|
@ -240,6 +240,21 @@ nsStyleSheetService::UnregisterSheet(nsIURI *sheetURI, uint32_t aSheetType)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//static
|
||||||
|
nsStyleSheetService *
|
||||||
|
nsStyleSheetService::GetInstance()
|
||||||
|
{
|
||||||
|
static bool first = true;
|
||||||
|
if (first) {
|
||||||
|
// make sure at first call that it's inited
|
||||||
|
nsCOMPtr<nsIStyleSheetService> dummy =
|
||||||
|
do_GetService(NS_STYLESHEETSERVICE_CONTRACTID);
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return gInstance;
|
||||||
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
nsStyleSheetService::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf)
|
nsStyleSheetService::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf)
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,6 +41,7 @@ class nsStyleSheetService MOZ_FINAL : public nsIStyleSheetService
|
||||||
|
|
||||||
static size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf);
|
static size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf);
|
||||||
|
|
||||||
|
static nsStyleSheetService *GetInstance();
|
||||||
static nsStyleSheetService *gInstance;
|
static nsStyleSheetService *gInstance;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -363,7 +363,7 @@ nsStyleSet::AddDocStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocument)
|
||||||
nsCOMArray<nsIStyleSheet>& docSheets = mSheets[eDocSheet];
|
nsCOMArray<nsIStyleSheet>& docSheets = mSheets[eDocSheet];
|
||||||
|
|
||||||
docSheets.RemoveObject(aSheet);
|
docSheets.RemoveObject(aSheet);
|
||||||
nsStyleSheetService *sheetService = nsStyleSheetService::gInstance;
|
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
|
||||||
|
|
||||||
// lowest index first
|
// lowest index first
|
||||||
int32_t newDocIndex = aDocument->GetIndexOfStyleSheet(aSheet);
|
int32_t newDocIndex = aDocument->GetIndexOfStyleSheet(aSheet);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче