From 3508e79b1fe7fc928eed2f3c7bf2d628c53fbf17 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 17 Apr 2020 07:35:48 -0400 Subject: Bug 1409976 - Add `slotchange` event * Add support for `slotchange` event * Signal `slotchange` when slot's assigned nodes changes Tag #1375 --- dom/base/DocGroup.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'dom/base/DocGroup.cpp') 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, 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(aSlot)); + + if (!sPendingDocGroups) { + // Queue a mutation observer compound microtask. + nsDOMMutationObserver::QueueMutationObserverMicroTask(); + sPendingDocGroups = new AutoTArray, 2>; + } + + sPendingDocGroups->AppendElement(this); +} + } } -- cgit v1.2.3 From 16dba9a30b849c9381fab5fe53b722c7901e5283 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 17 Apr 2020 07:40:32 -0400 Subject: Issue #80 - De-unify dom/base Tag #1375 --- dom/base/DocGroup.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'dom/base/DocGroup.cpp') diff --git a/dom/base/DocGroup.cpp b/dom/base/DocGroup.cpp index 826a71812..5d7db1fb6 100644 --- a/dom/base/DocGroup.cpp +++ b/dom/base/DocGroup.cpp @@ -1,3 +1,7 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + #include "mozilla/dom/DocGroup.h" #include "mozilla/dom/TabGroup.h" #include "mozilla/Telemetry.h" @@ -7,6 +11,7 @@ #include "mozilla/ClearOnShutdown.h" #include "nsIDocShell.h" #include "nsDOMMutationObserver.h" +#include "nsNetCID.h" namespace mozilla { namespace dom { -- cgit v1.2.3