| 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/AccessibleNodeList.h" | 8 #include "core/dom/AccessibleNodeList.h" |
| 9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
| 10 #include "core/dom/QualifiedName.h" | 10 #include "core/dom/QualifiedName.h" |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 return attr_value; | 376 return attr_value; |
| 377 } | 377 } |
| 378 | 378 |
| 379 if (is_token_attr && IsUndefinedAttrValue(result)) | 379 if (is_token_attr && IsUndefinedAttrValue(result)) |
| 380 return g_null_atom; // Property specifically set to undefined value. | 380 return g_null_atom; // Property specifically set to undefined value. |
| 381 | 381 |
| 382 return result; | 382 return result; |
| 383 } | 383 } |
| 384 | 384 |
| 385 // static | 385 // static |
| 386 AccessibleNode* AccessibleNode::GetPropertyOrARIAAttribute( | 386 Element* AccessibleNode::GetPropertyOrARIAAttribute( |
| 387 Element* element, | 387 Element* element, |
| 388 AOMRelationProperty property) { | 388 AOMRelationProperty property) { |
| 389 if (!element) | 389 if (!element) |
| 390 return nullptr; | 390 return nullptr; |
| 391 | 391 |
| 392 if (AccessibleNode* result = GetProperty(element, property)) | 392 if (AccessibleNode* result = GetProperty(element, property)) |
| 393 return result; | 393 return result->element(); |
| 394 | 394 |
| 395 // Fall back on the equivalent ARIA attribute. | 395 // Fall back on the equivalent ARIA attribute. |
| 396 QualifiedName attribute = GetCorrespondingARIAAttribute(property); | 396 QualifiedName attribute = GetCorrespondingARIAAttribute(property); |
| 397 AtomicString value = element->FastGetAttribute(attribute); | 397 AtomicString value = element->FastGetAttribute(attribute); |
| 398 Element* target = element->GetTreeScope().getElementById(value); | 398 return element->GetTreeScope().getElementById(value); |
| 399 if (!target) | |
| 400 return nullptr; | |
| 401 | |
| 402 return target->accessibleNode(); | |
| 403 } | 399 } |
| 404 | 400 |
| 405 // static | 401 // static |
| 406 bool AccessibleNode::GetPropertyOrARIAAttribute( | 402 bool AccessibleNode::GetPropertyOrARIAAttribute( |
| 407 Element* element, | 403 Element* element, |
| 408 AOMRelationListProperty property, | 404 AOMRelationListProperty property, |
| 409 HeapVector<Member<Element>>& targets) { | 405 HeapVector<Member<Element>>& targets) { |
| 410 if (!element) | 406 if (!element) |
| 411 return false; | 407 return false; |
| 412 | 408 |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 return element_->GetDocument().ExistingAXObjectCache(); | 1103 return element_->GetDocument().ExistingAXObjectCache(); |
| 1108 } | 1104 } |
| 1109 | 1105 |
| 1110 DEFINE_TRACE(AccessibleNode) { | 1106 DEFINE_TRACE(AccessibleNode) { |
| 1111 visitor->Trace(element_); | 1107 visitor->Trace(element_); |
| 1112 visitor->Trace(relation_properties_); | 1108 visitor->Trace(relation_properties_); |
| 1113 visitor->Trace(relation_list_properties_); | 1109 visitor->Trace(relation_list_properties_); |
| 1114 } | 1110 } |
| 1115 | 1111 |
| 1116 } // namespace blink | 1112 } // namespace blink |
| OLD | NEW |