diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-06-13 08:21:48 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-06-13 08:21:48 -0400 |
commit | 43725c7264ca3f63de348d1d1596ce1fe9e64d2d (patch) | |
tree | e1ff1b11cc54e63b665aab1aa3776a62ee56250d /dom/base/nsIDocument.h | |
parent | 35754dd1af72abcae49edd2eeb76855d999a4e6d (diff) | |
download | uxp-43725c7264ca3f63de348d1d1596ce1fe9e64d2d.tar.gz |
Bug 1426494 - Share more code between nsIDocument and ShadowRoot
Tag #1375
Diffstat (limited to 'dom/base/nsIDocument.h')
-rw-r--r-- | dom/base/nsIDocument.h | 42 |
1 files changed, 8 insertions, 34 deletions
diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h index b4fda21c1a..d88db84237 100644 --- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -34,7 +34,7 @@ #include "prclist.h" #include "mozilla/UniquePtr.h" #include "mozilla/CORSMode.h" -#include "mozilla/dom/StyleScope.h" +#include "mozilla/dom/DocumentOrShadowRoot.h" #include "mozilla/LinkedList.h" #include "mozilla/StyleBackendType.h" #include "mozilla/StyleSheet.h" @@ -198,7 +198,7 @@ class nsContentList; // Document interface. This is implemented by all document objects in // Gecko. class nsIDocument : public nsINode, - public mozilla::dom::StyleScope + public mozilla::dom::DocumentOrShadowRoot { typedef mozilla::dom::GlobalObject GlobalObject; @@ -499,7 +499,7 @@ public: * to remove it. */ typedef bool (* IDTargetObserver)(Element* aOldElement, - Element* aNewelement, void* aData); + Element* aNewelement, void* aData); /** * Add an IDTargetObserver for a specific ID. The IDTargetObserver @@ -1071,14 +1071,9 @@ public: */ virtual void EnsureOnDemandBuiltInUASheet(mozilla::StyleSheet* aSheet) = 0; - nsINode& AsNode() final - { - return *this; - } - mozilla::dom::StyleSheetList* StyleSheets() { - return &StyleScope::EnsureDOMStyleSheets(); + return &DocumentOrShadowRoot::EnsureDOMStyleSheets(); } /** @@ -2362,19 +2357,10 @@ public: virtual void ResetScrolledToRefAlready() = 0; virtual void SetChangeScrollPosWhenScrollingToRef(bool aValue) = 0; - /** - * This method is similar to GetElementById() from nsIDOMDocument but it - * returns a mozilla::dom::Element instead of a nsIDOMElement. - * It prevents converting nsIDOMElement to mozilla::dom::Element which is - * already converted from mozilla::dom::Element. - */ - virtual Element* GetElementById(const nsAString& aElementId) = 0; - - /** - * This method returns _all_ the elements in this document which - * have id aElementId, if there are any. Otherwise it returns null. - */ - virtual const nsTArray<Element*>* GetAllElementsForId(const nsAString& aElementId) const = 0; + using mozilla::dom::DocumentOrShadowRoot::GetElementById; + using mozilla::dom::DocumentOrShadowRoot::GetElementsByTagName; + using mozilla::dom::DocumentOrShadowRoot::GetElementsByTagNameNS; + using mozilla::dom::DocumentOrShadowRoot::GetElementsByClassName; /** * Lookup an image element using its associated ID, which is usually provided @@ -2574,18 +2560,6 @@ public: nsIDocument* GetTopLevelContentDocument(); - already_AddRefed<nsContentList> - GetElementsByTagName(const nsAString& aTagName) - { - return NS_GetContentList(this, kNameSpaceID_Unknown, aTagName); - } - already_AddRefed<nsContentList> - GetElementsByTagNameNS(const nsAString& aNamespaceURI, - const nsAString& aLocalName, - mozilla::ErrorResult& aResult); - already_AddRefed<nsContentList> - GetElementsByClassName(const nsAString& aClasses); - // GetElementById defined above virtual already_AddRefed<Element> CreateElement(const nsAString& aTagName, const mozilla::dom::ElementCreationOptionsOrString& aOptions, |