OLD | NEW |
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 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1614 bool AXNodeObject::nameFromLabelElement() const | 1614 bool AXNodeObject::nameFromLabelElement() const |
1615 { | 1615 { |
1616 // This unfortunately duplicates a bit of logic from textAlternative and nat
iveTextAlternative, | 1616 // This unfortunately duplicates a bit of logic from textAlternative and nat
iveTextAlternative, |
1617 // but it's necessary because nameFromLabelElement needs to be called from | 1617 // but it's necessary because nameFromLabelElement needs to be called from |
1618 // computeAccessibilityIsIgnored, which isn't allowed to call axObjectCache-
>getOrCreate. | 1618 // computeAccessibilityIsIgnored, which isn't allowed to call axObjectCache-
>getOrCreate. |
1619 | 1619 |
1620 if (!node() && !layoutObject()) | 1620 if (!node() && !layoutObject()) |
1621 return false; | 1621 return false; |
1622 | 1622 |
1623 // Step 2A from: http://www.w3.org/TR/accname-aam-1.1 | 1623 // Step 2A from: http://www.w3.org/TR/accname-aam-1.1 |
1624 if (layoutObject() | 1624 if (isHiddenForTextAlternativeCalculation()) |
1625 && layoutObject()->style()->visibility() != VISIBLE | |
1626 && !equalIgnoringCase(getAttribute(aria_hiddenAttr), "false")) { | |
1627 return false; | 1625 return false; |
1628 } | |
1629 | 1626 |
1630 // Step 2B from: http://www.w3.org/TR/accname-aam-1.1 | 1627 // Step 2B from: http://www.w3.org/TR/accname-aam-1.1 |
1631 WillBeHeapVector<RawPtrWillBeMember<Element>> elements; | 1628 WillBeHeapVector<RawPtrWillBeMember<Element>> elements; |
1632 ariaLabelledbyElementVector(elements); | 1629 ariaLabelledbyElementVector(elements); |
1633 if (elements.size() > 0) | 1630 if (elements.size() > 0) |
1634 return false; | 1631 return false; |
1635 | 1632 |
1636 // Step 2C from: http://www.w3.org/TR/accname-aam-1.1 | 1633 // Step 2C from: http://www.w3.org/TR/accname-aam-1.1 |
1637 const AtomicString& ariaLabel = getAttribute(aria_labelAttr); | 1634 const AtomicString& ariaLabel = getAttribute(aria_labelAttr); |
1638 if (!ariaLabel.isEmpty()) | 1635 if (!ariaLabel.isEmpty()) |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2453 | 2450 |
2454 String AXNodeObject::description(AXNameFrom nameFrom, AXDescriptionFrom& descrip
tionFrom, AXObjectVector* descriptionObjects) const | 2451 String AXNodeObject::description(AXNameFrom nameFrom, AXDescriptionFrom& descrip
tionFrom, AXObjectVector* descriptionObjects) const |
2455 { | 2452 { |
2456 AXRelatedObjectVector relatedObjects; | 2453 AXRelatedObjectVector relatedObjects; |
2457 String result = description(nameFrom, descriptionFrom, nullptr, &relatedObje
cts); | 2454 String result = description(nameFrom, descriptionFrom, nullptr, &relatedObje
cts); |
2458 if (descriptionObjects) { | 2455 if (descriptionObjects) { |
2459 descriptionObjects->clear(); | 2456 descriptionObjects->clear(); |
2460 for (size_t i = 0; i < relatedObjects.size(); i++) | 2457 for (size_t i = 0; i < relatedObjects.size(); i++) |
2461 descriptionObjects->append(relatedObjects[i]->object); | 2458 descriptionObjects->append(relatedObjects[i]->object); |
2462 } | 2459 } |
2463 return result; | 2460 |
| 2461 return collapseWhitespace(result); |
2464 } | 2462 } |
2465 | 2463 |
2466 // Based on http://rawgit.com/w3c/aria/master/html-aam/html-aam.html#accessible-
name-and-description-calculation | 2464 // Based on http://rawgit.com/w3c/aria/master/html-aam/html-aam.html#accessible-
name-and-description-calculation |
2467 String AXNodeObject::description(AXNameFrom nameFrom, AXDescriptionFrom& descrip
tionFrom, DescriptionSources* descriptionSources, AXRelatedObjectVector* related
Objects) const | 2465 String AXNodeObject::description(AXNameFrom nameFrom, AXDescriptionFrom& descrip
tionFrom, DescriptionSources* descriptionSources, AXRelatedObjectVector* related
Objects) const |
2468 { | 2466 { |
2469 // If descriptionSources is non-null, relatedObjects is used in filling it i
n, so it must be non-null as well. | 2467 // If descriptionSources is non-null, relatedObjects is used in filling it i
n, so it must be non-null as well. |
2470 if (descriptionSources) | 2468 if (descriptionSources) |
2471 ASSERT(relatedObjects); | 2469 ASSERT(relatedObjects); |
2472 | 2470 |
2473 if (!node()) | 2471 if (!node()) |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2684 return placeholder; | 2682 return placeholder; |
2685 } | 2683 } |
2686 | 2684 |
2687 DEFINE_TRACE(AXNodeObject) | 2685 DEFINE_TRACE(AXNodeObject) |
2688 { | 2686 { |
2689 visitor->trace(m_node); | 2687 visitor->trace(m_node); |
2690 AXObject::trace(visitor); | 2688 AXObject::trace(visitor); |
2691 } | 2689 } |
2692 | 2690 |
2693 } // namespace blin | 2691 } // namespace blin |
OLD | NEW |