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

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

Issue 22331005: Clean up accessibility enums for use in Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: reupload Created 7 years, 4 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 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 Node* node = m_renderer->node(); 317 Node* node = m_renderer->node();
318 AccessibilityRole ariaRole = ariaRoleAttribute(); 318 AccessibilityRole ariaRole = ariaRoleAttribute();
319 if (ariaRole != UnknownRole) 319 if (ariaRole != UnknownRole)
320 return ariaRole; 320 return ariaRole;
321 321
322 RenderBoxModelObject* cssBox = renderBoxModelObject(); 322 RenderBoxModelObject* cssBox = renderBoxModelObject();
323 323
324 if (node && node->isLink()) { 324 if (node && node->isLink()) {
325 if (cssBox && cssBox->isImage()) 325 if (cssBox && cssBox->isImage())
326 return ImageMapRole; 326 return ImageMapRole;
327 return WebCoreLinkRole; 327 return LinkRole;
328 } 328 }
329 if (cssBox && cssBox->isListItem()) 329 if (cssBox && cssBox->isListItem())
330 return ListItemRole; 330 return ListItemRole;
331 if (m_renderer->isListMarker()) 331 if (m_renderer->isListMarker())
332 return ListMarkerRole; 332 return ListMarkerRole;
333 if (node && node->hasTagName(buttonTag)) 333 if (node && node->hasTagName(buttonTag))
334 return buttonRoleType(); 334 return buttonRoleType();
335 if (node && node->hasTagName(legendTag)) 335 if (node && node->hasTagName(legendTag))
336 return LegendRole; 336 return LegendRole;
337 if (m_renderer->isText()) 337 if (m_renderer->isText())
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 if (node && isHTMLLabelElement(node)) 411 if (node && isHTMLLabelElement(node))
412 return LabelRole; 412 return LabelRole;
413 413
414 if (node && node->hasTagName(divTag)) 414 if (node && node->hasTagName(divTag))
415 return DivRole; 415 return DivRole;
416 416
417 if (node && node->hasTagName(formTag)) 417 if (node && node->hasTagName(formTag))
418 return FormRole; 418 return FormRole;
419 419
420 if (node && node->hasTagName(articleTag)) 420 if (node && node->hasTagName(articleTag))
421 return DocumentArticleRole; 421 return ArticleRole;
422 422
423 if (node && node->hasTagName(mainTag)) 423 if (node && node->hasTagName(mainTag))
424 return LandmarkMainRole; 424 return MainRole;
425 425
426 if (node && node->hasTagName(navTag)) 426 if (node && node->hasTagName(navTag))
427 return LandmarkNavigationRole; 427 return NavigationRole;
428 428
429 if (node && node->hasTagName(asideTag)) 429 if (node && node->hasTagName(asideTag))
430 return LandmarkComplementaryRole; 430 return ComplementaryRole;
431 431
432 if (node && node->hasTagName(sectionTag)) 432 if (node && node->hasTagName(sectionTag))
433 return DocumentRegionRole; 433 return RegionRole;
434 434
435 if (node && node->hasTagName(addressTag)) 435 if (node && node->hasTagName(addressTag))
436 return LandmarkContentInfoRole; 436 return ContentInfoRole;
437 437
438 // The HTML element should not be exposed as an element. That's what the Ren derView element does. 438 // The HTML element should not be exposed as an element. That's what the Ren derView element does.
439 if (node && isHTMLHtmlElement(node)) 439 if (node && isHTMLHtmlElement(node))
440 return IgnoredRole; 440 return IgnoredRole;
441 441
442 // There should only be one banner/contentInfo per page. If header/footer ar e being used within an article or section 442 // There should only be one banner/contentInfo per page. If header/footer ar e being used within an article or section
443 // then it should not be exposed as whole page's banner/contentInfo 443 // then it should not be exposed as whole page's banner/contentInfo
444 if (node && node->hasTagName(headerTag) && !isDescendantOfElementType(articl eTag) && !isDescendantOfElementType(sectionTag)) 444 if (node && node->hasTagName(headerTag) && !isDescendantOfElementType(articl eTag) && !isDescendantOfElementType(sectionTag))
445 return LandmarkBannerRole; 445 return BannerRole;
446 if (node && node->hasTagName(footerTag) && !isDescendantOfElementType(articl eTag) && !isDescendantOfElementType(sectionTag)) 446 if (node && node->hasTagName(footerTag) && !isDescendantOfElementType(articl eTag) && !isDescendantOfElementType(sectionTag))
447 return FooterRole; 447 return FooterRole;
448 448
449 if (m_renderer->isBlockFlow()) 449 if (m_renderer->isBlockFlow())
450 return GroupRole; 450 return GroupRole;
451 451
452 // If the element does not have role, but it has ARIA attributes, accessibil ity should fallback to exposing it as a group. 452 // If the element does not have role, but it has ARIA attributes, accessibil ity should fallback to exposing it as a group.
453 if (supportsARIAAttributes()) 453 if (supportsARIAAttributes())
454 return GroupRole; 454 return GroupRole;
455 455
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 case ToggleButtonRole: 960 case ToggleButtonRole:
961 return AXButtonActionVerb(); 961 return AXButtonActionVerb();
962 case TextFieldRole: 962 case TextFieldRole:
963 case TextAreaRole: 963 case TextAreaRole:
964 return AXTextFieldActionVerb(); 964 return AXTextFieldActionVerb();
965 case RadioButtonRole: 965 case RadioButtonRole:
966 return AXRadioButtonActionVerb(); 966 return AXRadioButtonActionVerb();
967 case CheckBoxRole: 967 case CheckBoxRole:
968 return isChecked() ? AXCheckedCheckBoxActionVerb() : AXUncheckedCheckBox ActionVerb(); 968 return isChecked() ? AXCheckedCheckBoxActionVerb() : AXUncheckedCheckBox ActionVerb();
969 case LinkRole: 969 case LinkRole:
970 case WebCoreLinkRole:
971 return AXLinkActionVerb(); 970 return AXLinkActionVerb();
972 default: 971 default:
973 return emptyString(); 972 return emptyString();
974 } 973 }
975 } 974 }
976 975
977 void AccessibilityRenderObject::selectedChildren(AccessibilityChildrenVector& re sult) 976 void AccessibilityRenderObject::selectedChildren(AccessibilityChildrenVector& re sult)
978 { 977 {
979 ASSERT(result.isEmpty()); 978 ASSERT(result.isEmpty());
980 979
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 const AtomicString& AccessibilityRenderObject::ariaLiveRegionStatus() const 1177 const AtomicString& AccessibilityRenderObject::ariaLiveRegionStatus() const
1179 { 1178 {
1180 DEFINE_STATIC_LOCAL(const AtomicString, liveRegionStatusAssertive, ("asserti ve", AtomicString::ConstructFromLiteral)); 1179 DEFINE_STATIC_LOCAL(const AtomicString, liveRegionStatusAssertive, ("asserti ve", AtomicString::ConstructFromLiteral));
1181 DEFINE_STATIC_LOCAL(const AtomicString, liveRegionStatusPolite, ("polite", A tomicString::ConstructFromLiteral)); 1180 DEFINE_STATIC_LOCAL(const AtomicString, liveRegionStatusPolite, ("polite", A tomicString::ConstructFromLiteral));
1182 DEFINE_STATIC_LOCAL(const AtomicString, liveRegionStatusOff, ("off", AtomicS tring::ConstructFromLiteral)); 1181 DEFINE_STATIC_LOCAL(const AtomicString, liveRegionStatusOff, ("off", AtomicS tring::ConstructFromLiteral));
1183 1182
1184 const AtomicString& liveRegionStatus = getAttribute(aria_liveAttr); 1183 const AtomicString& liveRegionStatus = getAttribute(aria_liveAttr);
1185 // These roles have implicit live region status. 1184 // These roles have implicit live region status.
1186 if (liveRegionStatus.isEmpty()) { 1185 if (liveRegionStatus.isEmpty()) {
1187 switch (roleValue()) { 1186 switch (roleValue()) {
1188 case ApplicationAlertDialogRole: 1187 case AlertDialogRole:
1189 case ApplicationAlertRole: 1188 case AlertRole:
1190 return liveRegionStatusAssertive; 1189 return liveRegionStatusAssertive;
1191 case ApplicationLogRole: 1190 case LogRole:
1192 case ApplicationStatusRole: 1191 case StatusRole:
1193 return liveRegionStatusPolite; 1192 return liveRegionStatusPolite;
1194 case ApplicationTimerRole: 1193 case TimerRole:
1195 case ApplicationMarqueeRole: 1194 case MarqueeRole:
1196 return liveRegionStatusOff; 1195 return liveRegionStatusOff;
1197 default: 1196 default:
1198 break; 1197 break;
1199 } 1198 }
1200 } 1199 }
1201 1200
1202 return liveRegionStatus; 1201 return liveRegionStatus;
1203 } 1202 }
1204 1203
1205 const AtomicString& AccessibilityRenderObject::ariaLiveRegionRelevant() const 1204 const AtomicString& AccessibilityRenderObject::ariaLiveRegionRelevant() const
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after
2514 if (label && label->renderer()) { 2513 if (label && label->renderer()) {
2515 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); 2514 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect();
2516 result.unite(labelRect); 2515 result.unite(labelRect);
2517 } 2516 }
2518 } 2517 }
2519 2518
2520 return result; 2519 return result;
2521 } 2520 }
2522 2521
2523 } // namespace WebCore 2522 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698