1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_a11y_HTMLElementAccessibles_h__
7 #define mozilla_a11y_HTMLElementAccessibles_h__
9 #include "BaseAccessibles.h"
15 * Used for HTML hr element.
17 class HTMLHRAccessible
: public LeafAccessible
{
19 HTMLHRAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
)
20 : LeafAccessible(aContent
, aDoc
) {}
23 virtual a11y::role
NativeRole() const override
;
27 * Used for HTML br element.
29 class HTMLBRAccessible
: public LeafAccessible
{
31 HTMLBRAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
)
32 : LeafAccessible(aContent
, aDoc
) {
34 mGenericTypes
|= eText
;
38 virtual a11y::role
NativeRole() const override
;
39 virtual uint64_t NativeState() const override
;
43 virtual ENameValueFlag
NativeName(nsString
& aName
) const override
;
47 * Used for HTML label element.
49 class HTMLLabelAccessible
: public HyperTextAccessible
{
51 HTMLLabelAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
)
52 : HyperTextAccessible(aContent
, aDoc
) {}
54 NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLLabelAccessible
, HyperTextAccessible
)
57 virtual Relation
RelationByType(RelationType aType
) const override
;
60 virtual void ActionNameAt(uint8_t aIndex
, nsAString
& aName
) override
;
61 virtual bool HasPrimaryAction() const override
;
64 virtual ~HTMLLabelAccessible() {}
65 virtual ENameValueFlag
NativeName(nsString
& aName
) const override
;
66 virtual void DOMAttributeChanged(int32_t aNameSpaceID
, nsAtom
* aAttribute
,
68 const nsAttrValue
* aOldValue
,
69 uint64_t aOldState
) override
;
73 * Used for HTML output element.
75 class HTMLOutputAccessible
: public HyperTextAccessible
{
77 HTMLOutputAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
)
78 : HyperTextAccessible(aContent
, aDoc
) {}
80 NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLOutputAccessible
,
84 virtual Relation
RelationByType(RelationType aType
) const override
;
86 virtual void DOMAttributeChanged(int32_t aNameSpaceID
, nsAtom
* aAttribute
,
88 const nsAttrValue
* aOldValue
,
89 uint64_t aOldState
) override
;
92 virtual ~HTMLOutputAccessible() {}
96 * Accessible for the HTML summary element.
98 class HTMLSummaryAccessible
: public HyperTextAccessible
{
100 enum { eAction_Click
= 0 };
102 HTMLSummaryAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
104 // Check that the given LocalAccessible belongs to a details frame.
105 // If so, find and return the accessible for the detail frame's
107 static HTMLSummaryAccessible
* FromDetails(LocalAccessible
* aDetails
);
110 virtual uint64_t NativeState() const override
;
113 virtual void ActionNameAt(uint8_t aIndex
, nsAString
& aName
) override
;
114 virtual bool HasPrimaryAction() const override
;
117 virtual bool IsWidget() const override
;
121 * Used for HTML header and footer elements.
123 class HTMLHeaderOrFooterAccessible
: public HyperTextAccessible
{
125 HTMLHeaderOrFooterAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
)
126 : HyperTextAccessible(aContent
, aDoc
) {}
128 NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLHeaderOrFooterAccessible
,
132 virtual a11y::role
NativeRole() const override
;
135 virtual ~HTMLHeaderOrFooterAccessible() {}
139 * Used for HTML section element.
141 class HTMLSectionAccessible
: public HyperTextAccessible
{
143 HTMLSectionAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
)
144 : HyperTextAccessible(aContent
, aDoc
) {}
146 NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLSectionAccessible
,
150 virtual a11y::role
NativeRole() const override
;
153 virtual ~HTMLSectionAccessible() = default;
157 } // namespace mozilla