| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2010 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 using namespace HTMLNames; | 35 using namespace HTMLNames; |
| 36 | 36 |
| 37 AXMenuListOption::AXMenuListOption(HTMLOptionElement* element, | 37 AXMenuListOption::AXMenuListOption(HTMLOptionElement* element, |
| 38 AXObjectCacheImpl& axObjectCache) | 38 AXObjectCacheImpl& axObjectCache) |
| 39 : AXMockObject(axObjectCache), m_element(element) {} | 39 : AXMockObject(axObjectCache), m_element(element) {} |
| 40 | 40 |
| 41 AXMenuListOption::~AXMenuListOption() { | 41 AXMenuListOption::~AXMenuListOption() { |
| 42 ASSERT(!m_element); | 42 DCHECK(!m_element); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void AXMenuListOption::detach() { | 45 void AXMenuListOption::detach() { |
| 46 m_element = nullptr; | 46 m_element = nullptr; |
| 47 AXMockObject::detach(); | 47 AXMockObject::detach(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 AccessibilityRole AXMenuListOption::roleValue() const { | 50 AccessibilityRole AXMenuListOption::roleValue() const { |
| 51 const AtomicString& ariaRole = | 51 const AtomicString& ariaRole = |
| 52 getAOMPropertyOrARIAAttribute(AOMStringProperty::kRole); | 52 getAOMPropertyOrARIAAttribute(AOMStringProperty::kRole); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 AXObject** outContainer, | 110 AXObject** outContainer, |
| 111 FloatRect& outBoundsInContainer, | 111 FloatRect& outBoundsInContainer, |
| 112 SkMatrix44& outContainerTransform) const { | 112 SkMatrix44& outContainerTransform) const { |
| 113 *outContainer = nullptr; | 113 *outContainer = nullptr; |
| 114 outBoundsInContainer = FloatRect(); | 114 outBoundsInContainer = FloatRect(); |
| 115 outContainerTransform.setIdentity(); | 115 outContainerTransform.setIdentity(); |
| 116 | 116 |
| 117 AXObject* parent = parentObject(); | 117 AXObject* parent = parentObject(); |
| 118 if (!parent) | 118 if (!parent) |
| 119 return; | 119 return; |
| 120 ASSERT(parent->isMenuListPopup()); | 120 DCHECK(parent->isMenuListPopup()); |
| 121 | 121 |
| 122 AXObject* grandparent = parent->parentObject(); | 122 AXObject* grandparent = parent->parentObject(); |
| 123 if (!grandparent) | 123 if (!grandparent) |
| 124 return; | 124 return; |
| 125 ASSERT(grandparent->isMenuList()); | 125 DCHECK(grandparent->isMenuList()); |
| 126 grandparent->getRelativeBounds(outContainer, outBoundsInContainer, | 126 grandparent->getRelativeBounds(outContainer, outBoundsInContainer, |
| 127 outContainerTransform); | 127 outContainerTransform); |
| 128 } | 128 } |
| 129 | 129 |
| 130 String AXMenuListOption::textAlternative(bool recursive, | 130 String AXMenuListOption::textAlternative(bool recursive, |
| 131 bool inAriaLabelledByTraversal, | 131 bool inAriaLabelledByTraversal, |
| 132 AXObjectSet& visited, | 132 AXObjectSet& visited, |
| 133 AXNameFrom& nameFrom, | 133 AXNameFrom& nameFrom, |
| 134 AXRelatedObjectVector* relatedObjects, | 134 AXRelatedObjectVector* relatedObjects, |
| 135 NameSources* nameSources) const { | 135 NameSources* nameSources) const { |
| 136 // If nameSources is non-null, relatedObjects is used in filling it in, so it | 136 // If nameSources is non-null, relatedObjects is used in filling it in, so it |
| 137 // must be non-null as well. | 137 // must be non-null as well. |
| 138 if (nameSources) | 138 if (nameSources) |
| 139 ASSERT(relatedObjects); | 139 DCHECK(relatedObjects); |
| 140 | 140 |
| 141 if (!getNode()) | 141 if (!getNode()) |
| 142 return String(); | 142 return String(); |
| 143 | 143 |
| 144 bool foundTextAlternative = false; | 144 bool foundTextAlternative = false; |
| 145 String textAlternative = ariaTextAlternative( | 145 String textAlternative = ariaTextAlternative( |
| 146 recursive, inAriaLabelledByTraversal, visited, nameFrom, relatedObjects, | 146 recursive, inAriaLabelledByTraversal, visited, nameFrom, relatedObjects, |
| 147 nameSources, &foundTextAlternative); | 147 nameSources, &foundTextAlternative); |
| 148 if (foundTextAlternative && !nameSources) | 148 if (foundTextAlternative && !nameSources) |
| 149 return textAlternative; | 149 return textAlternative; |
| 150 | 150 |
| 151 nameFrom = AXNameFromContents; | 151 nameFrom = AXNameFromContents; |
| 152 textAlternative = m_element->displayLabel(); | 152 textAlternative = m_element->displayLabel(); |
| 153 if (nameSources) { | 153 if (nameSources) { |
| 154 nameSources->push_back(NameSource(foundTextAlternative)); | 154 nameSources->push_back(NameSource(foundTextAlternative)); |
| 155 nameSources->back().type = nameFrom; | 155 nameSources->back().type = nameFrom; |
| 156 nameSources->back().text = textAlternative; | 156 nameSources->back().text = textAlternative; |
| 157 foundTextAlternative = true; | 157 foundTextAlternative = true; |
| 158 } | 158 } |
| 159 | 159 |
| 160 return textAlternative; | 160 return textAlternative; |
| 161 } | 161 } |
| 162 | 162 |
| 163 DEFINE_TRACE(AXMenuListOption) { | 163 DEFINE_TRACE(AXMenuListOption) { |
| 164 visitor->trace(m_element); | 164 visitor->trace(m_element); |
| 165 AXMockObject::trace(visitor); | 165 AXMockObject::trace(visitor); |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace blink | 168 } // namespace blink |
| OLD | NEW |