Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: Source/core/accessibility/AccessibilityObject.cpp

Issue 22331005: Clean up accessibility enums for use in Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add forgotten file back Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 typedef HashMap<String, AccessibilityRole, CaseFoldingHash> ARIARoleMap; 50 typedef HashMap<String, AccessibilityRole, CaseFoldingHash> ARIARoleMap;
51 51
52 struct RoleEntry { 52 struct RoleEntry {
53 String ariaRole; 53 String ariaRole;
54 AccessibilityRole webcoreRole; 54 AccessibilityRole webcoreRole;
55 }; 55 };
56 56
57 static ARIARoleMap* createARIARoleMap() 57 static ARIARoleMap* createARIARoleMap()
58 { 58 {
59 const RoleEntry roles[] = { 59 const RoleEntry roles[] = {
60 { "alert", ApplicationAlertRole }, 60 { "alert", AlertRole },
61 { "alertdialog", ApplicationAlertDialogRole }, 61 { "alertdialog", AlertDialogRole },
62 { "application", LandmarkApplicationRole }, 62 { "application", ApplicationRole },
63 { "article", DocumentArticleRole }, 63 { "article", ArticleRole },
64 { "banner", LandmarkBannerRole }, 64 { "banner", BannerRole },
65 { "button", ButtonRole }, 65 { "button", ButtonRole },
66 { "checkbox", CheckBoxRole }, 66 { "checkbox", CheckBoxRole },
67 { "complementary", LandmarkComplementaryRole }, 67 { "complementary", ComplementaryRole },
68 { "contentinfo", LandmarkContentInfoRole }, 68 { "contentinfo", ContentInfoRole },
69 { "dialog", ApplicationDialogRole }, 69 { "dialog", DialogRole },
70 { "directory", DirectoryRole }, 70 { "directory", DirectoryRole },
71 { "grid", TableRole }, 71 { "grid", TableRole },
72 { "gridcell", CellRole }, 72 { "gridcell", CellRole },
73 { "columnheader", ColumnHeaderRole }, 73 { "columnheader", ColumnHeaderRole },
74 { "combobox", ComboBoxRole }, 74 { "combobox", ComboBoxRole },
75 { "definition", DefinitionRole }, 75 { "definition", DefinitionRole },
76 { "document", DocumentRole }, 76 { "document", DocumentRole },
77 { "rowheader", RowHeaderRole }, 77 { "rowheader", RowHeaderRole },
78 { "group", GroupRole }, 78 { "group", GroupRole },
79 { "heading", HeadingRole }, 79 { "heading", HeadingRole },
80 { "img", ImageRole }, 80 { "img", ImageRole },
81 { "link", WebCoreLinkRole }, 81 { "link", LinkRole },
82 { "list", ListRole }, 82 { "list", ListRole },
83 { "listitem", ListItemRole }, 83 { "listitem", ListItemRole },
84 { "listbox", ListBoxRole }, 84 { "listbox", ListBoxRole },
85 { "log", ApplicationLogRole }, 85 { "log", LogRole },
86 // "option" isn't here because it may map to different roles depending o n the parent element's role 86 // "option" isn't here because it may map to different roles depending o n the parent element's role
87 { "main", LandmarkMainRole }, 87 { "main", MainRole },
88 { "marquee", ApplicationMarqueeRole }, 88 { "marquee", MarqueeRole },
89 { "math", DocumentMathRole }, 89 { "math", MathRole },
90 { "menu", MenuRole }, 90 { "menu", MenuRole },
91 { "menubar", MenuBarRole }, 91 { "menubar", MenuBarRole },
92 { "menuitem", MenuItemRole }, 92 { "menuitem", MenuItemRole },
93 { "menuitemcheckbox", MenuItemRole }, 93 { "menuitemcheckbox", MenuItemRole },
94 { "menuitemradio", MenuItemRole }, 94 { "menuitemradio", MenuItemRole },
95 { "note", DocumentNoteRole }, 95 { "note", NoteRole },
96 { "navigation", LandmarkNavigationRole }, 96 { "navigation", NavigationRole },
97 { "option", ListBoxOptionRole }, 97 { "option", ListBoxOptionRole },
98 { "presentation", PresentationalRole }, 98 { "presentation", PresentationalRole },
99 { "progressbar", ProgressIndicatorRole }, 99 { "progressbar", ProgressIndicatorRole },
100 { "radio", RadioButtonRole }, 100 { "radio", RadioButtonRole },
101 { "radiogroup", RadioGroupRole }, 101 { "radiogroup", RadioGroupRole },
102 { "region", DocumentRegionRole }, 102 { "region", RegionRole },
103 { "row", RowRole }, 103 { "row", RowRole },
104 { "scrollbar", ScrollBarRole }, 104 { "scrollbar", ScrollBarRole },
105 { "search", LandmarkSearchRole }, 105 { "search", SearchRole },
106 { "separator", SplitterRole }, 106 { "separator", SplitterRole },
107 { "slider", SliderRole }, 107 { "slider", SliderRole },
108 { "spinbutton", SpinButtonRole }, 108 { "spinbutton", SpinButtonRole },
109 { "status", ApplicationStatusRole }, 109 { "status", StatusRole },
110 { "tab", TabRole }, 110 { "tab", TabRole },
111 { "tablist", TabListRole }, 111 { "tablist", TabListRole },
112 { "tabpanel", TabPanelRole }, 112 { "tabpanel", TabPanelRole },
113 { "text", StaticTextRole }, 113 { "text", StaticTextRole },
114 { "textbox", TextAreaRole }, 114 { "textbox", TextAreaRole },
115 { "timer", ApplicationTimerRole }, 115 { "timer", TimerRole },
116 { "toolbar", ToolbarRole }, 116 { "toolbar", ToolbarRole },
117 { "tooltip", UserInterfaceTooltipRole }, 117 { "tooltip", UserInterfaceTooltipRole },
118 { "tree", TreeRole }, 118 { "tree", TreeRole },
119 { "treegrid", TreeGridRole }, 119 { "treegrid", TreeGridRole },
120 { "treeitem", TreeItemRole } 120 { "treeitem", TreeItemRole }
121 }; 121 };
122 ARIARoleMap* roleMap = new ARIARoleMap; 122 ARIARoleMap* roleMap = new ARIARoleMap;
123 123
124 for (size_t i = 0; i < WTF_ARRAY_LENGTH(roles); ++i) 124 for (size_t i = 0; i < WTF_ARRAY_LENGTH(roles); ++i)
125 roleMap->set(roles[i].ariaRole, roles[i].webcoreRole); 125 roleMap->set(roles[i].ariaRole, roles[i].webcoreRole);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 case ImageMapLinkRole: 219 case ImageMapLinkRole:
220 case LinkRole: 220 case LinkRole:
221 case ListBoxOptionRole: 221 case ListBoxOptionRole:
222 case MenuButtonRole: 222 case MenuButtonRole:
223 case PopUpButtonRole: 223 case PopUpButtonRole:
224 case RadioButtonRole: 224 case RadioButtonRole:
225 case TabRole: 225 case TabRole:
226 case TextAreaRole: 226 case TextAreaRole:
227 case TextFieldRole: 227 case TextFieldRole:
228 case ToggleButtonRole: 228 case ToggleButtonRole:
229 case WebCoreLinkRole:
230 return true; 229 return true;
231 default: 230 default:
232 return false; 231 return false;
233 } 232 }
234 } 233 }
235 234
236 bool AccessibilityObject::isExpanded() const 235 bool AccessibilityObject::isExpanded() const
237 { 236 {
238 if (equalIgnoringCase(getAttribute(aria_expandedAttr), "true")) 237 if (equalIgnoringCase(getAttribute(aria_expandedAttr), "true"))
239 return true; 238 return true;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 case ToggleButtonRole: 323 case ToggleButtonRole:
325 return AXButtonActionVerb(); 324 return AXButtonActionVerb();
326 case TextFieldRole: 325 case TextFieldRole:
327 case TextAreaRole: 326 case TextAreaRole:
328 return AXTextFieldActionVerb(); 327 return AXTextFieldActionVerb();
329 case RadioButtonRole: 328 case RadioButtonRole:
330 return AXRadioButtonActionVerb(); 329 return AXRadioButtonActionVerb();
331 case CheckBoxRole: 330 case CheckBoxRole:
332 return isChecked() ? AXCheckedCheckBoxActionVerb() : AXUncheckedCheckBox ActionVerb(); 331 return isChecked() ? AXCheckedCheckBoxActionVerb() : AXUncheckedCheckBox ActionVerb();
333 case LinkRole: 332 case LinkRole:
334 case WebCoreLinkRole:
335 return AXLinkActionVerb(); 333 return AXLinkActionVerb();
336 case PopUpButtonRole: 334 case PopUpButtonRole:
337 return AXMenuListActionVerb(); 335 return AXMenuListActionVerb();
338 case MenuListPopupRole: 336 case MenuListPopupRole:
339 return AXMenuListPopupActionVerb(); 337 return AXMenuListPopupActionVerb();
340 default: 338 default:
341 return emptyString(); 339 return emptyString();
342 } 340 }
343 } 341 }
344 #endif 342 #endif
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 990
993 for (AccessibilityObject* object = parentObject(); object; object = object-> parentObject()) { 991 for (AccessibilityObject* object = parentObject(); object; object = object-> parentObject()) {
994 if (equalIgnoringCase(object->getAttribute(aria_hiddenAttr), "true")) 992 if (equalIgnoringCase(object->getAttribute(aria_hiddenAttr), "true"))
995 return true; 993 return true;
996 } 994 }
997 995
998 return false; 996 return false;
999 } 997 }
1000 998
1001 } // namespace WebCore 999 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/accessibility/AccessibilityObject.h ('k') | Source/core/accessibility/AccessibilityRenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698