Bumping manifests a=b2g-bump
[gecko.git] / accessible / html / HTMLFormControlAccessible.h
blobb569b237627aada3280f4ee05fbb96db03abfeb8
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_HTMLFormControlAccessible_H_
7 #define MOZILLA_A11Y_HTMLFormControlAccessible_H_
9 #include "FormControlAccessible.h"
10 #include "HyperTextAccessibleWrap.h"
12 namespace mozilla {
13 namespace a11y {
15 /**
16 * Accessible for HTML progress element.
18 typedef ProgressMeterAccessible<1> HTMLProgressMeterAccessible;
20 /**
21 * Accessible for HTML input@type="checkbox".
23 class HTMLCheckboxAccessible : public LeafAccessible
26 public:
27 enum { eAction_Click = 0 };
29 HTMLCheckboxAccessible(nsIContent* aContent, DocAccessible* aDoc) :
30 LeafAccessible(aContent, aDoc)
32 // Ignore "CheckboxStateChange" DOM event in lieu of document observer
33 // state change notification.
34 mStateFlags |= eIgnoreDOMUIEvent;
37 // nsIAccessible
38 NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName);
39 NS_IMETHOD DoAction(uint8_t index);
41 // Accessible
42 virtual mozilla::a11y::role NativeRole();
43 virtual uint64_t NativeState();
45 // ActionAccessible
46 virtual uint8_t ActionCount();
48 // Widgets
49 virtual bool IsWidget() const;
53 /**
54 * Accessible for HTML input@type="radio" element.
56 class HTMLRadioButtonAccessible : public RadioButtonAccessible
59 public:
60 HTMLRadioButtonAccessible(nsIContent* aContent, DocAccessible* aDoc) :
61 RadioButtonAccessible(aContent, aDoc)
63 // Ignore "RadioStateChange" DOM event in lieu of document observer
64 // state change notification.
65 mStateFlags |= eIgnoreDOMUIEvent;
68 // Accessible
69 virtual uint64_t NativeState();
70 virtual void GetPositionAndSizeInternal(int32_t *aPosInSet,
71 int32_t *aSetSize);
75 /**
76 * Accessible for HTML input@type="button", @type="submit", @type="image"
77 * and HTML button elements.
79 class HTMLButtonAccessible : public HyperTextAccessibleWrap
82 public:
83 enum { eAction_Click = 0 };
85 HTMLButtonAccessible(nsIContent* aContent, DocAccessible* aDoc);
87 // nsIAccessible
88 NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName);
89 NS_IMETHOD DoAction(uint8_t index);
91 // Accessible
92 virtual mozilla::a11y::role NativeRole();
93 virtual uint64_t State();
94 virtual uint64_t NativeState();
96 // ActionAccessible
97 virtual uint8_t ActionCount();
99 // Widgets
100 virtual bool IsWidget() const;
102 protected:
103 // Accessible
104 virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
109 * Accessible for HTML input@type="text", input@type="password", textarea and
110 * other HTML text controls.
112 class HTMLTextFieldAccessible MOZ_FINAL : public HyperTextAccessibleWrap
115 public:
116 enum { eAction_Click = 0 };
118 HTMLTextFieldAccessible(nsIContent* aContent, DocAccessible* aDoc);
120 NS_DECL_ISUPPORTS_INHERITED
122 // nsIAccessible
123 NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName);
124 NS_IMETHOD DoAction(uint8_t index);
126 // HyperTextAccessible
127 virtual already_AddRefed<nsIEditor> GetEditor() const;
129 // Accessible
130 virtual void Value(nsString& aValue);
131 virtual void ApplyARIAState(uint64_t* aState) const;
132 virtual mozilla::a11y::role NativeRole();
133 virtual uint64_t NativeState();
134 virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
136 // ActionAccessible
137 virtual uint8_t ActionCount();
139 // Widgets
140 virtual bool IsWidget() const;
141 virtual Accessible* ContainerWidget() const;
143 protected:
144 virtual ~HTMLTextFieldAccessible() {}
146 // Accessible
147 virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
150 * Return a XUL widget element this input is part of.
152 nsIContent* XULWidgetElm() const { return mContent->GetBindingParent(); }
157 * Accessible for input@type="file" element.
159 class HTMLFileInputAccessible : public HyperTextAccessibleWrap
161 public:
162 HTMLFileInputAccessible(nsIContent* aContent, DocAccessible* aDoc);
164 // Accessible
165 virtual mozilla::a11y::role NativeRole();
166 virtual nsresult HandleAccEvent(AccEvent* aAccEvent);
171 * Used for HTML input@type="number".
173 class HTMLSpinnerAccessible : public AccessibleWrap
175 public:
176 HTMLSpinnerAccessible(nsIContent* aContent, DocAccessible* aDoc) :
177 AccessibleWrap(aContent, aDoc)
179 mStateFlags |= eHasNumericValue;
182 // Accessible
183 virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
184 virtual void Value(nsString& aValue) MOZ_OVERRIDE;
186 virtual double MaxValue() const MOZ_OVERRIDE;
187 virtual double MinValue() const MOZ_OVERRIDE;
188 virtual double CurValue() const MOZ_OVERRIDE;
189 virtual double Step() const MOZ_OVERRIDE;
190 virtual bool SetCurValue(double aValue) MOZ_OVERRIDE;
195 * Used for input@type="range" element.
197 class HTMLRangeAccessible : public LeafAccessible
199 public:
200 HTMLRangeAccessible(nsIContent* aContent, DocAccessible* aDoc) :
201 LeafAccessible(aContent, aDoc)
203 mStateFlags |= eHasNumericValue;
206 // Accessible
207 virtual void Value(nsString& aValue);
208 virtual mozilla::a11y::role NativeRole();
210 // Value
211 virtual double MaxValue() const MOZ_OVERRIDE;
212 virtual double MinValue() const MOZ_OVERRIDE;
213 virtual double CurValue() const MOZ_OVERRIDE;
214 virtual double Step() const MOZ_OVERRIDE;
215 virtual bool SetCurValue(double aValue) MOZ_OVERRIDE;
217 // Widgets
218 virtual bool IsWidget() const;
223 * Accessible for HTML fieldset element.
225 class HTMLGroupboxAccessible : public HyperTextAccessibleWrap
227 public:
228 HTMLGroupboxAccessible(nsIContent* aContent, DocAccessible* aDoc);
230 // Accessible
231 virtual mozilla::a11y::role NativeRole();
232 virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
234 protected:
235 // Accessible
236 virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
238 // HTMLGroupboxAccessible
239 nsIContent* GetLegend();
244 * Accessible for HTML legend element.
246 class HTMLLegendAccessible : public HyperTextAccessibleWrap
248 public:
249 HTMLLegendAccessible(nsIContent* aContent, DocAccessible* aDoc);
251 // Accessible
252 virtual mozilla::a11y::role NativeRole();
253 virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
257 * Accessible for HTML5 figure element.
259 class HTMLFigureAccessible : public HyperTextAccessibleWrap
261 public:
262 HTMLFigureAccessible(nsIContent* aContent, DocAccessible* aDoc);
264 // Accessible
265 virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
266 virtual mozilla::a11y::role NativeRole();
267 virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
269 protected:
270 // Accessible
271 virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
273 // HTMLLegendAccessible
274 nsIContent* Caption() const;
279 * Accessible for HTML5 figcaption element.
281 class HTMLFigcaptionAccessible : public HyperTextAccessibleWrap
283 public:
284 HTMLFigcaptionAccessible(nsIContent* aContent, DocAccessible* aDoc);
286 // Accessible
287 virtual mozilla::a11y::role NativeRole();
288 virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
291 } // namespace a11y
292 } // namespace mozilla
294 #endif