mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 08:18:41 +09:00
Bug 1425769 - Base class for ShadowRoot and Document to manage style state
Tag #1375
This commit is contained in:
parent
9fdf69e567
commit
b8260c664a
16 changed files with 250 additions and 296 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue