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

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

Issue 1076453004: Show reasons why nodes are ignored in accessibility sidebar (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add a catch-all return to ignoredReasonName Created 5 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, 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 11 matching lines...) Expand all
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #include "config.h" 29 #include "config.h"
30 #include "modules/accessibility/AXObject.h" 30 #include "modules/accessibility/AXObject.h"
31 31
32 #include "core/dom/NodeTraversal.h"
33 #include "core/editing/VisibleUnits.h" 32 #include "core/editing/VisibleUnits.h"
34 #include "core/editing/htmlediting.h" 33 #include "core/editing/htmlediting.h"
35 #include "core/frame/LocalFrame.h" 34 #include "core/frame/LocalFrame.h"
36 #include "core/frame/Settings.h" 35 #include "core/frame/Settings.h"
36 #include "core/html/HTMLDialogElement.h"
37 #include "core/html/HTMLFrameOwnerElement.h"
37 #include "core/layout/LayoutListItem.h" 38 #include "core/layout/LayoutListItem.h"
38 #include "core/layout/LayoutTheme.h" 39 #include "core/layout/LayoutTheme.h"
39 #include "core/layout/LayoutView.h" 40 #include "core/layout/LayoutView.h"
40 #include "modules/accessibility/AXObjectCacheImpl.h" 41 #include "modules/accessibility/AXObjectCacheImpl.h"
41 #include "platform/UserGestureIndicator.h" 42 #include "platform/UserGestureIndicator.h"
42 #include "platform/text/PlatformLocale.h" 43 #include "platform/text/PlatformLocale.h"
43 #include "wtf/HashSet.h" 44 #include "wtf/HashSet.h"
44 #include "wtf/StdLibExtras.h" 45 #include "wtf/StdLibExtras.h"
45 #include "wtf/text/WTFString.h" 46 #include "wtf/text/WTFString.h"
46 47
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 "aria-controls", 353 "aria-controls",
353 "aria-disabled", // If it's disabled, it can be made interactive. 354 "aria-disabled", // If it's disabled, it can be made interactive.
354 "aria-expanded", 355 "aria-expanded",
355 "aria-haspopup", 356 "aria-haspopup",
356 "aria-multiselectable", 357 "aria-multiselectable",
357 "aria-pressed", 358 "aria-pressed",
358 "aria-required", 359 "aria-required",
359 "aria-selected" 360 "aria-selected"
360 }; 361 };
361 362
363
364 HTMLDialogElement* getActiveDialogElement(Node* node)
365 {
366 return node->document().activeModalDialog();
367 }
368
362 } // namespace 369 } // namespace
363 370
364 AXObject::AXObject(AXObjectCacheImpl* axObjectCache) 371 AXObject::AXObject(AXObjectCacheImpl* axObjectCache)
365 : m_id(0) 372 : m_id(0)
366 , m_haveChildren(false) 373 , m_haveChildren(false)
367 , m_role(UnknownRole) 374 , m_role(UnknownRole)
368 , m_lastKnownIsIgnoredValue(DefaultBehavior) 375 , m_lastKnownIsIgnoredValue(DefaultBehavior)
369 , m_detached(false) 376 , m_detached(false)
370 , m_parent(0) 377 , m_parent(0)
371 , m_lastModificationCount(-1) 378 , m_lastModificationCount(-1)
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 } 526 }
520 527
521 AXObjectInclusion AXObject::defaultObjectInclusion(IgnoredReasons* ignoredReason s) const 528 AXObjectInclusion AXObject::defaultObjectInclusion(IgnoredReasons* ignoredReason s) const
522 { 529 {
523 if (isInertOrAriaHidden()) { 530 if (isInertOrAriaHidden()) {
524 if (ignoredReasons) 531 if (ignoredReasons)
525 computeIsInertOrAriaHidden(ignoredReasons); 532 computeIsInertOrAriaHidden(ignoredReasons);
526 return IgnoreObject; 533 return IgnoreObject;
527 } 534 }
528 535
529 if (isPresentationalChild()) 536 if (isPresentationalChild()) {
537 if (ignoredReasons) {
538 AXObject* ancestor = ancestorForWhichThisIsAPresentationalChild();
539 ignoredReasons->append(IgnoredReason(AXAncestorDisallowsChild, ances tor));
540 }
530 return IgnoreObject; 541 return IgnoreObject;
542 }
531 543
532 return accessibilityPlatformIncludesObject(); 544 return accessibilityPlatformIncludesObject();
533 } 545 }
534 546
535 bool AXObject::isInertOrAriaHidden() const 547 bool AXObject::isInertOrAriaHidden() const
536 { 548 {
537 updateCachedAttributeValuesIfNeeded(); 549 updateCachedAttributeValuesIfNeeded();
538 return m_cachedIsInertOrAriaHidden; 550 return m_cachedIsInertOrAriaHidden;
539 } 551 }
540 552
541 bool AXObject::computeIsInertOrAriaHidden(IgnoredReasons* ignoredReasons) const 553 bool AXObject::computeIsInertOrAriaHidden(IgnoredReasons* ignoredReasons) const
542 { 554 {
543 if (node()) { 555 if (node()) {
544 if (node()->isInert()) 556 if (node()->isInert()) {
557 if (ignoredReasons) {
558 HTMLDialogElement* dialog = getActiveDialogElement(node());
559 if (dialog) {
560 AXObject* dialogObject = axObjectCache()->getOrCreate(dialog );
561 if (dialogObject)
562 ignoredReasons->append(IgnoredReason(AXActiveModalDialog , dialogObject));
563 else
564 ignoredReasons->append(IgnoredReason(AXInert));
565 } else {
566 // TODO(aboxhall): handle inert attribute if it eventuates
567 ignoredReasons->append(IgnoredReason(AXInert));
568 }
569 }
545 return true; 570 return true;
571 }
546 } else { 572 } else {
547 AXObject* parent = parentObject(); 573 AXObject* parent = parentObject();
548 if (parent && parent->isInertOrAriaHidden()) { 574 if (parent && parent->isInertOrAriaHidden()) {
549 if (ignoredReasons) 575 if (ignoredReasons)
550 parent->computeIsInertOrAriaHidden(ignoredReasons); 576 parent->computeIsInertOrAriaHidden(ignoredReasons);
551 return true; 577 return true;
552 } 578 }
553 } 579 }
554 580
555 const AXObject* hiddenRoot = ariaHiddenRoot(); 581 const AXObject* hiddenRoot = ariaHiddenRoot();
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 } 1381 }
1356 1382
1357 const AtomicString& AXObject::internalRoleName(AccessibilityRole role) 1383 const AtomicString& AXObject::internalRoleName(AccessibilityRole role)
1358 { 1384 {
1359 static const Vector<AtomicString>* internalRoleNameVector = createInternalRo leNameVector(); 1385 static const Vector<AtomicString>* internalRoleNameVector = createInternalRo leNameVector();
1360 1386
1361 return internalRoleNameVector->at(role); 1387 return internalRoleNameVector->at(role);
1362 } 1388 }
1363 1389
1364 } // namespace blink 1390 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXObject.h ('k') | Source/modules/accessibility/InspectorAccessibilityAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698