diff options
Diffstat (limited to 'dom/html/ElementInternals.h')
-rw-r--r-- | dom/html/ElementInternals.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/dom/html/ElementInternals.h b/dom/html/ElementInternals.h index 7ced3b9771..4bbf5c96f3 100644 --- a/dom/html/ElementInternals.h +++ b/dom/html/ElementInternals.h @@ -27,6 +27,13 @@ aResult = ErrorResult(SetAttr(nsGkAtoms::attr, aValue)); \ } +#define ARIA_REFLECT_ATTR_ELEMENT(method, attr) \ + Element* Get##method() const { return GetAttrElement(nsGkAtoms::attr); } \ + \ + void Set##method(Element* aElement) { \ + SetAttrElement(nsGkAtoms::attr, aElement); \ + } + class nsINodeList; class nsGenericHTMLElement; @@ -119,9 +126,12 @@ class ElementInternals final : public nsIFormControl, ARIA_REFLECT_ATTR(Role, role) // AriaAttributes + ARIA_REFLECT_ATTR_ELEMENT(AriaActiveDescendantElement, aria_activedescendant) ARIA_REFLECT_ATTR(AriaAtomic, aria_atomic) ARIA_REFLECT_ATTR(AriaAutoComplete, aria_autocomplete) ARIA_REFLECT_ATTR(AriaBusy, aria_busy) + ARIA_REFLECT_ATTR(AriaBrailleLabel, aria_braillelabel) + ARIA_REFLECT_ATTR(AriaBrailleRoleDescription, aria_brailleroledescription) ARIA_REFLECT_ATTR(AriaChecked, aria_checked) ARIA_REFLECT_ATTR(AriaColCount, aria_colcount) ARIA_REFLECT_ATTR(AriaColIndex, aria_colindex) @@ -172,6 +182,18 @@ class ElementInternals final : public nsIFormControl, private: ~ElementInternals() = default; + /** + * Gets the attribute element for the given attribute. + * https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#explicitly-set-attr-element + */ + Element* GetAttrElement(nsAtom* aAttr) const; + + /** + * Sets an attribute element for the given attribute. + * https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#explicitly-set-attr-element + */ + void SetAttrElement(nsAtom* aAttr, Element* aElement); + // It's a target element which is a custom element. RefPtr<HTMLElement> mTarget; @@ -211,6 +233,12 @@ class ElementInternals final : public nsIFormControl, // owner document. This is only set to a number for elements inserted into the // document by the parser from the network. Otherwise, it is -1. int32_t mControlNumber; + + /** + * Explicitly set attr-elements, see + * https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#explicitly-set-attr-element + */ + nsTHashMap<RefPtr<nsAtom>, nsWeakPtr> mAttrElements; }; } // namespace mozilla::dom |