diff options
author | Moonchild <moonchild@palemoon.org> | 2020-04-17 16:02:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-17 16:02:56 +0200 |
commit | d5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf (patch) | |
tree | 2bfef192cbb748b675ce8308c242a376798e265d /dom/base/StyleSheetList.cpp | |
parent | 5caf99795aa81e1fc145b8e937b1ee8197ed2486 (diff) | |
parent | f35aa3e15fedf3cd4ad163d60ab74a9537ca5c82 (diff) | |
download | UXP-d5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf.tar UXP-d5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf.tar.gz UXP-d5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf.tar.lz UXP-d5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf.tar.xz UXP-d5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf.zip |
Merge pull request #1518 from MoonchildProductions/shadowdom-merge
Incremental shadowdom-merge
Diffstat (limited to 'dom/base/StyleSheetList.cpp')
-rw-r--r-- | dom/base/StyleSheetList.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/dom/base/StyleSheetList.cpp b/dom/base/StyleSheetList.cpp index 7274b5ea5..42db3179d 100644 --- a/dom/base/StyleSheetList.cpp +++ b/dom/base/StyleSheetList.cpp @@ -8,6 +8,7 @@ #include "mozilla/CSSStyleSheet.h" #include "mozilla/dom/StyleSheetListBinding.h" +#include "nsStubDocumentObserver.h" namespace mozilla { namespace dom { @@ -17,7 +18,8 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(StyleSheetList) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(StyleSheetList) NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY NS_INTERFACE_MAP_ENTRY(nsIDOMStyleSheetList) - NS_INTERFACE_MAP_ENTRY(nsISupports) + NS_INTERFACE_MAP_ENTRY(nsIMutationObserver) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMStyleSheetList) NS_INTERFACE_MAP_END NS_IMPL_CYCLE_COLLECTING_ADDREF(StyleSheetList) @@ -43,5 +45,24 @@ StyleSheetList::SlowItem(uint32_t aIndex, nsIDOMStyleSheet** aItem) return NS_OK; } +void +StyleSheetList::NodeWillBeDestroyed(const nsINode* aNode) +{ + mStyleScope = nullptr; +} + +StyleSheetList::StyleSheetList(StyleScope& aScope) + : mStyleScope(&aScope) +{ + mStyleScope->AsNode().AddMutationObserver(this); +} + +StyleSheetList::~StyleSheetList() +{ + if (mStyleScope) { + mStyleScope->AsNode().RemoveMutationObserver(this); + } +} + } // namespace dom } // namespace mozilla |