Backed out changeset 3152110c63b5 (bug 1868374) as requested because it is not yet...
[gecko.git] / accessible / html / HTMLElementAccessibles.h
blob5a3ec6cef80549f8f2836740753dd147ae06d28a
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"
11 namespace mozilla {
12 namespace a11y {
14 /**
15 * Used for HTML hr element.
17 class HTMLHRAccessible : public LeafAccessible {
18 public:
19 HTMLHRAccessible(nsIContent* aContent, DocAccessible* aDoc)
20 : LeafAccessible(aContent, aDoc) {}
22 // LocalAccessible
23 virtual a11y::role NativeRole() const override;
26 /**
27 * Used for HTML br element.
29 class HTMLBRAccessible : public LeafAccessible {
30 public:
31 HTMLBRAccessible(nsIContent* aContent, DocAccessible* aDoc)
32 : LeafAccessible(aContent, aDoc) {
33 mType = eHTMLBRType;
34 mGenericTypes |= eText;
37 // LocalAccessible
38 virtual a11y::role NativeRole() const override;
39 virtual uint64_t NativeState() const override;
41 protected:
42 // LocalAccessible
43 virtual ENameValueFlag NativeName(nsString& aName) const override;
46 /**
47 * Used for HTML label element.
49 class HTMLLabelAccessible : public HyperTextAccessible {
50 public:
51 HTMLLabelAccessible(nsIContent* aContent, DocAccessible* aDoc)
52 : HyperTextAccessible(aContent, aDoc) {}
54 NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLLabelAccessible, HyperTextAccessible)
56 // LocalAccessible
57 virtual Relation RelationByType(RelationType aType) const override;
59 // ActionAccessible
60 virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
61 virtual bool HasPrimaryAction() const override;
63 protected:
64 virtual ~HTMLLabelAccessible() {}
65 virtual ENameValueFlag NativeName(nsString& aName) const override;
66 virtual void DOMAttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
67 int32_t aModType,
68 const nsAttrValue* aOldValue,
69 uint64_t aOldState) override;
72 /**
73 * Used for HTML output element.
75 class HTMLOutputAccessible : public HyperTextAccessible {
76 public:
77 HTMLOutputAccessible(nsIContent* aContent, DocAccessible* aDoc)
78 : HyperTextAccessible(aContent, aDoc) {}
80 NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLOutputAccessible,
81 HyperTextAccessible)
83 // LocalAccessible
84 virtual Relation RelationByType(RelationType aType) const override;
86 virtual void DOMAttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
87 int32_t aModType,
88 const nsAttrValue* aOldValue,
89 uint64_t aOldState) override;
91 protected:
92 virtual ~HTMLOutputAccessible() {}
95 /**
96 * Accessible for the HTML summary element.
98 class HTMLSummaryAccessible : public HyperTextAccessible {
99 public:
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
106 // main summary.
107 static HTMLSummaryAccessible* FromDetails(LocalAccessible* aDetails);
109 // LocalAccessible
110 virtual uint64_t NativeState() const override;
112 // ActionAccessible
113 virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
114 virtual bool HasPrimaryAction() const override;
116 // Widgets
117 virtual bool IsWidget() const override;
121 * Used for HTML header and footer elements.
123 class HTMLHeaderOrFooterAccessible : public HyperTextAccessible {
124 public:
125 HTMLHeaderOrFooterAccessible(nsIContent* aContent, DocAccessible* aDoc)
126 : HyperTextAccessible(aContent, aDoc) {}
128 NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLHeaderOrFooterAccessible,
129 HyperTextAccessible)
131 // LocalAccessible
132 virtual a11y::role NativeRole() const override;
134 protected:
135 virtual ~HTMLHeaderOrFooterAccessible() {}
139 * Used for HTML section element.
141 class HTMLSectionAccessible : public HyperTextAccessible {
142 public:
143 HTMLSectionAccessible(nsIContent* aContent, DocAccessible* aDoc)
144 : HyperTextAccessible(aContent, aDoc) {}
146 NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLSectionAccessible,
147 HyperTextAccessible)
149 // LocalAccessible
150 virtual a11y::role NativeRole() const override;
152 protected:
153 virtual ~HTMLSectionAccessible() = default;
156 } // namespace a11y
157 } // namespace mozilla
159 #endif