mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1157292 - include XBL stylesheets in the inspector's list of stylesheets, r=dholbert,heycam
This commit is contained in:
parent
41b048b7de
commit
308fed7444
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user