diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-01-05 18:15:57 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-01-26 15:50:30 -0500 |
commit | 8e6ce5fae721e5a4caf38b0b72e1c4a0324ae55e (patch) | |
tree | 1c398b6e727da3fd13829209835ede7a427eac97 /dom/base/CustomElementRegistry.h | |
parent | 6bbb9f062b63c5a920b1d240ba0d8575150dd01a (diff) | |
download | UXP-8e6ce5fae721e5a4caf38b0b72e1c4a0324ae55e.tar UXP-8e6ce5fae721e5a4caf38b0b72e1c4a0324ae55e.tar.gz UXP-8e6ce5fae721e5a4caf38b0b72e1c4a0324ae55e.tar.lz UXP-8e6ce5fae721e5a4caf38b0b72e1c4a0324ae55e.tar.xz UXP-8e6ce5fae721e5a4caf38b0b72e1c4a0324ae55e.zip |
Bug 1121994 - Implement adopted callback for custom elements.
Tag UXP Issue #1344
Diffstat (limited to 'dom/base/CustomElementRegistry.h')
-rw-r--r-- | dom/base/CustomElementRegistry.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/dom/base/CustomElementRegistry.h b/dom/base/CustomElementRegistry.h index 30e2c00ab..e9b2bee56 100644 --- a/dom/base/CustomElementRegistry.h +++ b/dom/base/CustomElementRegistry.h @@ -38,6 +38,12 @@ struct LifecycleCallbackArgs nsString namespaceURI; }; +struct LifecycleAdoptedCallbackArgs +{ + nsCOMPtr<nsIDocument> mOldDocument; + nsCOMPtr<nsIDocument> mNewDocument; +}; + class CustomElementCallback { public: @@ -54,6 +60,13 @@ public: mArgs = aArgs; } + void SetAdoptedCallbackArgs(LifecycleAdoptedCallbackArgs& aAdoptedCallbackArgs) + { + MOZ_ASSERT(mType == nsIDocument::eAdopted, + "Arguments are only used by adopted callback."); + mAdoptedCallbackArgs = aAdoptedCallbackArgs; + } + private: // The this value to use for invocation of the callback. RefPtr<Element> mThisObject; @@ -63,6 +76,7 @@ private: // Arguments to be passed to the callback, // used by the attribute changed callback. LifecycleCallbackArgs mArgs; + LifecycleAdoptedCallbackArgs mAdoptedCallbackArgs; // CustomElementData that contains this callback in the // callback queue. CustomElementData* mOwnerData; @@ -365,6 +379,7 @@ public: static void EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType, Element* aCustomElement, LifecycleCallbackArgs* aArgs, + LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs, CustomElementDefinition* aDefinition); void GetCustomPrototype(nsIAtom* aAtom, @@ -381,7 +396,9 @@ private: static UniquePtr<CustomElementCallback> CreateCustomElementCallback( nsIDocument::ElementCallbackType aType, Element* aCustomElement, - LifecycleCallbackArgs* aArgs, CustomElementDefinition* aDefinition); + LifecycleCallbackArgs* aArgs, + LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs, + CustomElementDefinition* aDefinition); /** * Registers an unresolved custom element that is a candidate for |