diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-01-05 12:51:10 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-01-26 15:50:27 -0500 |
commit | f50503df9c2eced785957626273ee07e5312d546 (patch) | |
tree | 3bc2c0f85b649507cc0c56700fa39f943180847e /dom/base | |
parent | 5840b63cca00a45c8c40bf5e04195aabd4dabb73 (diff) | |
download | UXP-f50503df9c2eced785957626273ee07e5312d546.tar UXP-f50503df9c2eced785957626273ee07e5312d546.tar.gz UXP-f50503df9c2eced785957626273ee07e5312d546.tar.lz UXP-f50503df9c2eced785957626273ee07e5312d546.tar.xz UXP-f50503df9c2eced785957626273ee07e5312d546.zip |
Bug 1301024 - Part 2: Implement create an element steps.
Tag UXP Issue #1344
Diffstat (limited to 'dom/base')
-rw-r--r-- | dom/base/CustomElementRegistry.cpp | 12 | ||||
-rw-r--r-- | dom/base/CustomElementRegistry.h | 2 | ||||
-rw-r--r-- | dom/base/nsContentUtils.cpp | 22 | ||||
-rw-r--r-- | dom/base/nsContentUtils.h | 3 |
4 files changed, 34 insertions, 5 deletions
diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp index 897f7df12..27e92a56a 100644 --- a/dom/base/CustomElementRegistry.cpp +++ b/dom/base/CustomElementRegistry.cpp @@ -931,7 +931,7 @@ DoUpgrade(Element* aElement, } // anonymous namespace // https://html.spec.whatwg.org/multipage/scripting.html#upgrades -void +/* static */ void CustomElementRegistry::Upgrade(Element* aElement, CustomElementDefinition* aDefinition, ErrorResult& aRv) @@ -969,8 +969,10 @@ CustomElementRegistry::Upgrade(Element* aElement, (attrValue.IsEmpty() ? NullString() : attrValue), (namespaceURI.IsEmpty() ? NullString() : namespaceURI) }; - EnqueueLifecycleCallback(nsIDocument::eAttributeChanged, aElement, - &args, aDefinition); + nsContentUtils::EnqueueLifecycleCallback(aElement->OwnerDoc(), + nsIDocument::eAttributeChanged, + aElement, + &args, aDefinition); } } } @@ -995,7 +997,9 @@ CustomElementRegistry::Upgrade(Element* aElement, data->mState = CustomElementData::State::eCustom; // This is for old spec. - EnqueueLifecycleCallback(nsIDocument::eCreated, aElement, nullptr, aDefinition); + nsContentUtils::EnqueueLifecycleCallback(aElement->OwnerDoc(), + nsIDocument::eCreated, + aElement, nullptr, aDefinition); } //----------------------------------------------------- diff --git a/dom/base/CustomElementRegistry.h b/dom/base/CustomElementRegistry.h index b85d089f9..b731a1858 100644 --- a/dom/base/CustomElementRegistry.h +++ b/dom/base/CustomElementRegistry.h @@ -357,7 +357,7 @@ public: * Upgrade an element. * https://html.spec.whatwg.org/multipage/scripting.html#upgrades */ - void Upgrade(Element* aElement, CustomElementDefinition* aDefinition, ErrorResult& aRv); + static void Upgrade(Element* aElement, CustomElementDefinition* aDefinition, ErrorResult& aRv); private: ~CustomElementRegistry(); diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 570065dba..f8964d198 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -9660,6 +9660,28 @@ nsContentUtils::GetElementDefinitionIfObservingAttr(Element* aCustomElement, } /* static */ void +nsContentUtils::EnqueueUpgradeReaction(Element* aElement, + CustomElementDefinition* aDefinition) +{ + MOZ_ASSERT(aElement); + + nsIDocument* doc = aElement->OwnerDoc(); + nsPIDOMWindowInner* window(doc->GetInnerWindow()); + if (!window) { + return; + } + + RefPtr<CustomElementRegistry> registry(window->CustomElements()); + if (!registry) { + return; + } + + CustomElementReactionsStack* stack = + doc->GetDocGroup()->CustomElementReactionsStack(); + stack->EnqueueUpgradeReaction(registry, aElement, aDefinition); +} + +/* static */ void nsContentUtils::EnqueueLifecycleCallback(nsIDocument* aDoc, nsIDocument::ElementCallbackType aType, Element* aCustomElement, diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index 96c920394..1828d8b21 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -2728,6 +2728,9 @@ public: nsIAtom* aExtensionType, nsIAtom* aAttrName); + static void EnqueueUpgradeReaction(Element* aElement, + mozilla::dom::CustomElementDefinition* aDefinition); + static void EnqueueLifecycleCallback(nsIDocument* aDoc, nsIDocument::ElementCallbackType aType, Element* aCustomElement, |