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

Side by Side Diff: Source/core/accessibility/AccessibilityNodeObject.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) 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 if (!node()) 168 if (!node())
169 return UnknownRole; 169 return UnknownRole;
170 170
171 m_ariaRole = determineAriaRoleAttribute(); 171 m_ariaRole = determineAriaRoleAttribute();
172 172
173 AccessibilityRole ariaRole = ariaRoleAttribute(); 173 AccessibilityRole ariaRole = ariaRoleAttribute();
174 if (ariaRole != UnknownRole) 174 if (ariaRole != UnknownRole)
175 return ariaRole; 175 return ariaRole;
176 176
177 if (node()->isLink()) 177 if (node()->isLink())
178 return WebCoreLinkRole; 178 return LinkRole;
179 if (node()->isTextNode()) 179 if (node()->isTextNode())
180 return StaticTextRole; 180 return StaticTextRole;
181 if (node()->hasTagName(buttonTag)) 181 if (node()->hasTagName(buttonTag))
182 return buttonRoleType(); 182 return buttonRoleType();
183 if (node()->hasTagName(inputTag)) { 183 if (node()->hasTagName(inputTag)) {
184 HTMLInputElement* input = toHTMLInputElement(node()); 184 HTMLInputElement* input = toHTMLInputElement(node());
185 if (input->isCheckbox()) 185 if (input->isCheckbox())
186 return CheckBoxRole; 186 return CheckBoxRole;
187 if (input->isRadioButton()) 187 if (input->isRadioButton())
188 return RadioButtonRole; 188 return RadioButtonRole;
(...skipping 18 matching lines...) Expand all
207 return HeadingRole; 207 return HeadingRole;
208 if (node()->hasTagName(divTag)) 208 if (node()->hasTagName(divTag))
209 return DivRole; 209 return DivRole;
210 if (node()->hasTagName(pTag)) 210 if (node()->hasTagName(pTag))
211 return ParagraphRole; 211 return ParagraphRole;
212 if (isHTMLLabelElement(node())) 212 if (isHTMLLabelElement(node()))
213 return LabelRole; 213 return LabelRole;
214 if (node()->isElementNode() && toElement(node())->isFocusable()) 214 if (node()->isElementNode() && toElement(node())->isFocusable())
215 return GroupRole; 215 return GroupRole;
216 if (node()->hasTagName(aTag) && isClickable()) 216 if (node()->hasTagName(aTag) && isClickable())
217 return WebCoreLinkRole; 217 return LinkRole;
218 218
219 return UnknownRole; 219 return UnknownRole;
220 } 220 }
221 221
222 AccessibilityRole AccessibilityNodeObject::determineAriaRoleAttribute() const 222 AccessibilityRole AccessibilityNodeObject::determineAriaRoleAttribute() const
223 { 223 {
224 const AtomicString& ariaRole = getAttribute(roleAttr); 224 const AtomicString& ariaRole = getAttribute(roleAttr);
225 if (ariaRole.isNull() || ariaRole.isEmpty()) 225 if (ariaRole.isNull() || ariaRole.isEmpty())
226 return UnknownRole; 226 return UnknownRole;
227 227
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 return false; 506 return false;
507 507
508 if (roleValue() == ButtonRole && node->hasTagName(inputTag)) 508 if (roleValue() == ButtonRole && node->hasTagName(inputTag))
509 return toHTMLInputElement(node)->isImageButton(); 509 return toHTMLInputElement(node)->isImageButton();
510 510
511 return false; 511 return false;
512 } 512 }
513 513
514 bool AccessibilityNodeObject::isLink() const 514 bool AccessibilityNodeObject::isLink() const
515 { 515 {
516 return roleValue() == WebCoreLinkRole; 516 return roleValue() == LinkRole;
517 } 517 }
518 518
519 bool AccessibilityNodeObject::isMenu() const 519 bool AccessibilityNodeObject::isMenu() const
520 { 520 {
521 return roleValue() == MenuRole; 521 return roleValue() == MenuRole;
522 } 522 }
523 523
524 bool AccessibilityNodeObject::isMenuButton() const 524 bool AccessibilityNodeObject::isMenuButton() const
525 { 525 {
526 return roleValue() == MenuButtonRole; 526 return roleValue() == MenuButtonRole;
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1673 useTextUnderElement = true; 1673 useTextUnderElement = true;
1674 1674
1675 if (useTextUnderElement) { 1675 if (useTextUnderElement) {
1676 String text = textUnderElement(); 1676 String text = textUnderElement();
1677 if (!text.isEmpty()) 1677 if (!text.isEmpty())
1678 textOrder.append(AccessibilityText(text, ChildrenText)); 1678 textOrder.append(AccessibilityText(text, ChildrenText));
1679 } 1679 }
1680 } 1680 }
1681 1681
1682 } // namespace WebCore 1682 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/accessibility/AccessibilityImageMapLink.cpp ('k') | Source/core/accessibility/AccessibilityObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698