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

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: Created 3 years, 8 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 getDocument()->frame()->selection().isFocusedAndActive())) 451 getDocument()->frame()->selection().isFocusedAndActive()))
452 return true; 452 return true;
453 453
454 return false; 454 return false;
455 } 455 }
456 456
457 bool AXLayoutObject::isSelected() const { 457 bool AXLayoutObject::isSelected() const {
458 if (!getLayoutObject() || !getNode()) 458 if (!getLayoutObject() || !getNode())
459 return false; 459 return false;
460 460
461 const AtomicString& ariaSelected = getAttribute(aria_selectedAttr); 461 if (AOMPropertyOrARIAAttributeIsTrue(AOMBooleanProperty::kSelected))
462 if (equalIgnoringASCIICase(ariaSelected, "true"))
463 return true; 462 return true;
464 463
465 AXObject* focusedObject = axObjectCache().focusedObject(); 464 AXObject* focusedObject = axObjectCache().focusedObject();
466 if (ariaRoleAttribute() == ListBoxOptionRole && focusedObject && 465 if (ariaRoleAttribute() == ListBoxOptionRole && focusedObject &&
467 focusedObject->activeDescendant() == this) { 466 focusedObject->activeDescendant() == this) {
468 return true; 467 return true;
469 } 468 }
470 469
471 if (isTabItem() && isTabItemSelected()) 470 if (isTabItem() && isTabItemSelected())
472 return true; 471 return true;
(...skipping 12 matching lines...) Expand all
485 484
486 if (!m_layoutObject) { 485 if (!m_layoutObject) {
487 if (ignoredReasons) 486 if (ignoredReasons)
488 ignoredReasons->push_back(IgnoredReason(AXNotRendered)); 487 ignoredReasons->push_back(IgnoredReason(AXNotRendered));
489 return IgnoreObject; 488 return IgnoreObject;
490 } 489 }
491 490
492 if (m_layoutObject->style()->visibility() != EVisibility::kVisible) { 491 if (m_layoutObject->style()->visibility() != EVisibility::kVisible) {
493 // aria-hidden is meant to override visibility as the determinant in AX 492 // aria-hidden is meant to override visibility as the determinant in AX
494 // hierarchy inclusion. 493 // hierarchy inclusion.
495 if (equalIgnoringASCIICase(getAttribute(aria_hiddenAttr), "false")) 494 if (AOMPropertyOrARIAAttributeIsFalse(AOMBooleanProperty::kHidden))
496 return DefaultBehavior; 495 return DefaultBehavior;
497 496
498 if (ignoredReasons) 497 if (ignoredReasons)
499 ignoredReasons->push_back(IgnoredReason(AXNotVisible)); 498 ignoredReasons->push_back(IgnoredReason(AXNotVisible));
500 return IgnoreObject; 499 return IgnoreObject;
501 } 500 }
502 501
503 return AXObject::defaultObjectInclusion(ignoredReasons); 502 return AXObject::defaultObjectInclusion(ignoredReasons);
504 } 503 }
505 504
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 getAOMPropertyOrARIAAttribute(AOMStringProperty::kRelevant); 1355 getAOMPropertyOrARIAAttribute(AOMStringProperty::kRelevant);
1357 1356
1358 // Default aria-relevant = "additions text". 1357 // Default aria-relevant = "additions text".
1359 if (relevant.isEmpty()) 1358 if (relevant.isEmpty())
1360 return defaultLiveRegionRelevant; 1359 return defaultLiveRegionRelevant;
1361 1360
1362 return relevant; 1361 return relevant;
1363 } 1362 }
1364 1363
1365 bool AXLayoutObject::liveRegionAtomic() const { 1364 bool AXLayoutObject::liveRegionAtomic() const {
1365 bool atomic = false;
1366 if (getAOMPropertyOrARIAAttribute(AOMBooleanProperty::kAtomic, atomic))
1367 return atomic;
1368
1366 // ARIA roles "alert" and "status" should have an implicit aria-atomic value 1369 // ARIA roles "alert" and "status" should have an implicit aria-atomic value
1367 // of true. 1370 // of true.
1368 if (getAttribute(aria_atomicAttr).isEmpty() && 1371 return roleValue() == AlertRole || roleValue() == StatusRole;
1369 (roleValue() == AlertRole || roleValue() == StatusRole)) {
1370 return true;
1371 }
1372 return elementAttributeValue(aria_atomicAttr);
1373 } 1372 }
1374 1373
1375 bool AXLayoutObject::liveRegionBusy() const { 1374 bool AXLayoutObject::liveRegionBusy() const {
1376 return elementAttributeValue(aria_busyAttr); 1375 return AOMPropertyOrARIAAttributeIsTrue(AOMBooleanProperty::kBusy);
1377 } 1376 }
1378 1377
1379 // 1378 //
1380 // Hit testing. 1379 // Hit testing.
1381 // 1380 //
1382 1381
1383 AXObject* AXLayoutObject::accessibilityHitTest(const IntPoint& point) const { 1382 AXObject* AXLayoutObject::accessibilityHitTest(const IntPoint& point) const {
1384 if (!m_layoutObject || !m_layoutObject->hasLayer()) 1383 if (!m_layoutObject || !m_layoutObject->hasLayer())
1385 return nullptr; 1384 return nullptr;
1386 1385
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2497 2496
2498 bool AXLayoutObject::elementAttributeValue( 2497 bool AXLayoutObject::elementAttributeValue(
2499 const QualifiedName& attributeName) const { 2498 const QualifiedName& attributeName) const {
2500 if (!m_layoutObject) 2499 if (!m_layoutObject)
2501 return false; 2500 return false;
2502 2501
2503 return equalIgnoringASCIICase(getAttribute(attributeName), "true"); 2502 return equalIgnoringASCIICase(getAttribute(attributeName), "true");
2504 } 2503 }
2505 2504
2506 } // namespace blink 2505 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698