diff options
Diffstat (limited to 'dom/base/nsContentUtils.h')
-rw-r--r-- | dom/base/nsContentUtils.h | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index 606d67de9..bf6a59dcd 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -126,6 +126,7 @@ class EventTarget; class IPCDataTransfer; class IPCDataTransferItem; struct LifecycleCallbackArgs; +struct LifecycleAdoptedCallbackArgs; class NodeInfo; class nsIContentChild; class nsIContentParent; @@ -1739,17 +1740,6 @@ public: */ static void RunInMetastableState(already_AddRefed<nsIRunnable> aRunnable); - // Call EnterMicroTask when you're entering JS execution. - // Usually the best way to do this is to use nsAutoMicroTask. - static void EnterMicroTask(); - static void LeaveMicroTask(); - - static bool IsInMicroTask(); - static uint32_t MicroTaskLevel(); - static void SetMicroTaskLevel(uint32_t aLevel); - - static void PerformMainThreadMicroTaskCheckpoint(); - /* Process viewport META data. This gives us information for the scale * and zoom of a page on mobile devices. We stick the information in * the document header and use it later on after rendering. @@ -2711,22 +2701,36 @@ public: static bool HttpsStateIsModern(nsIDocument* aDocument); /** + * Try to upgrade an element. + * https://html.spec.whatwg.org/multipage/custom-elements.html#concept-try-upgrade + */ + static void TryToUpgradeElement(Element* aElement); + + /** * Looking up a custom element definition. * https://html.spec.whatwg.org/#look-up-a-custom-element-definition */ static mozilla::dom::CustomElementDefinition* LookupCustomElementDefinition(nsIDocument* aDoc, - const nsAString& aLocalName, + nsIAtom* aNameAtom, uint32_t aNameSpaceID, - const nsAString* aIs = nullptr); + nsIAtom* aTypeAtom); - static void SetupCustomElement(Element* aElement, - const nsAString* aTypeExtension = nullptr); + static void RegisterUnresolvedElement(Element* aElement, nsIAtom* aTypeName); + static void UnregisterUnresolvedElement(Element* aElement); - static void EnqueueLifecycleCallback(nsIDocument* aDoc, - nsIDocument::ElementCallbackType aType, + static mozilla::dom::CustomElementDefinition* + GetElementDefinitionIfObservingAttr(Element* aCustomElement, + nsIAtom* aExtensionType, + nsIAtom* aAttrName); + + static void EnqueueUpgradeReaction(Element* aElement, + mozilla::dom::CustomElementDefinition* aDefinition); + + static void EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType, Element* aCustomElement, mozilla::dom::LifecycleCallbackArgs* aArgs = nullptr, + mozilla::dom::LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs = nullptr, mozilla::dom::CustomElementDefinition* aDefinition = nullptr); static void GetCustomPrototype(nsIDocument* aDoc, @@ -2743,6 +2747,12 @@ public: static bool IsLocalRefURL(const nsString& aString); + static bool + IsWebComponentsEnabled() { return sIsWebComponentsEnabled; } + + static bool + IsCustomElementsEnabled() { return sIsCustomElementsEnabled; } + private: static bool InitializeEventTable(); @@ -2829,7 +2839,6 @@ private: static bool sInitialized; static uint32_t sScriptBlockerCount; static uint32_t sDOMNodeRemovedSuppressCount; - static uint32_t sMicroTaskLevel; // Not an nsCOMArray because removing elements from those is slower static AutoTArray<nsCOMPtr<nsIRunnable>, 8>* sBlockedScriptRunners; static uint32_t sRunnersCountAtFirstBlocker; @@ -2850,6 +2859,8 @@ private: static bool sIsUserTimingLoggingEnabled; static bool sIsFrameTimingPrefEnabled; static bool sIsExperimentalAutocompleteEnabled; + static bool sIsWebComponentsEnabled; + static bool sIsCustomElementsEnabled; static bool sEncodeDecodeURLHash; static bool sGettersDecodeURLHash; static bool sPrivacyResistFingerprinting; @@ -2905,19 +2916,6 @@ public: } }; -class MOZ_STACK_CLASS nsAutoMicroTask -{ -public: - nsAutoMicroTask() - { - nsContentUtils::EnterMicroTask(); - } - ~nsAutoMicroTask() - { - nsContentUtils::LeaveMicroTask(); - } -}; - namespace mozilla { namespace dom { |