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

Side by Side Diff: Source/modules/accessibility/AXObject.cpp

Issue 1012663002: Aria disabled does not apply to descendant elements (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Applied suggestions Created 5 years, 9 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, 2009, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 AXObjectCacheImpl* cache = axObjectCache(); 361 AXObjectCacheImpl* cache = axObjectCache();
362 if (!cache) 362 if (!cache)
363 return; 363 return;
364 364
365 if (cache->modificationCount() == m_lastModificationCount) 365 if (cache->modificationCount() == m_lastModificationCount)
366 return; 366 return;
367 367
368 m_lastModificationCount = cache->modificationCount(); 368 m_lastModificationCount = cache->modificationCount();
369 m_cachedIsInertOrAriaHidden = computeIsInertOrAriaHidden(); 369 m_cachedIsInertOrAriaHidden = computeIsInertOrAriaHidden();
370 m_cachedIsDescendantOfBarrenParent = computeIsDescendantOfBarrenParent(); 370 m_cachedIsDescendantOfBarrenParent = computeIsDescendantOfBarrenParent();
371 m_cachedIsDescendantOfDisabledParent = computeIsDescendantOfDisabledParent() ;
371 m_cachedIsIgnored = computeAccessibilityIsIgnored(); 372 m_cachedIsIgnored = computeAccessibilityIsIgnored();
372 m_cachedLiveRegionRoot = isLiveRegion() ? 373 m_cachedLiveRegionRoot = isLiveRegion() ?
373 this : 374 this :
374 (parentObjectIfExists() ? parentObjectIfExists()->liveRegionRoot() : 0); 375 (parentObjectIfExists() ? parentObjectIfExists()->liveRegionRoot() : 0);
375 } 376 }
376 377
377 bool AXObject::accessibilityIsIgnoredByDefault() const 378 bool AXObject::accessibilityIsIgnoredByDefault() const
378 { 379 {
379 return defaultObjectInclusion() == IgnoreObject; 380 return defaultObjectInclusion() == IgnoreObject;
380 } 381 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 bool AXObject::computeIsDescendantOfBarrenParent() const 428 bool AXObject::computeIsDescendantOfBarrenParent() const
428 { 429 {
429 for (AXObject* object = parentObject(); object; object = object->parentObjec t()) { 430 for (AXObject* object = parentObject(); object; object = object->parentObjec t()) {
430 if (!object->canHaveChildren()) 431 if (!object->canHaveChildren())
431 return true; 432 return true;
432 } 433 }
433 434
434 return false; 435 return false;
435 } 436 }
436 437
438 bool AXObject::isDescendantOfDisabledParent() const
439 {
440 updateCachedAttributeValuesIfNeeded();
441 return m_cachedIsDescendantOfDisabledParent;
442 }
443
444 bool AXObject::computeIsDescendantOfDisabledParent() const
dmazzoni 2015/03/23 16:16:51 Please rewrite this to look more like computeIsIne
445 {
446 for (AXObject* parent = const_cast<AXObject*>(this); parent; parent = parent ->parentObject()) {
dmazzoni 2015/03/23 16:16:51 Why do you need the const_cast? Can you write it a
447 const AtomicString& disabled = parent->getAttribute(aria_disabledAttr);
448 if (equalIgnoringCase(disabled, "true"))
449 return true;
450 if (equalIgnoringCase(disabled, "false"))
451 return false;
452 }
453 return false;
454 }
455
437 bool AXObject::lastKnownIsIgnoredValue() 456 bool AXObject::lastKnownIsIgnoredValue()
438 { 457 {
439 if (m_lastKnownIsIgnoredValue == DefaultBehavior) 458 if (m_lastKnownIsIgnoredValue == DefaultBehavior)
440 m_lastKnownIsIgnoredValue = accessibilityIsIgnored() ? IgnoreObject : In cludeObject; 459 m_lastKnownIsIgnoredValue = accessibilityIsIgnored() ? IgnoreObject : In cludeObject;
441 460
442 return m_lastKnownIsIgnoredValue == IgnoreObject; 461 return m_lastKnownIsIgnoredValue == IgnoreObject;
443 } 462 }
444 463
445 void AXObject::setLastKnownIsIgnoredValue(bool isIgnored) 464 void AXObject::setLastKnownIsIgnoredValue(bool isIgnored)
446 { 465 {
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 } 1136 }
1118 1137
1119 const AtomicString& AXObject::roleName(AccessibilityRole role) 1138 const AtomicString& AXObject::roleName(AccessibilityRole role)
1120 { 1139 {
1121 static const Vector<AtomicString>* roleNameVector = createRoleNameVector(); 1140 static const Vector<AtomicString>* roleNameVector = createRoleNameVector();
1122 1141
1123 return roleNameVector->at(role); 1142 return roleNameVector->at(role);
1124 } 1143 }
1125 1144
1126 } // namespace blink 1145 } // namespace blink
OLDNEW
« LayoutTests/accessibility/aria-disabled.html ('K') | « Source/modules/accessibility/AXObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698