Bug 1603534 - Merge ShadowRoot::StyleSheets and Document::StyleSheets(). r=nordzilla

They do the same so no reason to have it duplicated. EnsureDOMStyleSheets
doesn't have any other caller so just inline it there.

Differential Revision: https://phabricator.services.mozilla.com/D56986

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-12-12 21:51:59 +00:00
parent 2b5af87228
commit f2ae3383f9
4 changed files with 4 additions and 11 deletions

View File

@ -1994,10 +1994,6 @@ class Document : public nsINode,
* Style sheets are ordered, most significant last.
*/
StyleSheetList* StyleSheets() {
return &DocumentOrShadowRoot::EnsureDOMStyleSheets();
}
void InsertSheetAt(size_t aIndex, StyleSheet&);
/**

View File

@ -64,11 +64,11 @@ DocumentOrShadowRoot::~DocumentOrShadowRoot() {
}
}
StyleSheetList& DocumentOrShadowRoot::EnsureDOMStyleSheets() {
StyleSheetList* DocumentOrShadowRoot::StyleSheets() {
if (!mDOMStyleSheets) {
mDOMStyleSheets = new StyleSheetList(*this);
}
return *mDOMStyleSheets;
return mDOMStyleSheets;
}
void DocumentOrShadowRoot::InsertSheetAt(size_t aIndex, StyleSheet& aSheet) {

View File

@ -22,6 +22,7 @@ class nsWindowSizes;
namespace mozilla {
class StyleSheet;
class ErrorResult;
namespace dom {
@ -72,7 +73,7 @@ class DocumentOrShadowRoot {
return mStyleSheets.IndexOf(&aSheet);
}
StyleSheetList& EnsureDOMStyleSheets();
StyleSheetList* StyleSheets();
Element* GetElementById(const nsAString& aElementId);

View File

@ -80,10 +80,6 @@ class ShadowRoot final : public DocumentFragment,
void SheetCloned(StyleSheet&);
void StyleSheetApplicableStateChanged(StyleSheet&, bool aApplicable);
StyleSheetList* StyleSheets() {
return &DocumentOrShadowRoot::EnsureDOMStyleSheets();
}
/**
* Clones internal state, for example stylesheets, of aOther to 'this'.
*/