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

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

Issue 659563006: Add live region root to the cached properties of an AXObject. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 130
131 AXObject::AXObject() 131 AXObject::AXObject()
132 : m_id(0) 132 : m_id(0)
133 , m_haveChildren(false) 133 , m_haveChildren(false)
134 , m_role(UnknownRole) 134 , m_role(UnknownRole)
135 , m_lastKnownIsIgnoredValue(DefaultBehavior) 135 , m_lastKnownIsIgnoredValue(DefaultBehavior)
136 , m_detached(false) 136 , m_detached(false)
137 , m_lastModificationCount(-1) 137 , m_lastModificationCount(-1)
138 , m_cachedIsIgnored(false) 138 , m_cachedIsIgnored(false)
139 , m_cachedLiveRegionRoot(0)
139 { 140 {
140 } 141 }
141 142
142 AXObject::~AXObject() 143 AXObject::~AXObject()
143 { 144 {
144 ASSERT(isDetached()); 145 ASSERT(isDetached());
145 } 146 }
146 147
147 void AXObject::detach() 148 void AXObject::detach()
148 { 149 {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 257
257 void AXObject::updateCachedAttributeValuesIfNeeded() const 258 void AXObject::updateCachedAttributeValuesIfNeeded() const
258 { 259 {
259 AXObjectCacheImpl* cache = axObjectCache(); 260 AXObjectCacheImpl* cache = axObjectCache();
260 if (!cache) 261 if (!cache)
261 return; 262 return;
262 263
263 if (cache->modificationCount() == m_lastModificationCount) 264 if (cache->modificationCount() == m_lastModificationCount)
264 return; 265 return;
265 266
267 m_lastModificationCount = cache->modificationCount();
266 m_cachedIsIgnored = computeAccessibilityIsIgnored(); 268 m_cachedIsIgnored = computeAccessibilityIsIgnored();
267 m_lastModificationCount = cache->modificationCount(); 269 m_cachedLiveRegionRoot = isLiveRegion() ? this : (parentObjectIfExists() ? p arentObjectIfExists()->liveRegionRoot() : 0);
aboxhall 2014/10/27 17:29:53 I'd consider wrapping this onto a few lines to mak
dmazzoni 2014/10/27 18:08:25 Done.
268 } 270 }
269 271
270 bool AXObject::accessibilityIsIgnoredByDefault() const 272 bool AXObject::accessibilityIsIgnoredByDefault() const
271 { 273 {
272 return defaultObjectInclusion() == IgnoreObject; 274 return defaultObjectInclusion() == IgnoreObject;
273 } 275 }
274 276
275 AXObjectInclusion AXObject::accessibilityPlatformIncludesObject() const 277 AXObjectInclusion AXObject::accessibilityPlatformIncludesObject() const
276 { 278 {
277 if (isMenuListPopup() || isMenuListOption()) 279 if (isMenuListPopup() || isMenuListOption())
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 return equalIgnoringCase(getAttribute(aria_multilineAttr), "true"); 387 return equalIgnoringCase(getAttribute(aria_multilineAttr), "true");
386 } 388 }
387 389
388 bool AXObject::ariaPressedIsPresent() const 390 bool AXObject::ariaPressedIsPresent() const
389 { 391 {
390 return !getAttribute(aria_pressedAttr).isEmpty(); 392 return !getAttribute(aria_pressedAttr).isEmpty();
391 } 393 }
392 394
393 bool AXObject::supportsARIAAttributes() const 395 bool AXObject::supportsARIAAttributes() const
394 { 396 {
395 return supportsARIALiveRegion() 397 return isLiveRegion()
396 || supportsARIADragging() 398 || supportsARIADragging()
397 || supportsARIADropping() 399 || supportsARIADropping()
398 || supportsARIAFlowTo() 400 || supportsARIAFlowTo()
399 || supportsARIAOwns() 401 || supportsARIAOwns()
400 || hasAttribute(aria_labelAttr); 402 || hasAttribute(aria_labelAttr);
401 } 403 }
402 404
403 bool AXObject::supportsRangeValue() const 405 bool AXObject::supportsRangeValue() const
404 { 406 {
405 return isProgressIndicator() 407 return isProgressIndicator()
(...skipping 11 matching lines...) Expand all
417 419
418 // Add tree items as the rows. 420 // Add tree items as the rows.
419 if (obj->roleValue() == TreeItemRole) 421 if (obj->roleValue() == TreeItemRole)
420 result.append(obj); 422 result.append(obj);
421 423
422 // Now see if this item also has rows hiding inside of it. 424 // Now see if this item also has rows hiding inside of it.
423 obj->ariaTreeRows(result); 425 obj->ariaTreeRows(result);
424 } 426 }
425 } 427 }
426 428
427 bool AXObject::supportsARIALiveRegion() const 429 bool AXObject::isLiveRegion() const
428 { 430 {
429 const AtomicString& liveRegion = ariaLiveRegionStatus(); 431 const AtomicString& liveRegion = liveRegionStatus();
430 return equalIgnoringCase(liveRegion, "polite") || equalIgnoringCase(liveRegi on, "assertive"); 432 return equalIgnoringCase(liveRegion, "polite") || equalIgnoringCase(liveRegi on, "assertive");
431 } 433 }
432 434
435 const AXObject* AXObject::liveRegionRoot() const
436 {
437 updateCachedAttributeValuesIfNeeded();
438 return m_cachedLiveRegionRoot;
439 }
440
441 const AtomicString& AXObject::containerLiveRegionStatus() const
442 {
443 updateCachedAttributeValuesIfNeeded();
444 return m_cachedLiveRegionRoot ? m_cachedLiveRegionRoot->liveRegionStatus() : nullAtom;
445 }
446
447 const AtomicString& AXObject::containerLiveRegionRelevant() const
448 {
449 updateCachedAttributeValuesIfNeeded();
450 return m_cachedLiveRegionRoot ? m_cachedLiveRegionRoot->liveRegionRelevant() : nullAtom;
451 }
452
453 bool AXObject::containerLiveRegionAtomic() const
454 {
455 updateCachedAttributeValuesIfNeeded();
456 return m_cachedLiveRegionRoot ? m_cachedLiveRegionRoot->liveRegionAtomic() : false;
457 }
458
459 bool AXObject::containerLiveRegionBusy() const
460 {
461 updateCachedAttributeValuesIfNeeded();
462 return m_cachedLiveRegionRoot ? m_cachedLiveRegionRoot->liveRegionBusy() : f alse;
463 }
464
433 void AXObject::markCachedElementRectDirty() const 465 void AXObject::markCachedElementRectDirty() const
434 { 466 {
435 for (unsigned i = 0; i < m_children.size(); ++i) 467 for (unsigned i = 0; i < m_children.size(); ++i)
436 m_children[i].get()->markCachedElementRectDirty(); 468 m_children[i].get()->markCachedElementRectDirty();
437 } 469 }
438 470
439 IntPoint AXObject::clickPoint() 471 IntPoint AXObject::clickPoint()
440 { 472 {
441 LayoutRect rect = elementRect(); 473 LayoutRect rect = elementRect();
442 return roundedIntPoint(LayoutPoint(rect.x() + rect.width() / 2, rect.y() + r ect.height() / 2)); 474 return roundedIntPoint(LayoutPoint(rect.x() + rect.width() / 2, rect.y() + r ect.height() / 2));
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 return ToggleButtonRole; 942 return ToggleButtonRole;
911 if (ariaHasPopup()) 943 if (ariaHasPopup())
912 return PopUpButtonRole; 944 return PopUpButtonRole;
913 // We don't contemplate RadioButtonRole, as it depends on the input 945 // We don't contemplate RadioButtonRole, as it depends on the input
914 // type. 946 // type.
915 947
916 return ButtonRole; 948 return ButtonRole;
917 } 949 }
918 950
919 } // namespace blink 951 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698