OLD | NEW |
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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 return axObj.textAlternative(true, inAriaLabelledByTraversal, visited, tmpNa
meFrom, nullptr, nullptr); | 716 return axObj.textAlternative(true, inAriaLabelledByTraversal, visited, tmpNa
meFrom, nullptr, nullptr); |
717 } | 717 } |
718 | 718 |
719 String AXObject::ariaTextAlternative(bool recursive, bool inAriaLabelledByTraver
sal, AXObjectSet& visited, AXNameFrom& nameFrom, AXRelatedObjectVector* relatedO
bjects, NameSources* nameSources, bool* foundTextAlternative) const | 719 String AXObject::ariaTextAlternative(bool recursive, bool inAriaLabelledByTraver
sal, AXObjectSet& visited, AXNameFrom& nameFrom, AXRelatedObjectVector* relatedO
bjects, NameSources* nameSources, bool* foundTextAlternative) const |
720 { | 720 { |
721 String textAlternative; | 721 String textAlternative; |
722 bool alreadyVisited = visited.contains(this); | 722 bool alreadyVisited = visited.contains(this); |
723 visited.add(this); | 723 visited.add(this); |
724 | 724 |
725 // Step 2A from: http://www.w3.org/TR/accname-aam-1.1 | 725 // Step 2A from: http://www.w3.org/TR/accname-aam-1.1 |
| 726 // If you change this logic, update AXNodeObject::nameFromLabelElement, too. |
726 if (!recursive && layoutObject() | 727 if (!recursive && layoutObject() |
727 && layoutObject()->style()->visibility() != VISIBLE | 728 && layoutObject()->style()->visibility() != VISIBLE |
728 && !equalIgnoringCase(getAttribute(aria_hiddenAttr), "false")) { | 729 && !equalIgnoringCase(getAttribute(aria_hiddenAttr), "false")) { |
729 return String(); | 730 return String(); |
730 } | 731 } |
731 | 732 |
732 // Step 2B from: http://www.w3.org/TR/accname-aam-1.1 | 733 // Step 2B from: http://www.w3.org/TR/accname-aam-1.1 |
| 734 // If you change this logic, update AXNodeObject::nameFromLabelElement, too. |
733 if (!inAriaLabelledByTraversal && !alreadyVisited) { | 735 if (!inAriaLabelledByTraversal && !alreadyVisited) { |
734 const QualifiedName& attr = hasAttribute(aria_labeledbyAttr) && !hasAttr
ibute(aria_labelledbyAttr) ? aria_labeledbyAttr : aria_labelledbyAttr; | 736 const QualifiedName& attr = hasAttribute(aria_labeledbyAttr) && !hasAttr
ibute(aria_labelledbyAttr) ? aria_labeledbyAttr : aria_labelledbyAttr; |
735 nameFrom = AXNameFromRelatedElement; | 737 nameFrom = AXNameFromRelatedElement; |
736 if (nameSources) { | 738 if (nameSources) { |
737 nameSources->append(NameSource(*foundTextAlternative, attr)); | 739 nameSources->append(NameSource(*foundTextAlternative, attr)); |
738 nameSources->last().type = nameFrom; | 740 nameSources->last().type = nameFrom; |
739 } | 741 } |
740 | 742 |
741 const AtomicString& ariaLabelledby = getAttribute(attr); | 743 const AtomicString& ariaLabelledby = getAttribute(attr); |
742 if (!ariaLabelledby.isNull()) { | 744 if (!ariaLabelledby.isNull()) { |
(...skipping 13 matching lines...) Expand all Loading... |
756 *foundTextAlternative = true; | 758 *foundTextAlternative = true; |
757 return textAlternative; | 759 return textAlternative; |
758 } | 760 } |
759 } else if (nameSources) { | 761 } else if (nameSources) { |
760 nameSources->last().invalid = true; | 762 nameSources->last().invalid = true; |
761 } | 763 } |
762 } | 764 } |
763 } | 765 } |
764 | 766 |
765 // Step 2C from: http://www.w3.org/TR/accname-aam-1.1 | 767 // Step 2C from: http://www.w3.org/TR/accname-aam-1.1 |
| 768 // If you change this logic, update AXNodeObject::nameFromLabelElement, too. |
766 nameFrom = AXNameFromAttribute; | 769 nameFrom = AXNameFromAttribute; |
767 if (nameSources) { | 770 if (nameSources) { |
768 nameSources->append(NameSource(*foundTextAlternative, aria_labelAttr)); | 771 nameSources->append(NameSource(*foundTextAlternative, aria_labelAttr)); |
769 nameSources->last().type = nameFrom; | 772 nameSources->last().type = nameFrom; |
770 } | 773 } |
771 const AtomicString& ariaLabel = getAttribute(aria_labelAttr); | 774 const AtomicString& ariaLabel = getAttribute(aria_labelAttr); |
772 if (!ariaLabel.isEmpty()) { | 775 if (!ariaLabel.isEmpty()) { |
773 textAlternative = ariaLabel; | 776 textAlternative = ariaLabel; |
774 | 777 |
775 if (nameSources) { | 778 if (nameSources) { |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1678 | 1681 |
1679 DEFINE_TRACE(AXObject) | 1682 DEFINE_TRACE(AXObject) |
1680 { | 1683 { |
1681 visitor->trace(m_children); | 1684 visitor->trace(m_children); |
1682 visitor->trace(m_parent); | 1685 visitor->trace(m_parent); |
1683 visitor->trace(m_cachedLiveRegionRoot); | 1686 visitor->trace(m_cachedLiveRegionRoot); |
1684 visitor->trace(m_axObjectCache); | 1687 visitor->trace(m_axObjectCache); |
1685 } | 1688 } |
1686 | 1689 |
1687 } // namespace blink | 1690 } // namespace blink |
OLD | NEW |