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"
16 * Accessible for HTML progress element.
18 typedef ProgressMeterAccessible
<1> HTMLProgressMeterAccessible
;
21 * Accessible for HTML input@type="checkbox".
23 class HTMLCheckboxAccessible
: public LeafAccessible
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
;
38 NS_IMETHOD
GetActionName(uint8_t aIndex
, nsAString
& aName
);
39 NS_IMETHOD
DoAction(uint8_t index
);
42 virtual mozilla::a11y::role
NativeRole();
43 virtual uint64_t NativeState();
46 virtual uint8_t ActionCount();
49 virtual bool IsWidget() const;
54 * Accessible for HTML input@type="radio" element.
56 class HTMLRadioButtonAccessible
: public RadioButtonAccessible
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
;
69 virtual uint64_t NativeState();
70 virtual void GetPositionAndSizeInternal(int32_t *aPosInSet
,
76 * Accessible for HTML input@type="button", @type="submit", @type="image"
77 * and HTML button elements.
79 class HTMLButtonAccessible
: public HyperTextAccessibleWrap
83 enum { eAction_Click
= 0 };
85 HTMLButtonAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
88 NS_IMETHOD
GetActionName(uint8_t aIndex
, nsAString
& aName
);
89 NS_IMETHOD
DoAction(uint8_t index
);
92 virtual mozilla::a11y::role
NativeRole();
93 virtual uint64_t State();
94 virtual uint64_t NativeState();
97 virtual uint8_t ActionCount();
100 virtual bool IsWidget() const;
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
116 enum { eAction_Click
= 0 };
118 HTMLTextFieldAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
120 NS_DECL_ISUPPORTS_INHERITED
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;
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
;
137 virtual uint8_t ActionCount();
140 virtual bool IsWidget() const;
141 virtual Accessible
* ContainerWidget() const;
144 virtual ~HTMLTextFieldAccessible() {}
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
162 HTMLFileInputAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
165 virtual mozilla::a11y::role
NativeRole();
166 virtual nsresult
HandleAccEvent(AccEvent
* aAccEvent
);
171 * Used for HTML input@type="number".
173 class HTMLSpinnerAccessible
: public AccessibleWrap
176 HTMLSpinnerAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
) :
177 AccessibleWrap(aContent
, aDoc
)
179 mStateFlags
|= eHasNumericValue
;
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
200 HTMLRangeAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
) :
201 LeafAccessible(aContent
, aDoc
)
203 mStateFlags
|= eHasNumericValue
;
207 virtual void Value(nsString
& aValue
);
208 virtual mozilla::a11y::role
NativeRole();
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
;
218 virtual bool IsWidget() const;
223 * Accessible for HTML fieldset element.
225 class HTMLGroupboxAccessible
: public HyperTextAccessibleWrap
228 HTMLGroupboxAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
231 virtual mozilla::a11y::role
NativeRole();
232 virtual Relation
RelationByType(RelationType aType
) MOZ_OVERRIDE
;
236 virtual ENameValueFlag
NativeName(nsString
& aName
) MOZ_OVERRIDE
;
238 // HTMLGroupboxAccessible
239 nsIContent
* GetLegend();
244 * Accessible for HTML legend element.
246 class HTMLLegendAccessible
: public HyperTextAccessibleWrap
249 HTMLLegendAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
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
262 HTMLFigureAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
265 virtual already_AddRefed
<nsIPersistentProperties
> NativeAttributes() MOZ_OVERRIDE
;
266 virtual mozilla::a11y::role
NativeRole();
267 virtual Relation
RelationByType(RelationType aType
) MOZ_OVERRIDE
;
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
284 HTMLFigcaptionAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
287 virtual mozilla::a11y::role
NativeRole();
288 virtual Relation
RelationByType(RelationType aType
) MOZ_OVERRIDE
;
292 } // namespace mozilla