OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 if (isDescendantOfBarrenParent()) | 169 if (isDescendantOfBarrenParent()) |
170 return true; | 170 return true; |
171 | 171 |
172 // Ignore labels that are already referenced by a control's title UI element . | 172 // Ignore labels that are already referenced by a control's title UI element . |
173 AXObject* controlObject = correspondingControlForLabelElement(); | 173 AXObject* controlObject = correspondingControlForLabelElement(); |
174 if (controlObject && !controlObject->exposesTitleUIElement() && controlObjec t->isCheckboxOrRadio()) | 174 if (controlObject && !controlObject->exposesTitleUIElement() && controlObjec t->isCheckboxOrRadio()) |
175 return true; | 175 return true; |
176 | 176 |
177 return m_role == UnknownRole; | 177 return m_role == UnknownRole; |
178 } | 178 } |
179 | 179 AccessibilityRole AXNodeObject::determineAccessibilityRoleUtil() |
dmazzoni
2014/12/04 08:23:19
Need a newline before this function.
| |
180 AccessibilityRole AXNodeObject::determineAccessibilityRole() | |
181 { | 180 { |
182 if (!node()) | 181 if (!node()) |
183 return UnknownRole; | 182 return UnknownRole; |
184 | |
185 if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole) | |
186 return m_ariaRole; | |
187 | |
188 if (node()->isLink()) | 183 if (node()->isLink()) |
189 return LinkRole; | 184 return LinkRole; |
190 if (node()->isTextNode()) | |
191 return StaticTextRole; | |
192 if (isHTMLButtonElement(*node())) | 185 if (isHTMLButtonElement(*node())) |
193 return buttonRoleType(); | 186 return buttonRoleType(); |
194 if (isHTMLDetailsElement(*node())) | 187 if (isHTMLDetailsElement(*node())) |
195 return DetailsRole; | 188 return DetailsRole; |
196 if (isHTMLSummaryElement(*node())) { | 189 if (isHTMLSummaryElement(*node())) { |
197 if (node()->parentNode() && isHTMLDetailsElement(node()->parentNode())) | 190 if (node()->parentNode() && isHTMLDetailsElement(node()->parentNode())) |
198 return DisclosureTriangleRole; | 191 return DisclosureTriangleRole; |
199 return UnknownRole; | 192 return UnknownRole; |
200 } | 193 } |
201 | 194 |
202 if (isHTMLInputElement(*node())) { | 195 if (isHTMLInputElement(*node())) { |
203 HTMLInputElement& input = toHTMLInputElement(*node()); | 196 HTMLInputElement& input = toHTMLInputElement(*node()); |
204 const AtomicString& type = input.type(); | 197 const AtomicString& type = input.type(); |
198 if (input.dataList()) | |
199 return ComboBoxRole; | |
205 if (type == InputTypeNames::button) { | 200 if (type == InputTypeNames::button) { |
206 if ((node()->parentNode() && isHTMLMenuElement(node()->parentNode()) ) || (parentObject() && parentObject()->roleValue() == MenuRole)) | 201 if ((node()->parentNode() && isHTMLMenuElement(node()->parentNode()) ) || (parentObject() && parentObject()->roleValue() == MenuRole)) |
207 return MenuItemRole; | 202 return MenuItemRole; |
208 return buttonRoleType(); | 203 return buttonRoleType(); |
209 } | 204 } |
210 if (type == InputTypeNames::checkbox) { | 205 if (type == InputTypeNames::checkbox) { |
211 if ((node()->parentNode() && isHTMLMenuElement(node()->parentNode()) ) || (parentObject() && parentObject()->roleValue() == MenuRole)) | 206 if ((node()->parentNode() && isHTMLMenuElement(node()->parentNode()) ) || (parentObject() && parentObject()->roleValue() == MenuRole)) |
212 return MenuItemCheckBoxRole; | 207 return MenuItemCheckBoxRole; |
213 return CheckBoxRole; | 208 return CheckBoxRole; |
214 } | 209 } |
215 if (type == InputTypeNames::date) | 210 if (type == InputTypeNames::date) |
216 return DateRole; | 211 return DateRole; |
217 if (type == InputTypeNames::datetime | 212 if (type == InputTypeNames::datetime |
218 || type == InputTypeNames::datetime_local | 213 || type == InputTypeNames::datetime_local |
219 || type == InputTypeNames::month | 214 || type == InputTypeNames::month |
220 || type == InputTypeNames::week) | 215 || type == InputTypeNames::week) |
221 return DateTimeRole; | 216 return DateTimeRole; |
217 if (type == InputTypeNames::file) | |
218 return ButtonRole; | |
222 if (type == InputTypeNames::radio) { | 219 if (type == InputTypeNames::radio) { |
223 if ((node()->parentNode() && isHTMLMenuElement(node()->parentNode()) ) || (parentObject() && parentObject()->roleValue() == MenuRole)) | 220 if ((node()->parentNode() && isHTMLMenuElement(node()->parentNode()) ) || (parentObject() && parentObject()->roleValue() == MenuRole)) |
224 return MenuItemRadioRole; | 221 return MenuItemRadioRole; |
225 return RadioButtonRole; | 222 return RadioButtonRole; |
226 } | 223 } |
227 if (type == InputTypeNames::number) | 224 if (type == InputTypeNames::number) |
228 return SpinButtonRole; | 225 return SpinButtonRole; |
229 if (input.isTextButton()) | 226 if (input.isTextButton()) |
230 return buttonRoleType(); | 227 return buttonRoleType(); |
231 if (type == InputTypeNames::range) | 228 if (type == InputTypeNames::range) |
(...skipping 25 matching lines...) Expand all Loading... | |
257 if (isHTMLRubyElement(*node())) | 254 if (isHTMLRubyElement(*node())) |
258 return RubyRole; | 255 return RubyRole; |
259 if (isHTMLDListElement(*node())) | 256 if (isHTMLDListElement(*node())) |
260 return DescriptionListRole; | 257 return DescriptionListRole; |
261 if (node()->isElementNode() && node()->hasTagName(blockquoteTag)) | 258 if (node()->isElementNode() && node()->hasTagName(blockquoteTag)) |
262 return BlockquoteRole; | 259 return BlockquoteRole; |
263 if (node()->isElementNode() && node()->hasTagName(figcaptionTag)) | 260 if (node()->isElementNode() && node()->hasTagName(figcaptionTag)) |
264 return FigcaptionRole; | 261 return FigcaptionRole; |
265 if (node()->isElementNode() && node()->hasTagName(figureTag)) | 262 if (node()->isElementNode() && node()->hasTagName(figureTag)) |
266 return FigureRole; | 263 return FigureRole; |
267 if (node()->isElementNode() && toElement(node())->isFocusable()) | |
268 return GroupRole; | |
269 if (isHTMLAnchorElement(*node()) && isClickable()) | 264 if (isHTMLAnchorElement(*node()) && isClickable()) |
270 return LinkRole; | 265 return LinkRole; |
271 if (isHTMLIFrameElement(*node())) | 266 if (isHTMLIFrameElement(*node())) |
272 return IframeRole; | 267 return IframeRole; |
273 if (isEmbeddedObject()) | 268 if (isEmbeddedObject()) |
274 return EmbeddedObjectRole; | 269 return EmbeddedObjectRole; |
275 | |
276 return UnknownRole; | 270 return UnknownRole; |
277 } | 271 } |
278 | 272 |
273 AccessibilityRole AXNodeObject::determineAccessibilityRole() | |
274 { | |
275 if (!node()) | |
276 return UnknownRole; | |
277 | |
278 if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole) | |
279 return m_ariaRole; | |
280 if (node()->isTextNode()) | |
281 return StaticTextRole; | |
282 | |
283 AccessibilityRole role = determineAccessibilityRoleUtil(); | |
284 if (role != UnknownRole) | |
285 return role; | |
286 if (node()->isElementNode() && toElement(node())->isFocusable()) | |
287 return GroupRole; | |
288 return UnknownRole; | |
289 } | |
290 | |
279 AccessibilityRole AXNodeObject::determineAriaRoleAttribute() const | 291 AccessibilityRole AXNodeObject::determineAriaRoleAttribute() const |
280 { | 292 { |
281 const AtomicString& ariaRole = getAttribute(roleAttr); | 293 const AtomicString& ariaRole = getAttribute(roleAttr); |
282 if (ariaRole.isNull() || ariaRole.isEmpty()) | 294 if (ariaRole.isNull() || ariaRole.isEmpty()) |
283 return UnknownRole; | 295 return UnknownRole; |
284 | 296 |
285 AccessibilityRole role = ariaRoleToWebCoreRole(ariaRole); | 297 AccessibilityRole role = ariaRoleToWebCoreRole(ariaRole); |
286 | 298 |
287 // ARIA states if an item can get focus, it should not be presentational. | 299 // ARIA states if an item can get focus, it should not be presentational. |
288 if ((role == NoneRole || role == PresentationalRole) && canSetFocusAttribute ()) | 300 if ((role == NoneRole || role == PresentationalRole) && canSetFocusAttribute ()) |
(...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1820 float range = maxValueForRange() - minValueForRange(); | 1832 float range = maxValueForRange() - minValueForRange(); |
1821 float value = valueForRange(); | 1833 float value = valueForRange(); |
1822 | 1834 |
1823 value += range * (percentChange / 100); | 1835 value += range * (percentChange / 100); |
1824 setValue(String::number(value)); | 1836 setValue(String::number(value)); |
1825 | 1837 |
1826 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged, true); | 1838 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged, true); |
1827 } | 1839 } |
1828 | 1840 |
1829 } // namespace blink | 1841 } // namespace blink |
OLD | NEW |