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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp

Issue 2805493002: Boolean properties for Accessibility Object Model Phase 1 (Closed)
Patch Set: Back to previous patchset, ready to land Created 3 years, 7 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 GetDocument()->GetFrame()->Selection().FrameIsFocusedAndActive())) 452 GetDocument()->GetFrame()->Selection().FrameIsFocusedAndActive()))
453 return true; 453 return true;
454 454
455 return false; 455 return false;
456 } 456 }
457 457
458 bool AXLayoutObject::IsSelected() const { 458 bool AXLayoutObject::IsSelected() const {
459 if (!GetLayoutObject() || !GetNode()) 459 if (!GetLayoutObject() || !GetNode())
460 return false; 460 return false;
461 461
462 const AtomicString& aria_selected = GetAttribute(aria_selectedAttr); 462 if (AOMPropertyOrARIAAttributeIsTrue(AOMBooleanProperty::kSelected))
463 if (EqualIgnoringASCIICase(aria_selected, "true"))
464 return true; 463 return true;
465 464
466 AXObjectImpl* focused_object = AxObjectCache().FocusedObject(); 465 AXObjectImpl* focused_object = AxObjectCache().FocusedObject();
467 if (AriaRoleAttribute() == kListBoxOptionRole && focused_object && 466 if (AriaRoleAttribute() == kListBoxOptionRole && focused_object &&
468 focused_object->ActiveDescendant() == this) { 467 focused_object->ActiveDescendant() == this) {
469 return true; 468 return true;
470 } 469 }
471 470
472 if (IsTabItem() && IsTabItemSelected()) 471 if (IsTabItem() && IsTabItemSelected())
473 return true; 472 return true;
(...skipping 12 matching lines...) Expand all
486 485
487 if (!layout_object_) { 486 if (!layout_object_) {
488 if (ignored_reasons) 487 if (ignored_reasons)
489 ignored_reasons->push_back(IgnoredReason(kAXNotRendered)); 488 ignored_reasons->push_back(IgnoredReason(kAXNotRendered));
490 return kIgnoreObject; 489 return kIgnoreObject;
491 } 490 }
492 491
493 if (layout_object_->Style()->Visibility() != EVisibility::kVisible) { 492 if (layout_object_->Style()->Visibility() != EVisibility::kVisible) {
494 // aria-hidden is meant to override visibility as the determinant in AX 493 // aria-hidden is meant to override visibility as the determinant in AX
495 // hierarchy inclusion. 494 // hierarchy inclusion.
496 if (EqualIgnoringASCIICase(GetAttribute(aria_hiddenAttr), "false")) 495 if (AOMPropertyOrARIAAttributeIsFalse(AOMBooleanProperty::kHidden))
497 return kDefaultBehavior; 496 return kDefaultBehavior;
498 497
499 if (ignored_reasons) 498 if (ignored_reasons)
500 ignored_reasons->push_back(IgnoredReason(kAXNotVisible)); 499 ignored_reasons->push_back(IgnoredReason(kAXNotVisible));
501 return kIgnoreObject; 500 return kIgnoreObject;
502 } 501 }
503 502
504 return AXObjectImpl::DefaultObjectInclusion(ignored_reasons); 503 return AXObjectImpl::DefaultObjectInclusion(ignored_reasons);
505 } 504 }
506 505
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 GetAOMPropertyOrARIAAttribute(AOMStringProperty::kRelevant); 1373 GetAOMPropertyOrARIAAttribute(AOMStringProperty::kRelevant);
1375 1374
1376 // Default aria-relevant = "additions text". 1375 // Default aria-relevant = "additions text".
1377 if (relevant.IsEmpty()) 1376 if (relevant.IsEmpty())
1378 return default_live_region_relevant; 1377 return default_live_region_relevant;
1379 1378
1380 return relevant; 1379 return relevant;
1381 } 1380 }
1382 1381
1383 bool AXLayoutObject::LiveRegionAtomic() const { 1382 bool AXLayoutObject::LiveRegionAtomic() const {
1383 bool atomic = false;
1384 if (HasAOMPropertyOrARIAAttribute(AOMBooleanProperty::kAtomic, atomic))
1385 return atomic;
1386
1384 // ARIA roles "alert" and "status" should have an implicit aria-atomic value 1387 // ARIA roles "alert" and "status" should have an implicit aria-atomic value
1385 // of true. 1388 // of true.
1386 if (GetAttribute(aria_atomicAttr).IsEmpty() && 1389 return RoleValue() == kAlertRole || RoleValue() == kStatusRole;
1387 (RoleValue() == kAlertRole || RoleValue() == kStatusRole)) {
1388 return true;
1389 }
1390 return ElementAttributeValue(aria_atomicAttr);
1391 } 1390 }
1392 1391
1393 bool AXLayoutObject::LiveRegionBusy() const { 1392 bool AXLayoutObject::LiveRegionBusy() const {
1394 return ElementAttributeValue(aria_busyAttr); 1393 return AOMPropertyOrARIAAttributeIsTrue(AOMBooleanProperty::kBusy);
1395 } 1394 }
1396 1395
1397 // 1396 //
1398 // Hit testing. 1397 // Hit testing.
1399 // 1398 //
1400 1399
1401 AXObjectImpl* AXLayoutObject::AccessibilityHitTest( 1400 AXObjectImpl* AXLayoutObject::AccessibilityHitTest(
1402 const IntPoint& point) const { 1401 const IntPoint& point) const {
1403 if (!layout_object_ || !layout_object_->HasLayer()) 1402 if (!layout_object_ || !layout_object_->HasLayer())
1404 return nullptr; 1403 return nullptr;
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2524 2523
2525 bool AXLayoutObject::ElementAttributeValue( 2524 bool AXLayoutObject::ElementAttributeValue(
2526 const QualifiedName& attribute_name) const { 2525 const QualifiedName& attribute_name) const {
2527 if (!layout_object_) 2526 if (!layout_object_)
2528 return false; 2527 return false;
2529 2528
2530 return EqualIgnoringASCIICase(GetAttribute(attribute_name), "true"); 2529 return EqualIgnoringASCIICase(GetAttribute(attribute_name), "true");
2531 } 2530 }
2532 2531
2533 } // namespace blink 2532 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698