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

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

Issue 2112243004: Ignores ARIA relations (e.g. aria-labelledby) that point to an invisible target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed test. Created 4 years, 5 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
« no previous file with comments | « third_party/WebKit/LayoutTests/accessibility/aria-relations-should-ignore-hidden-targets.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, Google 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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 return UnknownRole; 571 return UnknownRole;
572 } 572 }
573 573
574 void AXNodeObject::accessibilityChildrenFromAttribute(QualifiedName attr, AXObje ct::AXObjectVector& children) const 574 void AXNodeObject::accessibilityChildrenFromAttribute(QualifiedName attr, AXObje ct::AXObjectVector& children) const
575 { 575 {
576 HeapVector<Member<Element>> elements; 576 HeapVector<Member<Element>> elements;
577 elementsFromAttribute(elements, attr); 577 elementsFromAttribute(elements, attr);
578 578
579 AXObjectCacheImpl& cache = axObjectCache(); 579 AXObjectCacheImpl& cache = axObjectCache();
580 for (const auto& element : elements) { 580 for (const auto& element : elements) {
581 if (AXObject* child = cache.getOrCreate(element)) 581 if (AXObject* child = cache.getOrCreate(element)) {
582 // Only aria-labelledby and aria-describedby can target hidden eleme nts.
583 if (child->accessibilityIsIgnored()
584 && attr != aria_labelledbyAttr && attr != aria_labeledbyAttr
585 && attr != aria_describedbyAttr) {
586 continue;
587 }
582 children.append(child); 588 children.append(child);
589 }
583 } 590 }
584 } 591 }
585 592
586 // This only returns true if this is the element that actually has the 593 // This only returns true if this is the element that actually has the
587 // contentEditable attribute set, unlike node->hasEditableStyle() which will 594 // contentEditable attribute set, unlike node->hasEditableStyle() which will
588 // also return true if an ancestor is editable. 595 // also return true if an ancestor is editable.
589 bool AXNodeObject::hasContentEditableAttributeSet() const 596 bool AXNodeObject::hasContentEditableAttributeSet() const
590 { 597 {
591 const AtomicString& contentEditableValue = getAttribute(contenteditableAttr) ; 598 const AtomicString& contentEditableValue = getAttribute(contenteditableAttr) ;
592 if (contentEditableValue.isNull()) 599 if (contentEditableValue.isNull())
(...skipping 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after
2833 return placeholder; 2840 return placeholder;
2834 } 2841 }
2835 2842
2836 DEFINE_TRACE(AXNodeObject) 2843 DEFINE_TRACE(AXNodeObject)
2837 { 2844 {
2838 visitor->trace(m_node); 2845 visitor->trace(m_node);
2839 AXObject::trace(visitor); 2846 AXObject::trace(visitor);
2840 } 2847 }
2841 2848
2842 } // namespace blink 2849 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/accessibility/aria-relations-should-ignore-hidden-targets.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698