| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 Element* element = getNode()->isElementNode() ? toElement(getNode()) | 157 Element* element = getNode()->isElementNode() ? toElement(getNode()) |
| 158 : getNode()->parentElement(); | 158 : getNode()->parentElement(); |
| 159 if (!getLayoutObject() && (!element || !element->isInCanvasSubtree()) && | 159 if (!getLayoutObject() && (!element || !element->isInCanvasSubtree()) && |
| 160 !equalIgnoringCase(getAttribute(aria_hiddenAttr), "false")) { | 160 !equalIgnoringCase(getAttribute(aria_hiddenAttr), "false")) { |
| 161 if (ignoredReasons) | 161 if (ignoredReasons) |
| 162 ignoredReasons->append(IgnoredReason(AXNotRendered)); | 162 ignoredReasons->append(IgnoredReason(AXNotRendered)); |
| 163 return true; | 163 return true; |
| 164 } | 164 } |
| 165 | 165 |
| 166 if (m_role == UnknownRole) { | 166 if (roleValue() == UnknownRole) { |
| 167 if (ignoredReasons) | 167 if (ignoredReasons) |
| 168 ignoredReasons->append(IgnoredReason(AXUninteresting)); | 168 ignoredReasons->append(IgnoredReason(AXUninteresting)); |
| 169 return true; | 169 return true; |
| 170 } | 170 } |
| 171 return false; | 171 return false; |
| 172 } | 172 } |
| 173 | 173 |
| 174 static bool isListElement(Node* node) { | 174 static bool isListElement(Node* node) { |
| 175 return isHTMLUListElement(*node) || isHTMLOListElement(*node) || | 175 return isHTMLUListElement(*node) || isHTMLOListElement(*node) || |
| 176 isHTMLDListElement(*node); | 176 isHTMLDListElement(*node); |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 if (isHTMLHRElement(*getNode())) | 506 if (isHTMLHRElement(*getNode())) |
| 507 return SplitterRole; | 507 return SplitterRole; |
| 508 | 508 |
| 509 if (isFieldset()) { | 509 if (isFieldset()) { |
| 510 return GroupRole; | 510 return GroupRole; |
| 511 } | 511 } |
| 512 | 512 |
| 513 return UnknownRole; | 513 return UnknownRole; |
| 514 } | 514 } |
| 515 | 515 |
| 516 AccessibilityRole AXNodeObject::roleValue() const { |
| 517 if (m_role != NeedsToDetermineRole) |
| 518 return m_role; |
| 519 AXNodeObject* node = const_cast<AXNodeObject*>(this); |
| 520 node->m_role = node->determineAccessibilityRole(); |
| 521 return m_role; |
| 522 } |
| 523 |
| 524 void AXNodeObject::setNeedsDetermineAccessibilityRole() { |
| 525 m_role = NeedsToDetermineRole; |
| 526 } |
| 527 |
| 516 AccessibilityRole AXNodeObject::determineAccessibilityRole() { | 528 AccessibilityRole AXNodeObject::determineAccessibilityRole() { |
| 517 if (!getNode()) | 529 if (!getNode()) |
| 518 return UnknownRole; | 530 return UnknownRole; |
| 519 | 531 |
| 520 if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole) | 532 if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole) |
| 521 return m_ariaRole; | 533 return m_ariaRole; |
| 522 if (getNode()->isTextNode()) | 534 if (getNode()->isTextNode()) |
| 523 return StaticTextRole; | 535 return StaticTextRole; |
| 524 | 536 |
| 525 AccessibilityRole role = nativeAccessibilityRoleIgnoringAria(); | 537 AccessibilityRole role = nativeAccessibilityRoleIgnoringAria(); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 } | 748 } |
| 737 | 749 |
| 738 return role; | 750 return role; |
| 739 } | 751 } |
| 740 | 752 |
| 741 void AXNodeObject::init() { | 753 void AXNodeObject::init() { |
| 742 #if ENABLE(ASSERT) | 754 #if ENABLE(ASSERT) |
| 743 ASSERT(!m_initialized); | 755 ASSERT(!m_initialized); |
| 744 m_initialized = true; | 756 m_initialized = true; |
| 745 #endif | 757 #endif |
| 746 m_role = determineAccessibilityRole(); | 758 setNeedsDetermineAccessibilityRole(); |
| 747 } | 759 } |
| 748 | 760 |
| 749 void AXNodeObject::detach() { | 761 void AXNodeObject::detach() { |
| 750 AXObject::detach(); | 762 AXObject::detach(); |
| 751 m_node = nullptr; | 763 m_node = nullptr; |
| 752 } | 764 } |
| 753 | 765 |
| 754 bool AXNodeObject::isAnchor() const { | 766 bool AXNodeObject::isAnchor() const { |
| 755 return !isNativeImage() && isLink(); | 767 return !isNativeImage() && isLink(); |
| 756 } | 768 } |
| (...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2185 // If this element is an ARIA text box or content editable, post a "value | 2197 // If this element is an ARIA text box or content editable, post a "value |
| 2186 // changed" notification on it so that it behaves just like a native input | 2198 // changed" notification on it so that it behaves just like a native input |
| 2187 // element or textarea. | 2199 // element or textarea. |
| 2188 if (parent->isNonNativeTextControl()) | 2200 if (parent->isNonNativeTextControl()) |
| 2189 cache.postNotification(parentNode, AXObjectCacheImpl::AXValueChanged); | 2201 cache.postNotification(parentNode, AXObjectCacheImpl::AXValueChanged); |
| 2190 } | 2202 } |
| 2191 } | 2203 } |
| 2192 | 2204 |
| 2193 void AXNodeObject::updateAccessibilityRole() { | 2205 void AXNodeObject::updateAccessibilityRole() { |
| 2194 bool ignoredStatus = accessibilityIsIgnored(); | 2206 bool ignoredStatus = accessibilityIsIgnored(); |
| 2195 m_role = determineAccessibilityRole(); | 2207 setNeedsDetermineAccessibilityRole(); |
| 2196 | 2208 |
| 2197 // The AX hierarchy only needs to be updated if the ignored status of an | 2209 // The AX hierarchy only needs to be updated if the ignored status of an |
| 2198 // element has changed. | 2210 // element has changed. |
| 2199 if (ignoredStatus != accessibilityIsIgnored()) | 2211 if (ignoredStatus != accessibilityIsIgnored()) |
| 2200 childrenChanged(); | 2212 childrenChanged(); |
| 2201 } | 2213 } |
| 2202 | 2214 |
| 2203 void AXNodeObject::computeAriaOwnsChildren( | 2215 void AXNodeObject::computeAriaOwnsChildren( |
| 2204 HeapVector<Member<AXObject>>& ownedChildren) const { | 2216 HeapVector<Member<AXObject>>& ownedChildren) const { |
| 2205 if (!hasAttribute(aria_ownsAttr)) | 2217 if (!hasAttribute(aria_ownsAttr)) |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2895 } | 2907 } |
| 2896 return placeholder; | 2908 return placeholder; |
| 2897 } | 2909 } |
| 2898 | 2910 |
| 2899 DEFINE_TRACE(AXNodeObject) { | 2911 DEFINE_TRACE(AXNodeObject) { |
| 2900 visitor->trace(m_node); | 2912 visitor->trace(m_node); |
| 2901 AXObject::trace(visitor); | 2913 AXObject::trace(visitor); |
| 2902 } | 2914 } |
| 2903 | 2915 |
| 2904 } // namespace blink | 2916 } // namespace blink |
| OLD | NEW |