diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-01-04 19:48:05 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-01-26 15:50:17 -0500 |
commit | 59c26110c1124844b5c6820573a8cb4807f1151a (patch) | |
tree | 5ac0f001cc097235e5e44c4c16fa9ab120c9b76d /dom/base | |
parent | a2c7b5f1d971cd529e65179ad97d39750e956644 (diff) | |
download | UXP-59c26110c1124844b5c6820573a8cb4807f1151a.tar UXP-59c26110c1124844b5c6820573a8cb4807f1151a.tar.gz UXP-59c26110c1124844b5c6820573a8cb4807f1151a.tar.lz UXP-59c26110c1124844b5c6820573a8cb4807f1151a.tar.xz UXP-59c26110c1124844b5c6820573a8cb4807f1151a.zip |
Bug 1347634 - GetCustomElementData and SetCustomElementData don't need to be virtual;
Tag UXP Issue #1344
Diffstat (limited to 'dom/base')
-rw-r--r-- | dom/base/Element.cpp | 8 | ||||
-rw-r--r-- | dom/base/Element.h | 23 | ||||
-rw-r--r-- | dom/base/FragmentOrElement.cpp | 18 | ||||
-rw-r--r-- | dom/base/FragmentOrElement.h | 4 | ||||
-rw-r--r-- | dom/base/nsGenericDOMDataNode.cpp | 11 | ||||
-rw-r--r-- | dom/base/nsGenericDOMDataNode.h | 3 | ||||
-rw-r--r-- | dom/base/nsIContent.h | 17 |
7 files changed, 32 insertions, 52 deletions
diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index 0054f4800..7d926f6bb 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -4037,3 +4037,11 @@ Element::UpdateIntersectionObservation(DOMIntersectionObserver* aObserver, int32 } return false; } + +void +Element::SetCustomElementData(CustomElementData* aData) +{ + nsDOMSlots *slots = DOMSlots(); + MOZ_ASSERT(!slots->mCustomElementData, "Custom element data may not be changed once set."); + slots->mCustomElementData = aData; +} diff --git a/dom/base/Element.h b/dom/base/Element.h index ce84b74fb..6d8bc823e 100644 --- a/dom/base/Element.h +++ b/dom/base/Element.h @@ -390,6 +390,29 @@ 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 + { + nsDOMSlots *slots = GetExistingDOMSlots(); + 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); + protected: /** * Method to get the _intrinsic_ content state of this element. This is the diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp index 9106778df..bf0679d9f 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -1086,24 +1086,6 @@ FragmentOrElement::SetXBLInsertionParent(nsIContent* aContent) } } -CustomElementData* -FragmentOrElement::GetCustomElementData() const -{ - nsDOMSlots *slots = GetExistingDOMSlots(); - if (slots) { - return slots->mCustomElementData; - } - return nullptr; -} - -void -FragmentOrElement::SetCustomElementData(CustomElementData* aData) -{ - nsDOMSlots *slots = DOMSlots(); - MOZ_ASSERT(!slots->mCustomElementData, "Custom element data may not be changed once set."); - slots->mCustomElementData = aData; -} - nsresult FragmentOrElement::InsertChildAt(nsIContent* aKid, uint32_t aIndex, diff --git a/dom/base/FragmentOrElement.h b/dom/base/FragmentOrElement.h index f0cc29f22..a3a59ee43 100644 --- a/dom/base/FragmentOrElement.h +++ b/dom/base/FragmentOrElement.h @@ -37,6 +37,7 @@ class nsIURI; namespace mozilla { class DeclarationBlock; namespace dom { +struct CustomElementData; class DOMIntersectionObserver; class Element; } // namespace dom @@ -159,9 +160,6 @@ public: virtual void SetXBLInsertionParent(nsIContent* aContent) override; virtual bool IsLink(nsIURI** aURI) const override; - virtual CustomElementData *GetCustomElementData() const override; - virtual void SetCustomElementData(CustomElementData* aData) override; - virtual void DestroyContent() override; virtual void SaveSubtreeState() override; diff --git a/dom/base/nsGenericDOMDataNode.cpp b/dom/base/nsGenericDOMDataNode.cpp index 0ae15e09e..73463ea5e 100644 --- a/dom/base/nsGenericDOMDataNode.cpp +++ b/dom/base/nsGenericDOMDataNode.cpp @@ -793,17 +793,6 @@ nsGenericDOMDataNode::SetXBLInsertionParent(nsIContent* aContent) } } -CustomElementData * -nsGenericDOMDataNode::GetCustomElementData() const -{ - return nullptr; -} - -void -nsGenericDOMDataNode::SetCustomElementData(CustomElementData* aData) -{ -} - bool nsGenericDOMDataNode::IsNodeOfType(uint32_t aFlags) const { diff --git a/dom/base/nsGenericDOMDataNode.h b/dom/base/nsGenericDOMDataNode.h index 63aa64e74..e8818b518 100644 --- a/dom/base/nsGenericDOMDataNode.h +++ b/dom/base/nsGenericDOMDataNode.h @@ -162,9 +162,6 @@ public: virtual bool IsNodeOfType(uint32_t aFlags) const override; virtual bool IsLink(nsIURI** aURI) const override; - virtual mozilla::dom::CustomElementData* GetCustomElementData() const override; - virtual void SetCustomElementData(mozilla::dom::CustomElementData* aData) override; - NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override; NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const; virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute, diff --git a/dom/base/nsIContent.h b/dom/base/nsIContent.h index 405090865..dcdc632b4 100644 --- a/dom/base/nsIContent.h +++ b/dom/base/nsIContent.h @@ -26,7 +26,6 @@ namespace mozilla { class EventChainPreVisitor; namespace dom { class ShadowRoot; -struct CustomElementData; } // namespace dom namespace widget { struct IMEState; @@ -730,22 +729,6 @@ public: nsINode *GetFlattenedTreeParentNodeInternal() 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. - */ - virtual mozilla::dom::CustomElementData *GetCustomElementData() const = 0; - - /** - * Sets the custom element data, ownership of the - * callback data is taken by this content. - * - * @param aCallbackData The custom element data. - */ - virtual void SetCustomElementData(mozilla::dom::CustomElementData* aData) = 0; - - /** * API to check if this is a link that's traversed in response to user input * (e.g. a click event). Specializations for HTML/SVG/generic XML allow for * different types of link in different types of content. |