Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef MOZILLA_A11Y_HTMLFormControlAccessible_H_ |
michael@0 | 7 | #define MOZILLA_A11Y_HTMLFormControlAccessible_H_ |
michael@0 | 8 | |
michael@0 | 9 | #include "FormControlAccessible.h" |
michael@0 | 10 | #include "HyperTextAccessibleWrap.h" |
michael@0 | 11 | |
michael@0 | 12 | namespace mozilla { |
michael@0 | 13 | namespace a11y { |
michael@0 | 14 | |
michael@0 | 15 | /** |
michael@0 | 16 | * Accessible for HTML progress element. |
michael@0 | 17 | */ |
michael@0 | 18 | typedef ProgressMeterAccessible<1> HTMLProgressMeterAccessible; |
michael@0 | 19 | |
michael@0 | 20 | /** |
michael@0 | 21 | * Accessible for HTML input@type="checkbox". |
michael@0 | 22 | */ |
michael@0 | 23 | class HTMLCheckboxAccessible : public LeafAccessible |
michael@0 | 24 | { |
michael@0 | 25 | |
michael@0 | 26 | public: |
michael@0 | 27 | enum { eAction_Click = 0 }; |
michael@0 | 28 | |
michael@0 | 29 | HTMLCheckboxAccessible(nsIContent* aContent, DocAccessible* aDoc) : |
michael@0 | 30 | LeafAccessible(aContent, aDoc) |
michael@0 | 31 | { |
michael@0 | 32 | // Ignore "CheckboxStateChange" DOM event in lieu of document observer |
michael@0 | 33 | // state change notification. |
michael@0 | 34 | mStateFlags |= eIgnoreDOMUIEvent; |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | // nsIAccessible |
michael@0 | 38 | NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName); |
michael@0 | 39 | NS_IMETHOD DoAction(uint8_t index); |
michael@0 | 40 | |
michael@0 | 41 | // Accessible |
michael@0 | 42 | virtual mozilla::a11y::role NativeRole(); |
michael@0 | 43 | virtual uint64_t NativeState(); |
michael@0 | 44 | |
michael@0 | 45 | // ActionAccessible |
michael@0 | 46 | virtual uint8_t ActionCount(); |
michael@0 | 47 | |
michael@0 | 48 | // Widgets |
michael@0 | 49 | virtual bool IsWidget() const; |
michael@0 | 50 | }; |
michael@0 | 51 | |
michael@0 | 52 | |
michael@0 | 53 | /** |
michael@0 | 54 | * Accessible for HTML input@type="radio" element. |
michael@0 | 55 | */ |
michael@0 | 56 | class HTMLRadioButtonAccessible : public RadioButtonAccessible |
michael@0 | 57 | { |
michael@0 | 58 | |
michael@0 | 59 | public: |
michael@0 | 60 | HTMLRadioButtonAccessible(nsIContent* aContent, DocAccessible* aDoc) : |
michael@0 | 61 | RadioButtonAccessible(aContent, aDoc) |
michael@0 | 62 | { |
michael@0 | 63 | // Ignore "RadioStateChange" DOM event in lieu of document observer |
michael@0 | 64 | // state change notification. |
michael@0 | 65 | mStateFlags |= eIgnoreDOMUIEvent; |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | // Accessible |
michael@0 | 69 | virtual uint64_t NativeState(); |
michael@0 | 70 | virtual void GetPositionAndSizeInternal(int32_t *aPosInSet, |
michael@0 | 71 | int32_t *aSetSize); |
michael@0 | 72 | }; |
michael@0 | 73 | |
michael@0 | 74 | |
michael@0 | 75 | /** |
michael@0 | 76 | * Accessible for HTML input@type="button", @type="submit", @type="image" |
michael@0 | 77 | * and HTML button elements. |
michael@0 | 78 | */ |
michael@0 | 79 | class HTMLButtonAccessible : public HyperTextAccessibleWrap |
michael@0 | 80 | { |
michael@0 | 81 | |
michael@0 | 82 | public: |
michael@0 | 83 | enum { eAction_Click = 0 }; |
michael@0 | 84 | |
michael@0 | 85 | HTMLButtonAccessible(nsIContent* aContent, DocAccessible* aDoc); |
michael@0 | 86 | |
michael@0 | 87 | // nsIAccessible |
michael@0 | 88 | NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName); |
michael@0 | 89 | NS_IMETHOD DoAction(uint8_t index); |
michael@0 | 90 | |
michael@0 | 91 | // Accessible |
michael@0 | 92 | virtual mozilla::a11y::role NativeRole(); |
michael@0 | 93 | virtual uint64_t State(); |
michael@0 | 94 | virtual uint64_t NativeState(); |
michael@0 | 95 | |
michael@0 | 96 | // ActionAccessible |
michael@0 | 97 | virtual uint8_t ActionCount(); |
michael@0 | 98 | |
michael@0 | 99 | // Widgets |
michael@0 | 100 | virtual bool IsWidget() const; |
michael@0 | 101 | |
michael@0 | 102 | protected: |
michael@0 | 103 | // Accessible |
michael@0 | 104 | virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE; |
michael@0 | 105 | }; |
michael@0 | 106 | |
michael@0 | 107 | |
michael@0 | 108 | /** |
michael@0 | 109 | * Accessible for HTML input@type="text", input@type="password", textarea and |
michael@0 | 110 | * other HTML text controls. |
michael@0 | 111 | */ |
michael@0 | 112 | class HTMLTextFieldAccessible : public HyperTextAccessibleWrap |
michael@0 | 113 | { |
michael@0 | 114 | |
michael@0 | 115 | public: |
michael@0 | 116 | enum { eAction_Click = 0 }; |
michael@0 | 117 | |
michael@0 | 118 | HTMLTextFieldAccessible(nsIContent* aContent, DocAccessible* aDoc); |
michael@0 | 119 | |
michael@0 | 120 | NS_DECL_ISUPPORTS_INHERITED |
michael@0 | 121 | |
michael@0 | 122 | // nsIAccessible |
michael@0 | 123 | NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName); |
michael@0 | 124 | NS_IMETHOD DoAction(uint8_t index); |
michael@0 | 125 | |
michael@0 | 126 | // HyperTextAccessible |
michael@0 | 127 | virtual already_AddRefed<nsIEditor> GetEditor() const; |
michael@0 | 128 | |
michael@0 | 129 | // Accessible |
michael@0 | 130 | virtual void Value(nsString& aValue); |
michael@0 | 131 | virtual void ApplyARIAState(uint64_t* aState) const; |
michael@0 | 132 | virtual mozilla::a11y::role NativeRole(); |
michael@0 | 133 | virtual uint64_t NativeState(); |
michael@0 | 134 | virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE; |
michael@0 | 135 | |
michael@0 | 136 | // ActionAccessible |
michael@0 | 137 | virtual uint8_t ActionCount(); |
michael@0 | 138 | |
michael@0 | 139 | // Widgets |
michael@0 | 140 | virtual bool IsWidget() const; |
michael@0 | 141 | virtual Accessible* ContainerWidget() const; |
michael@0 | 142 | |
michael@0 | 143 | protected: |
michael@0 | 144 | // Accessible |
michael@0 | 145 | virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE; |
michael@0 | 146 | |
michael@0 | 147 | /** |
michael@0 | 148 | * Return a XUL widget element this input is part of. |
michael@0 | 149 | */ |
michael@0 | 150 | nsIContent* XULWidgetElm() const { return mContent->GetBindingParent(); } |
michael@0 | 151 | }; |
michael@0 | 152 | |
michael@0 | 153 | |
michael@0 | 154 | /** |
michael@0 | 155 | * Accessible for input@type="file" element. |
michael@0 | 156 | */ |
michael@0 | 157 | class HTMLFileInputAccessible : public HyperTextAccessibleWrap |
michael@0 | 158 | { |
michael@0 | 159 | public: |
michael@0 | 160 | HTMLFileInputAccessible(nsIContent* aContent, DocAccessible* aDoc); |
michael@0 | 161 | |
michael@0 | 162 | // Accessible |
michael@0 | 163 | virtual mozilla::a11y::role NativeRole(); |
michael@0 | 164 | virtual nsresult HandleAccEvent(AccEvent* aAccEvent); |
michael@0 | 165 | }; |
michael@0 | 166 | |
michael@0 | 167 | |
michael@0 | 168 | /** |
michael@0 | 169 | * Used for HTML input@type="number". |
michael@0 | 170 | */ |
michael@0 | 171 | class HTMLSpinnerAccessible : public AccessibleWrap |
michael@0 | 172 | { |
michael@0 | 173 | public: |
michael@0 | 174 | HTMLSpinnerAccessible(nsIContent* aContent, DocAccessible* aDoc) : |
michael@0 | 175 | AccessibleWrap(aContent, aDoc) |
michael@0 | 176 | { |
michael@0 | 177 | mStateFlags |= eHasNumericValue; |
michael@0 | 178 | } |
michael@0 | 179 | |
michael@0 | 180 | // Accessible |
michael@0 | 181 | virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE; |
michael@0 | 182 | virtual void Value(nsString& aValue) MOZ_OVERRIDE; |
michael@0 | 183 | |
michael@0 | 184 | virtual double MaxValue() const MOZ_OVERRIDE; |
michael@0 | 185 | virtual double MinValue() const MOZ_OVERRIDE; |
michael@0 | 186 | virtual double CurValue() const MOZ_OVERRIDE; |
michael@0 | 187 | virtual double Step() const MOZ_OVERRIDE; |
michael@0 | 188 | virtual bool SetCurValue(double aValue) MOZ_OVERRIDE; |
michael@0 | 189 | }; |
michael@0 | 190 | |
michael@0 | 191 | |
michael@0 | 192 | /** |
michael@0 | 193 | * Used for input@type="range" element. |
michael@0 | 194 | */ |
michael@0 | 195 | class HTMLRangeAccessible : public LeafAccessible |
michael@0 | 196 | { |
michael@0 | 197 | public: |
michael@0 | 198 | HTMLRangeAccessible(nsIContent* aContent, DocAccessible* aDoc) : |
michael@0 | 199 | LeafAccessible(aContent, aDoc) |
michael@0 | 200 | { |
michael@0 | 201 | mStateFlags |= eHasNumericValue; |
michael@0 | 202 | } |
michael@0 | 203 | |
michael@0 | 204 | // Accessible |
michael@0 | 205 | virtual void Value(nsString& aValue); |
michael@0 | 206 | virtual mozilla::a11y::role NativeRole(); |
michael@0 | 207 | |
michael@0 | 208 | // Value |
michael@0 | 209 | virtual double MaxValue() const MOZ_OVERRIDE; |
michael@0 | 210 | virtual double MinValue() const MOZ_OVERRIDE; |
michael@0 | 211 | virtual double CurValue() const MOZ_OVERRIDE; |
michael@0 | 212 | virtual double Step() const MOZ_OVERRIDE; |
michael@0 | 213 | virtual bool SetCurValue(double aValue) MOZ_OVERRIDE; |
michael@0 | 214 | |
michael@0 | 215 | // Widgets |
michael@0 | 216 | virtual bool IsWidget() const; |
michael@0 | 217 | }; |
michael@0 | 218 | |
michael@0 | 219 | |
michael@0 | 220 | /** |
michael@0 | 221 | * Accessible for HTML fieldset element. |
michael@0 | 222 | */ |
michael@0 | 223 | class HTMLGroupboxAccessible : public HyperTextAccessibleWrap |
michael@0 | 224 | { |
michael@0 | 225 | public: |
michael@0 | 226 | HTMLGroupboxAccessible(nsIContent* aContent, DocAccessible* aDoc); |
michael@0 | 227 | |
michael@0 | 228 | // Accessible |
michael@0 | 229 | virtual mozilla::a11y::role NativeRole(); |
michael@0 | 230 | virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; |
michael@0 | 231 | |
michael@0 | 232 | protected: |
michael@0 | 233 | // Accessible |
michael@0 | 234 | virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE; |
michael@0 | 235 | |
michael@0 | 236 | // HTMLGroupboxAccessible |
michael@0 | 237 | nsIContent* GetLegend(); |
michael@0 | 238 | }; |
michael@0 | 239 | |
michael@0 | 240 | |
michael@0 | 241 | /** |
michael@0 | 242 | * Accessible for HTML legend element. |
michael@0 | 243 | */ |
michael@0 | 244 | class HTMLLegendAccessible : public HyperTextAccessibleWrap |
michael@0 | 245 | { |
michael@0 | 246 | public: |
michael@0 | 247 | HTMLLegendAccessible(nsIContent* aContent, DocAccessible* aDoc); |
michael@0 | 248 | |
michael@0 | 249 | // Accessible |
michael@0 | 250 | virtual mozilla::a11y::role NativeRole(); |
michael@0 | 251 | virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; |
michael@0 | 252 | }; |
michael@0 | 253 | |
michael@0 | 254 | /** |
michael@0 | 255 | * Accessible for HTML5 figure element. |
michael@0 | 256 | */ |
michael@0 | 257 | class HTMLFigureAccessible : public HyperTextAccessibleWrap |
michael@0 | 258 | { |
michael@0 | 259 | public: |
michael@0 | 260 | HTMLFigureAccessible(nsIContent* aContent, DocAccessible* aDoc); |
michael@0 | 261 | |
michael@0 | 262 | // Accessible |
michael@0 | 263 | virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE; |
michael@0 | 264 | virtual mozilla::a11y::role NativeRole(); |
michael@0 | 265 | virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; |
michael@0 | 266 | |
michael@0 | 267 | protected: |
michael@0 | 268 | // Accessible |
michael@0 | 269 | virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE; |
michael@0 | 270 | |
michael@0 | 271 | // HTMLLegendAccessible |
michael@0 | 272 | nsIContent* Caption() const; |
michael@0 | 273 | }; |
michael@0 | 274 | |
michael@0 | 275 | |
michael@0 | 276 | /** |
michael@0 | 277 | * Accessible for HTML5 figcaption element. |
michael@0 | 278 | */ |
michael@0 | 279 | class HTMLFigcaptionAccessible : public HyperTextAccessibleWrap |
michael@0 | 280 | { |
michael@0 | 281 | public: |
michael@0 | 282 | HTMLFigcaptionAccessible(nsIContent* aContent, DocAccessible* aDoc); |
michael@0 | 283 | |
michael@0 | 284 | // Accessible |
michael@0 | 285 | virtual mozilla::a11y::role NativeRole(); |
michael@0 | 286 | virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; |
michael@0 | 287 | }; |
michael@0 | 288 | |
michael@0 | 289 | } // namespace a11y |
michael@0 | 290 | } // namespace mozilla |
michael@0 | 291 | |
michael@0 | 292 | #endif |