| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/dom/AccessibleNode.h" | 5 #include "core/dom/AccessibleNode.h" |
| 6 | 6 |
| 7 #include "core/dom/AXObjectCache.h" | 7 #include "core/dom/AXObjectCache.h" |
| 8 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
| 9 #include "core/dom/QualifiedName.h" | 9 #include "core/dom/QualifiedName.h" |
| 10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 if (!element) | 25 if (!element) |
| 26 return g_null_atom; | 26 return g_null_atom; |
| 27 | 27 |
| 28 if (AccessibleNode* accessible_node = element->ExistingAccessibleNode()) { | 28 if (AccessibleNode* accessible_node = element->ExistingAccessibleNode()) { |
| 29 for (const auto& item : accessible_node->string_properties_) { | 29 for (const auto& item : accessible_node->string_properties_) { |
| 30 if (item.first == property) | 30 if (item.first == property) |
| 31 return item.second; | 31 return item.second; |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 | 34 |
| 35 return g_null_atom; |
| 36 } |
| 37 |
| 38 // static |
| 39 const AtomicString& AccessibleNode::GetPropertyOrARIAAttribute( |
| 40 Element* element, |
| 41 AOMStringProperty property) { |
| 42 if (!element) |
| 43 return g_null_atom; |
| 44 |
| 45 const AtomicString& result = GetProperty(element, property); |
| 46 if (!result.IsNull()) |
| 47 return result; |
| 48 |
| 35 // Fall back on the equivalent ARIA attribute. | 49 // Fall back on the equivalent ARIA attribute. |
| 36 switch (property) { | 50 switch (property) { |
| 37 case AOMStringProperty::kAutocomplete: | 51 case AOMStringProperty::kAutocomplete: |
| 38 return element->getAttribute(aria_autocompleteAttr); | 52 return element->getAttribute(aria_autocompleteAttr); |
| 39 case AOMStringProperty::kChecked: | 53 case AOMStringProperty::kChecked: |
| 40 return element->getAttribute(aria_checkedAttr); | 54 return element->getAttribute(aria_checkedAttr); |
| 41 case AOMStringProperty::kCurrent: | 55 case AOMStringProperty::kCurrent: |
| 42 return element->getAttribute(aria_currentAttr); | 56 return element->getAttribute(aria_currentAttr); |
| 43 case AOMStringProperty::kInvalid: | 57 case AOMStringProperty::kInvalid: |
| 44 return element->getAttribute(aria_invalidAttr); | 58 return element->getAttribute(aria_invalidAttr); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 232 |
| 219 AXObjectCache* AccessibleNode::GetAXObjectCache() { | 233 AXObjectCache* AccessibleNode::GetAXObjectCache() { |
| 220 return element_->GetDocument().ExistingAXObjectCache(); | 234 return element_->GetDocument().ExistingAXObjectCache(); |
| 221 } | 235 } |
| 222 | 236 |
| 223 DEFINE_TRACE(AccessibleNode) { | 237 DEFINE_TRACE(AccessibleNode) { |
| 224 visitor->Trace(element_); | 238 visitor->Trace(element_); |
| 225 } | 239 } |
| 226 | 240 |
| 227 } // namespace blink | 241 } // namespace blink |
| OLD | NEW |