OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2011 Apple 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 { "option", ListBoxOptionRole }, | 100 { "option", ListBoxOptionRole }, |
101 { "presentation", PresentationalRole }, | 101 { "presentation", PresentationalRole }, |
102 { "progressbar", ProgressIndicatorRole }, | 102 { "progressbar", ProgressIndicatorRole }, |
103 { "radio", RadioButtonRole }, | 103 { "radio", RadioButtonRole }, |
104 { "radiogroup", RadioGroupRole }, | 104 { "radiogroup", RadioGroupRole }, |
105 { "region", RegionRole }, | 105 { "region", RegionRole }, |
106 { "row", RowRole }, | 106 { "row", RowRole }, |
107 { "rowheader", RowHeaderRole }, | 107 { "rowheader", RowHeaderRole }, |
108 { "scrollbar", ScrollBarRole }, | 108 { "scrollbar", ScrollBarRole }, |
109 { "search", SearchRole }, | 109 { "search", SearchRole }, |
| 110 { "searchbox", SearchBoxRole }, |
110 { "separator", SplitterRole }, | 111 { "separator", SplitterRole }, |
111 { "slider", SliderRole }, | 112 { "slider", SliderRole }, |
112 { "spinbutton", SpinButtonRole }, | 113 { "spinbutton", SpinButtonRole }, |
113 { "status", StatusRole }, | 114 { "status", StatusRole }, |
| 115 { "switch", SwitchRole }, |
114 { "tab", TabRole }, | 116 { "tab", TabRole }, |
115 { "tablist", TabListRole }, | 117 { "tablist", TabListRole }, |
116 { "tabpanel", TabPanelRole }, | 118 { "tabpanel", TabPanelRole }, |
117 { "text", StaticTextRole }, | 119 { "text", StaticTextRole }, |
118 { "textbox", TextAreaRole }, | 120 { "textbox", TextAreaRole }, |
119 { "timer", TimerRole }, | 121 { "timer", TimerRole }, |
120 { "toolbar", ToolbarRole }, | 122 { "toolbar", ToolbarRole }, |
121 { "tooltip", UserInterfaceTooltipRole }, | 123 { "tooltip", UserInterfaceTooltipRole }, |
122 { "tree", TreeRole }, | 124 { "tree", TreeRole }, |
123 { "treegrid", TreeGridRole }, | 125 { "treegrid", TreeGridRole }, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 m_detached = true; | 255 m_detached = true; |
254 } | 256 } |
255 | 257 |
256 bool AXObject::isDetached() const | 258 bool AXObject::isDetached() const |
257 { | 259 { |
258 return m_detached; | 260 return m_detached; |
259 } | 261 } |
260 | 262 |
261 bool AXObject::isARIATextControl() const | 263 bool AXObject::isARIATextControl() const |
262 { | 264 { |
263 return ariaRoleAttribute() == TextAreaRole || ariaRoleAttribute() == TextFie
ldRole; | 265 return ariaRoleAttribute() == TextAreaRole || ariaRoleAttribute() == TextFie
ldRole || ariaRoleAttribute() == SearchBoxRole; |
264 } | 266 } |
265 | 267 |
266 bool AXObject::isButton() const | 268 bool AXObject::isButton() const |
267 { | 269 { |
268 AccessibilityRole role = roleValue(); | 270 AccessibilityRole role = roleValue(); |
269 | 271 |
270 return role == ButtonRole || role == PopUpButtonRole || role == ToggleButton
Role; | 272 return role == ButtonRole || role == PopUpButtonRole || role == ToggleButton
Role; |
271 } | 273 } |
272 | 274 |
273 bool AXObject::isLandmarkRelated() const | 275 bool AXObject::isLandmarkRelated() const |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 315 |
314 return isPasswordField(); | 316 return isPasswordField(); |
315 } | 317 } |
316 | 318 |
317 bool AXObject::isTextControl() const | 319 bool AXObject::isTextControl() const |
318 { | 320 { |
319 switch (roleValue()) { | 321 switch (roleValue()) { |
320 case TextAreaRole: | 322 case TextAreaRole: |
321 case TextFieldRole: | 323 case TextFieldRole: |
322 case ComboBoxRole: | 324 case ComboBoxRole: |
| 325 case SearchBoxRole: |
323 return true; | 326 return true; |
324 default: | 327 default: |
325 return false; | 328 return false; |
326 } | 329 } |
327 } | 330 } |
328 | 331 |
329 bool AXObject::isClickable() const | 332 bool AXObject::isClickable() const |
330 { | 333 { |
331 switch (roleValue()) { | 334 switch (roleValue()) { |
332 case ButtonRole: | 335 case ButtonRole: |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 switch (roleValue()) { | 478 switch (roleValue()) { |
476 case ButtonRole: | 479 case ButtonRole: |
477 case ToggleButtonRole: | 480 case ToggleButtonRole: |
478 return queryString(WebLocalizedString::AXButtonActionVerb); | 481 return queryString(WebLocalizedString::AXButtonActionVerb); |
479 case TextFieldRole: | 482 case TextFieldRole: |
480 case TextAreaRole: | 483 case TextAreaRole: |
481 return queryString(WebLocalizedString::AXTextFieldActionVerb); | 484 return queryString(WebLocalizedString::AXTextFieldActionVerb); |
482 case RadioButtonRole: | 485 case RadioButtonRole: |
483 return queryString(WebLocalizedString::AXRadioButtonActionVerb); | 486 return queryString(WebLocalizedString::AXRadioButtonActionVerb); |
484 case CheckBoxRole: | 487 case CheckBoxRole: |
| 488 case SwitchRole: |
485 return queryString(isChecked() ? WebLocalizedString::AXCheckedCheckBoxAc
tionVerb : WebLocalizedString::AXUncheckedCheckBoxActionVerb); | 489 return queryString(isChecked() ? WebLocalizedString::AXCheckedCheckBoxAc
tionVerb : WebLocalizedString::AXUncheckedCheckBoxActionVerb); |
486 case LinkRole: | 490 case LinkRole: |
487 return queryString(WebLocalizedString::AXLinkActionVerb); | 491 return queryString(WebLocalizedString::AXLinkActionVerb); |
488 case PopUpButtonRole: | 492 case PopUpButtonRole: |
489 // FIXME: Implement. | 493 // FIXME: Implement. |
490 return String(); | 494 return String(); |
491 case MenuListPopupRole: | 495 case MenuListPopupRole: |
492 // FIXME: Implement. | 496 // FIXME: Implement. |
493 return String(); | 497 return String(); |
494 default: | 498 default: |
495 return emptyString(); | 499 return emptyString(); |
496 } | 500 } |
497 } | 501 } |
498 | 502 |
499 AccessibilityButtonState AXObject::checkboxOrRadioValue() const | 503 AccessibilityButtonState AXObject::checkboxOrRadioValue() const |
500 { | 504 { |
501 // If this is a real checkbox or radio button, AXLayoutObject will handle. | 505 // If this is a real checkbox or radio button, AXLayoutObject will handle. |
502 // If it's an ARIA checkbox or radio, the aria-checked attribute should be u
sed. | 506 // If it's an ARIA checkbox or radio, the aria-checked attribute should be u
sed. |
503 | 507 |
504 const AtomicString& result = getAttribute(aria_checkedAttr); | 508 const AtomicString& result = getAttribute(aria_checkedAttr); |
505 if (equalIgnoringCase(result, "true")) | 509 if (equalIgnoringCase(result, "true")) |
506 return ButtonStateOn; | 510 return ButtonStateOn; |
507 if (equalIgnoringCase(result, "mixed")) { | 511 if (equalIgnoringCase(result, "mixed")) { |
508 AccessibilityRole role = ariaRoleAttribute(); | 512 AccessibilityRole role = ariaRoleAttribute(); |
509 if (role == RadioButtonRole || role == MenuItemRadioRole) | 513 if (role == RadioButtonRole || role == MenuItemRadioRole || role == Swit
chRole) |
510 return ButtonStateOff; | 514 return ButtonStateOff; |
511 return ButtonStateMixed; | 515 return ButtonStateMixed; |
512 } | 516 } |
513 | 517 |
514 return ButtonStateOff; | 518 return ButtonStateOff; |
515 } | 519 } |
516 | 520 |
517 bool AXObject::ariaIsMultiline() const | 521 bool AXObject::ariaIsMultiline() const |
518 { | 522 { |
519 return equalIgnoringCase(getAttribute(aria_multilineAttr), "true"); | 523 return equalIgnoringCase(getAttribute(aria_multilineAttr), "true"); |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 } | 1035 } |
1032 | 1036 |
1033 bool AXObject::isARIAControl(AccessibilityRole ariaRole) | 1037 bool AXObject::isARIAControl(AccessibilityRole ariaRole) |
1034 { | 1038 { |
1035 return isARIAInput(ariaRole) || ariaRole == TextAreaRole || ariaRole == Butt
onRole | 1039 return isARIAInput(ariaRole) || ariaRole == TextAreaRole || ariaRole == Butt
onRole |
1036 || ariaRole == ComboBoxRole || ariaRole == SliderRole; | 1040 || ariaRole == ComboBoxRole || ariaRole == SliderRole; |
1037 } | 1041 } |
1038 | 1042 |
1039 bool AXObject::isARIAInput(AccessibilityRole ariaRole) | 1043 bool AXObject::isARIAInput(AccessibilityRole ariaRole) |
1040 { | 1044 { |
1041 return ariaRole == RadioButtonRole || ariaRole == CheckBoxRole || ariaRole =
= TextFieldRole; | 1045 return ariaRole == RadioButtonRole || ariaRole == CheckBoxRole || ariaRole =
= TextFieldRole || ariaRole == SwitchRole || ariaRole == SearchBoxRole; |
1042 } | 1046 } |
1043 | 1047 |
1044 AccessibilityRole AXObject::ariaRoleToWebCoreRole(const String& value) | 1048 AccessibilityRole AXObject::ariaRoleToWebCoreRole(const String& value) |
1045 { | 1049 { |
1046 ASSERT(!value.isEmpty()); | 1050 ASSERT(!value.isEmpty()); |
1047 | 1051 |
1048 static const ARIARoleMap* roleMap = createARIARoleMap(); | 1052 static const ARIARoleMap* roleMap = createARIARoleMap(); |
1049 | 1053 |
1050 Vector<String> roleVector; | 1054 Vector<String> roleVector; |
1051 value.split(' ', roleVector); | 1055 value.split(' ', roleVector); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 } | 1121 } |
1118 | 1122 |
1119 const AtomicString& AXObject::roleName(AccessibilityRole role) | 1123 const AtomicString& AXObject::roleName(AccessibilityRole role) |
1120 { | 1124 { |
1121 static const Vector<AtomicString>* roleNameVector = createRoleNameVector(); | 1125 static const Vector<AtomicString>* roleNameVector = createRoleNameVector(); |
1122 | 1126 |
1123 return roleNameVector->at(role); | 1127 return roleNameVector->at(role); |
1124 } | 1128 } |
1125 | 1129 |
1126 } // namespace blink | 1130 } // namespace blink |
OLD | NEW |