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

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

Issue 1930253002: Merge to M51: Accessible name calc should allow aria-labelledby to reference aria-hidden (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 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
« no previous file with comments | « third_party/WebKit/LayoutTests/accessibility/name-calc-aria-hidden.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 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 HeapVector<Member<AXObject>> ownedChildren; 1613 HeapVector<Member<AXObject>> ownedChildren;
1614 computeAriaOwnsChildren(ownedChildren); 1614 computeAriaOwnsChildren(ownedChildren);
1615 for (AXObject* obj = rawFirstChild(); obj; obj = obj->rawNextSibling()) { 1615 for (AXObject* obj = rawFirstChild(); obj; obj = obj->rawNextSibling()) {
1616 if (!axObjectCache().isAriaOwned(obj)) 1616 if (!axObjectCache().isAriaOwned(obj))
1617 children.append(obj); 1617 children.append(obj);
1618 } 1618 }
1619 for (const auto& ownedChild : ownedChildren) 1619 for (const auto& ownedChild : ownedChildren)
1620 children.append(ownedChild); 1620 children.append(ownedChild);
1621 1621
1622 for (AXObject* child : children) { 1622 for (AXObject* child : children) {
1623 // Skip hidden children 1623 // Don't recurse into children that are explicitly marked as aria-hidden .
1624 if (child->isInertOrAriaHidden()) 1624 // Note that we don't call isInertOrAriaHidden because that would return true
1625 // if any ancestor is hidden, but we need to be able to compute the acce ssible
1626 // name of object inside hidden subtrees (for example, if aria-labelledb y points
1627 // to an object that's hidden).
1628 if (equalIgnoringCase(child->getAttribute(aria_hiddenAttr), "true"))
1625 continue; 1629 continue;
1626 1630
1627 // If we're going between two layoutObjects that are in separate LayoutB oxes, add 1631 // If we're going between two layoutObjects that are in separate LayoutB oxes, add
1628 // whitespace if it wasn't there already. Intuitively if you have 1632 // whitespace if it wasn't there already. Intuitively if you have
1629 // <span>Hello</span><span>World</span>, those are part of the same Layo utBox 1633 // <span>Hello</span><span>World</span>, those are part of the same Layo utBox
1630 // so we should return "HelloWorld", but given <div>Hello</div><div>Worl d</div> the 1634 // so we should return "HelloWorld", but given <div>Hello</div><div>Worl d</div> the
1631 // strings are in separate boxes so we should return "Hello World". 1635 // strings are in separate boxes so we should return "Hello World".
1632 if (previous && accumulatedText.length() && !isHTMLSpace(accumulatedText [accumulatedText.length() - 1])) { 1636 if (previous && accumulatedText.length() && !isHTMLSpace(accumulatedText [accumulatedText.length() - 1])) {
1633 if (!isInSameNonInlineBlockFlow(child->getLayoutObject(), previous-> getLayoutObject())) 1637 if (!isInSameNonInlineBlockFlow(child->getLayoutObject(), previous-> getLayoutObject()))
1634 accumulatedText.append(' '); 1638 accumulatedText.append(' ');
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2759 return placeholder; 2763 return placeholder;
2760 } 2764 }
2761 2765
2762 DEFINE_TRACE(AXNodeObject) 2766 DEFINE_TRACE(AXNodeObject)
2763 { 2767 {
2764 visitor->trace(m_node); 2768 visitor->trace(m_node);
2765 AXObject::trace(visitor); 2769 AXObject::trace(visitor);
2766 } 2770 }
2767 2771
2768 } // namespace blink 2772 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/accessibility/name-calc-aria-hidden.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698