зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1157292 - include XBL stylesheets in the inspector's list of stylesheets, r=dholbert,heycam
--HG-- extra : commitid : FaWwCEWPkKA extra : rebase_source : 4d4568f1c30cb8d062106f71099e21a3c33f25ab
This commit is contained in:
Родитель
aa7784428b
Коммит
ecccf6ff1a
|
@ -73,12 +73,12 @@ inDOMUtils::GetAllStyleSheets(nsIDOMDocument *aDocument, uint32_t *aLength,
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aDocument);
|
||||
|
||||
nsCOMArray<nsISupports> sheets;
|
||||
nsCOMArray<nsIStyleSheet> sheets;
|
||||
|
||||
nsCOMPtr<nsIDocument> document = do_QueryInterface(aDocument);
|
||||
MOZ_ASSERT(document);
|
||||
|
||||
// Get the agent, then user sheets in the style set.
|
||||
// Get the agent, then user and finally xbl sheets in the style set.
|
||||
nsIPresShell* presShell = document->GetShell();
|
||||
if (presShell) {
|
||||
nsStyleSet* styleSet = presShell->StyleSet();
|
||||
|
@ -90,6 +90,17 @@ inDOMUtils::GetAllStyleSheets(nsIDOMDocument *aDocument, uint32_t *aLength,
|
|||
for (int32_t i = 0; i < styleSet->SheetCount(sheetType); i++) {
|
||||
sheets.AppendElement(styleSet->StyleSheetAt(sheetType, i));
|
||||
}
|
||||
nsAutoTArray<CSSStyleSheet*, 32> xblSheetArray;
|
||||
styleSet->AppendAllXBLStyleSheets(xblSheetArray);
|
||||
|
||||
// The XBL stylesheet array will quite often be full of duplicates. Cope:
|
||||
nsTHashtable<nsPtrHashKey<CSSStyleSheet>> sheetSet;
|
||||
for (CSSStyleSheet* sheet : xblSheetArray) {
|
||||
if (!sheetSet.Contains(sheet)) {
|
||||
sheetSet.PutEntry(sheet);
|
||||
sheets.AppendElement(sheet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the document sheets.
|
||||
|
|
|
@ -347,6 +347,12 @@ class nsStyleSet final
|
|||
return mSheets[aType].ObjectAt(aIndex);
|
||||
}
|
||||
|
||||
void AppendAllXBLStyleSheets(nsTArray<mozilla::CSSStyleSheet*>& aArray) const {
|
||||
if (mBindingManager) {
|
||||
mBindingManager->AppendAllSheets(aArray);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult RemoveDocStyleSheet(nsIStyleSheet* aSheet);
|
||||
nsresult AddDocStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocument);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче