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

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: 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 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 Node* node = m_renderer->node(); 319 Node* node = m_renderer->node();
320 AccessibilityRole ariaRole = ariaRoleAttribute(); 320 AccessibilityRole ariaRole = ariaRoleAttribute();
321 if (ariaRole != UnknownRole) 321 if (ariaRole != UnknownRole)
322 return ariaRole; 322 return ariaRole;
323 323
324 RenderBoxModelObject* cssBox = renderBoxModelObject(); 324 RenderBoxModelObject* cssBox = renderBoxModelObject();
325 325
326 if (node && node->isLink()) { 326 if (node && node->isLink()) {
327 if (cssBox && cssBox->isImage()) 327 if (cssBox && cssBox->isImage())
328 return ImageMapRole; 328 return ImageMapRole;
329 return WebCoreLinkRole; 329 return LinkRole;
330 } 330 }
331 if (cssBox && cssBox->isListItem()) 331 if (cssBox && cssBox->isListItem())
332 return ListItemRole; 332 return ListItemRole;
333 if (m_renderer->isListMarker()) 333 if (m_renderer->isListMarker())
334 return ListMarkerRole; 334 return ListMarkerRole;
335 if (node && node->hasTagName(buttonTag)) 335 if (node && node->hasTagName(buttonTag))
336 return buttonRoleType(); 336 return buttonRoleType();
337 if (node && node->hasTagName(legendTag)) 337 if (node && node->hasTagName(legendTag))
338 return LegendRole; 338 return LegendRole;
339 if (m_renderer->isText()) 339 if (m_renderer->isText())
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 if (node && isHTMLLabelElement(node)) 413 if (node && isHTMLLabelElement(node))
414 return LabelRole; 414 return LabelRole;
415 415
416 if (node && node->hasTagName(divTag)) 416 if (node && node->hasTagName(divTag))
417 return DivRole; 417 return DivRole;
418 418
419 if (node && node->hasTagName(formTag)) 419 if (node && node->hasTagName(formTag))
420 return FormRole; 420 return FormRole;
421 421
422 if (node && node->hasTagName(articleTag)) 422 if (node && node->hasTagName(articleTag))
423 return DocumentArticleRole; 423 return ArticleRole;
424 424
425 if (node && node->hasTagName(mainTag)) 425 if (node && node->hasTagName(mainTag))
426 return LandmarkMainRole; 426 return MainRole;
427 427
428 if (node && node->hasTagName(navTag)) 428 if (node && node->hasTagName(navTag))
429 return LandmarkNavigationRole; 429 return NavigationRole;
430 430
431 if (node && node->hasTagName(asideTag)) 431 if (node && node->hasTagName(asideTag))
432 return LandmarkComplementaryRole; 432 return ComplementaryRole;
433 433
434 if (node && node->hasTagName(sectionTag)) 434 if (node && node->hasTagName(sectionTag))
435 return DocumentRegionRole; 435 return RegionRole;
436 436
437 if (node && node->hasTagName(addressTag)) 437 if (node && node->hasTagName(addressTag))
438 return LandmarkContentInfoRole; 438 return ContentInfoRole;
439 439
440 // The HTML element should not be exposed as an element. That's what the Ren derView element does. 440 // The HTML element should not be exposed as an element. That's what the Ren derView element does.
441 if (node && isHTMLHtmlElement(node)) 441 if (node && isHTMLHtmlElement(node))
442 return IgnoredRole; 442 return IgnoredRole;
443 443
444 // There should only be one banner/contentInfo per page. If header/footer ar e being used within an article or section 444 // There should only be one banner/contentInfo per page. If header/footer ar e being used within an article or section
445 // then it should not be exposed as whole page's banner/contentInfo 445 // then it should not be exposed as whole page's banner/contentInfo
446 if (node && node->hasTagName(headerTag) && !isDescendantOfElementType(articl eTag) && !isDescendantOfElementType(sectionTag)) 446 if (node && node->hasTagName(headerTag) && !isDescendantOfElementType(articl eTag) && !isDescendantOfElementType(sectionTag))
447 return LandmarkBannerRole; 447 return BannerRole;
448 if (node && node->hasTagName(footerTag) && !isDescendantOfElementType(articl eTag) && !isDescendantOfElementType(sectionTag)) 448 if (node && node->hasTagName(footerTag) && !isDescendantOfElementType(articl eTag) && !isDescendantOfElementType(sectionTag))
449 return FooterRole; 449 return FooterRole;
450 450
451 if (node && node->hasTagName(aTag) && isClickable()) 451 if (node && node->hasTagName(aTag) && isClickable())
452 return WebCoreLinkRole; 452 return LinkRole;
453 453
454 if (m_renderer->isBlockFlow()) 454 if (m_renderer->isBlockFlow())
455 return GroupRole; 455 return GroupRole;
456 456
457 // If the element does not have role, but it has ARIA attributes, accessibil ity should fallback to exposing it as a group. 457 // If the element does not have role, but it has ARIA attributes, accessibil ity should fallback to exposing it as a group.
458 if (supportsARIAAttributes()) 458 if (supportsARIAAttributes())
459 return GroupRole; 459 return GroupRole;
460 460
461 return UnknownRole; 461 return UnknownRole;
462 } 462 }
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 case ToggleButtonRole: 965 case ToggleButtonRole:
966 return AXButtonActionVerb(); 966 return AXButtonActionVerb();
967 case TextFieldRole: 967 case TextFieldRole:
968 case TextAreaRole: 968 case TextAreaRole:
969 return AXTextFieldActionVerb(); 969 return AXTextFieldActionVerb();
970 case RadioButtonRole: 970 case RadioButtonRole:
971 return AXRadioButtonActionVerb(); 971 return AXRadioButtonActionVerb();
972 case CheckBoxRole: 972 case CheckBoxRole:
973 return isChecked() ? AXCheckedCheckBoxActionVerb() : AXUncheckedCheckBox ActionVerb(); 973 return isChecked() ? AXCheckedCheckBoxActionVerb() : AXUncheckedCheckBox ActionVerb();
974 case LinkRole: 974 case LinkRole:
975 case WebCoreLinkRole:
976 return AXLinkActionVerb(); 975 return AXLinkActionVerb();
977 default: 976 default:
978 return emptyString(); 977 return emptyString();
979 } 978 }
980 } 979 }
981 980
982 void AccessibilityRenderObject::selectedChildren(AccessibilityChildrenVector& re sult) 981 void AccessibilityRenderObject::selectedChildren(AccessibilityChildrenVector& re sult)
983 { 982 {
984 ASSERT(result.isEmpty()); 983 ASSERT(result.isEmpty());
985 984
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 const AtomicString& AccessibilityRenderObject::ariaLiveRegionStatus() const 1182 const AtomicString& AccessibilityRenderObject::ariaLiveRegionStatus() const
1184 { 1183 {
1185 DEFINE_STATIC_LOCAL(const AtomicString, liveRegionStatusAssertive, ("asserti ve", AtomicString::ConstructFromLiteral)); 1184 DEFINE_STATIC_LOCAL(const AtomicString, liveRegionStatusAssertive, ("asserti ve", AtomicString::ConstructFromLiteral));
1186 DEFINE_STATIC_LOCAL(const AtomicString, liveRegionStatusPolite, ("polite", A tomicString::ConstructFromLiteral)); 1185 DEFINE_STATIC_LOCAL(const AtomicString, liveRegionStatusPolite, ("polite", A tomicString::ConstructFromLiteral));
1187 DEFINE_STATIC_LOCAL(const AtomicString, liveRegionStatusOff, ("off", AtomicS tring::ConstructFromLiteral)); 1186 DEFINE_STATIC_LOCAL(const AtomicString, liveRegionStatusOff, ("off", AtomicS tring::ConstructFromLiteral));
1188 1187
1189 const AtomicString& liveRegionStatus = getAttribute(aria_liveAttr); 1188 const AtomicString& liveRegionStatus = getAttribute(aria_liveAttr);
1190 // These roles have implicit live region status. 1189 // These roles have implicit live region status.
1191 if (liveRegionStatus.isEmpty()) { 1190 if (liveRegionStatus.isEmpty()) {
1192 switch (roleValue()) { 1191 switch (roleValue()) {
1193 case ApplicationAlertDialogRole: 1192 case AlertDialogRole:
1194 case ApplicationAlertRole: 1193 case AlertRole:
1195 return liveRegionStatusAssertive; 1194 return liveRegionStatusAssertive;
1196 case ApplicationLogRole: 1195 case LogRole:
1197 case ApplicationStatusRole: 1196 case StatusRole:
1198 return liveRegionStatusPolite; 1197 return liveRegionStatusPolite;
1199 case ApplicationTimerRole: 1198 case TimerRole:
1200 case ApplicationMarqueeRole: 1199 case MarqueeRole:
1201 return liveRegionStatusOff; 1200 return liveRegionStatusOff;
1202 default: 1201 default:
1203 break; 1202 break;
1204 } 1203 }
1205 } 1204 }
1206 1205
1207 return liveRegionStatus; 1206 return liveRegionStatus;
1208 } 1207 }
1209 1208
1210 const AtomicString& AccessibilityRenderObject::ariaLiveRegionRelevant() const 1209 const AtomicString& AccessibilityRenderObject::ariaLiveRegionRelevant() const
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
2517 if (label && label->renderer()) { 2516 if (label && label->renderer()) {
2518 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); 2517 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect();
2519 result.unite(labelRect); 2518 result.unite(labelRect);
2520 } 2519 }
2521 } 2520 }
2522 2521
2523 return result; 2522 return result;
2524 } 2523 }
2525 2524
2526 } // namespace WebCore 2525 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/accessibility/AccessibilityObject.cpp ('k') | Source/core/editing/AppendNodeCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698