summaryrefslogtreecommitdiffstats
path: root/dom/base/Element.h
diff options
context:
space:
mode:
authorNew Tobin Paradigm <email@mattatobin.com>2020-01-26 17:13:16 -0500
committerGitHub <noreply@github.com>2020-01-26 17:13:16 -0500
commit22ed46f7cca6d388e7e9e2bf53851ab488cc62ab (patch)
treefb5b7a509abe61a05bf6f3f88371271be4e5ccaa /dom/base/Element.h
parenta1cce3b2b00bbd9f4983013ddd8934a7bccb9e99 (diff)
parent3c70b297c7be12b7d7e120de04a38f40b600928b (diff)
downloadUXP-22ed46f7cca6d388e7e9e2bf53851ab488cc62ab.tar
UXP-22ed46f7cca6d388e7e9e2bf53851ab488cc62ab.tar.gz
UXP-22ed46f7cca6d388e7e9e2bf53851ab488cc62ab.tar.lz
UXP-22ed46f7cca6d388e7e9e2bf53851ab488cc62ab.tar.xz
UXP-22ed46f7cca6d388e7e9e2bf53851ab488cc62ab.zip
Merge pull request #1374 from g4jc/custom_elementsv1
Custom Elements v1
Diffstat (limited to 'dom/base/Element.h')
-rw-r--r--dom/base/Element.h41
1 files changed, 40 insertions, 1 deletions
diff --git a/dom/base/Element.h b/dom/base/Element.h
index ce84b74fb..782004703 100644
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -390,6 +390,45 @@ public:
Directionality GetComputedDirectionality() const;
+ /**
+ * Gets the custom element data used by web components custom element.
+ * Custom element data is created at the first attempt to enqueue a callback.
+ *
+ * @return The custom element data or null if none.
+ */
+ inline CustomElementData* GetCustomElementData() const
+ {
+ nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
+ if (slots) {
+ return slots->mCustomElementData;
+ }
+ return nullptr;
+ }
+
+ /**
+ * Sets the custom element data, ownership of the
+ * callback data is taken by this element.
+ *
+ * @param aData The custom element data.
+ */
+ void SetCustomElementData(CustomElementData* aData);
+
+ /**
+ * Gets the custom element definition used by web components custom element.
+ *
+ * @return The custom element definition or null if element is not a custom
+ * element or custom element is not defined yet.
+ */
+ CustomElementDefinition* GetCustomElementDefinition() const;
+
+ /**
+ * Sets the custom element definition, called when custom element is created
+ * or upgraded.
+ *
+ * @param aDefinition The custom element definition.
+ */
+ void SetCustomElementDefinition(CustomElementDefinition* aDefinition);
+
protected:
/**
* Method to get the _intrinsic_ content state of this element. This is the
@@ -814,7 +853,7 @@ public:
ShadowRoot *FastGetShadowRoot() const
{
- nsDOMSlots* slots = GetExistingDOMSlots();
+ nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
return slots ? slots->mShadowRoot.get() : nullptr;
}