diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 07:35:48 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 07:35:48 -0400 |
commit | 3508e79b1fe7fc928eed2f3c7bf2d628c53fbf17 (patch) | |
tree | c793eb598816afa68a560c4224b06ca15b8ad55c /dom/base/DocGroup.cpp | |
parent | f164962a3dc53f4823dfff6c77e7972c72d4c61f (diff) | |
download | UXP-3508e79b1fe7fc928eed2f3c7bf2d628c53fbf17.tar UXP-3508e79b1fe7fc928eed2f3c7bf2d628c53fbf17.tar.gz UXP-3508e79b1fe7fc928eed2f3c7bf2d628c53fbf17.tar.lz UXP-3508e79b1fe7fc928eed2f3c7bf2d628c53fbf17.tar.xz UXP-3508e79b1fe7fc928eed2f3c7bf2d628c53fbf17.zip |
Bug 1409976 - Add `slotchange` event
* Add support for `slotchange` event
* Signal `slotchange` when slot's assigned nodes changes
Tag #1375
Diffstat (limited to 'dom/base/DocGroup.cpp')
-rw-r--r-- | dom/base/DocGroup.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/dom/base/DocGroup.cpp b/dom/base/DocGroup.cpp index 30c058f0c..826a71812 100644 --- a/dom/base/DocGroup.cpp +++ b/dom/base/DocGroup.cpp @@ -6,10 +6,13 @@ #include "mozilla/StaticPtr.h" #include "mozilla/ClearOnShutdown.h" #include "nsIDocShell.h" +#include "nsDOMMutationObserver.h" namespace mozilla { namespace dom { +AutoTArray<RefPtr<DocGroup>, 2>* DocGroup::sPendingDocGroups = nullptr; + /* static */ void DocGroup::GetKey(nsIPrincipal* aPrincipal, nsACString& aKey) { @@ -54,5 +57,23 @@ DocGroup::~DocGroup() NS_IMPL_ISUPPORTS(DocGroup, nsISupports) +void +DocGroup::SignalSlotChange(const HTMLSlotElement* aSlot) +{ + if (mSignalSlotList.Contains(aSlot)) { + return; + } + + mSignalSlotList.AppendElement(const_cast<HTMLSlotElement*>(aSlot)); + + if (!sPendingDocGroups) { + // Queue a mutation observer compound microtask. + nsDOMMutationObserver::QueueMutationObserverMicroTask(); + sPendingDocGroups = new AutoTArray<RefPtr<DocGroup>, 2>; + } + + sPendingDocGroups->AppendElement(this); +} + } } |