| 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 12 matching lines...) Expand all Loading... |
| 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 "modules/accessibility/AXObject.h" | 29 #include "modules/accessibility/AXObject.h" |
| 30 | 30 |
| 31 #include "SkMatrix44.h" | 31 #include "SkMatrix44.h" |
| 32 #include "core/css/resolver/StyleResolver.h" | 32 #include "core/css/resolver/StyleResolver.h" |
| 33 #include "core/dom/AccessibleNode.h" |
| 33 #include "core/dom/DocumentUserGestureToken.h" | 34 #include "core/dom/DocumentUserGestureToken.h" |
| 34 #include "core/editing/EditingUtilities.h" | 35 #include "core/editing/EditingUtilities.h" |
| 35 #include "core/editing/VisibleUnits.h" | 36 #include "core/editing/VisibleUnits.h" |
| 36 #include "core/frame/FrameView.h" | 37 #include "core/frame/FrameView.h" |
| 37 #include "core/frame/LocalFrame.h" | 38 #include "core/frame/LocalFrame.h" |
| 38 #include "core/frame/Settings.h" | 39 #include "core/frame/Settings.h" |
| 39 #include "core/html/HTMLDialogElement.h" | 40 #include "core/html/HTMLDialogElement.h" |
| 40 #include "core/html/HTMLFrameOwnerElement.h" | 41 #include "core/html/HTMLFrameOwnerElement.h" |
| 41 #include "core/html/parser/HTMLParserIdioms.h" | 42 #include "core/html/parser/HTMLParserIdioms.h" |
| 42 #include "core/layout/LayoutBoxModelObject.h" | 43 #include "core/layout/LayoutBoxModelObject.h" |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 // no children are left with dangling pointers to their parent. | 372 // no children are left with dangling pointers to their parent. |
| 372 clearChildren(); | 373 clearChildren(); |
| 373 | 374 |
| 374 m_axObjectCache = nullptr; | 375 m_axObjectCache = nullptr; |
| 375 } | 376 } |
| 376 | 377 |
| 377 bool AXObject::isDetached() const { | 378 bool AXObject::isDetached() const { |
| 378 return !m_axObjectCache; | 379 return !m_axObjectCache; |
| 379 } | 380 } |
| 380 | 381 |
| 382 const AtomicString& AXObject::getAOMPropertyOrARIAAttribute( |
| 383 AOMStringProperty property) const { |
| 384 Node* node = this->getNode(); |
| 385 if (!node || !node->isElementNode()) |
| 386 return nullAtom; |
| 387 |
| 388 return AccessibleNode::getProperty(toElement(node), property); |
| 389 } |
| 390 |
| 381 bool AXObject::isARIATextControl() const { | 391 bool AXObject::isARIATextControl() const { |
| 382 return ariaRoleAttribute() == TextFieldRole || | 392 return ariaRoleAttribute() == TextFieldRole || |
| 383 ariaRoleAttribute() == SearchBoxRole || | 393 ariaRoleAttribute() == SearchBoxRole || |
| 384 ariaRoleAttribute() == ComboBoxRole; | 394 ariaRoleAttribute() == ComboBoxRole; |
| 385 } | 395 } |
| 386 | 396 |
| 387 bool AXObject::isButton() const { | 397 bool AXObject::isButton() const { |
| 388 AccessibilityRole role = roleValue(); | 398 AccessibilityRole role = roleValue(); |
| 389 | 399 |
| 390 return role == ButtonRole || role == PopUpButtonRole || | 400 return role == ButtonRole || role == PopUpButtonRole || |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 } | 806 } |
| 797 } | 807 } |
| 798 | 808 |
| 799 // Step 2C from: http://www.w3.org/TR/accname-aam-1.1 | 809 // Step 2C from: http://www.w3.org/TR/accname-aam-1.1 |
| 800 // If you change this logic, update AXNodeObject::nameFromLabelElement, too. | 810 // If you change this logic, update AXNodeObject::nameFromLabelElement, too. |
| 801 nameFrom = AXNameFromAttribute; | 811 nameFrom = AXNameFromAttribute; |
| 802 if (nameSources) { | 812 if (nameSources) { |
| 803 nameSources->push_back(NameSource(*foundTextAlternative, aria_labelAttr)); | 813 nameSources->push_back(NameSource(*foundTextAlternative, aria_labelAttr)); |
| 804 nameSources->back().type = nameFrom; | 814 nameSources->back().type = nameFrom; |
| 805 } | 815 } |
| 806 const AtomicString& ariaLabel = getAttribute(aria_labelAttr); | 816 const AtomicString& ariaLabel = |
| 817 getAOMPropertyOrARIAAttribute(AOMStringProperty::kLabel); |
| 807 if (!ariaLabel.isEmpty()) { | 818 if (!ariaLabel.isEmpty()) { |
| 808 textAlternative = ariaLabel; | 819 textAlternative = ariaLabel; |
| 809 | 820 |
| 810 if (nameSources) { | 821 if (nameSources) { |
| 811 NameSource& source = nameSources->back(); | 822 NameSource& source = nameSources->back(); |
| 812 source.text = textAlternative; | 823 source.text = textAlternative; |
| 813 source.attributeValue = ariaLabel; | 824 source.attributeValue = ariaLabel; |
| 814 *foundTextAlternative = true; | 825 *foundTextAlternative = true; |
| 815 } else { | 826 } else { |
| 816 *foundTextAlternative = true; | 827 *foundTextAlternative = true; |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1773 } | 1784 } |
| 1774 | 1785 |
| 1775 DEFINE_TRACE(AXObject) { | 1786 DEFINE_TRACE(AXObject) { |
| 1776 visitor->trace(m_children); | 1787 visitor->trace(m_children); |
| 1777 visitor->trace(m_parent); | 1788 visitor->trace(m_parent); |
| 1778 visitor->trace(m_cachedLiveRegionRoot); | 1789 visitor->trace(m_cachedLiveRegionRoot); |
| 1779 visitor->trace(m_axObjectCache); | 1790 visitor->trace(m_axObjectCache); |
| 1780 } | 1791 } |
| 1781 | 1792 |
| 1782 } // namespace blink | 1793 } // namespace blink |
| OLD | NEW |