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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
385 AOMRelationProperty property) const { | 385 AOMRelationProperty property) const { |
386 Element* element = this->GetElement(); | 386 Element* element = this->GetElement(); |
387 if (!element) | 387 if (!element) |
388 return nullptr; | 388 return nullptr; |
389 | 389 |
390 AccessibleNode* target = | 390 AccessibleNode* target = |
391 AccessibleNode::GetPropertyOrARIAAttribute(element, property); | 391 AccessibleNode::GetPropertyOrARIAAttribute(element, property); |
392 return target ? target->element() : nullptr; | 392 return target ? target->element() : nullptr; |
393 } | 393 } |
394 | 394 |
395 bool AXObject::HasAOMProperty(AOMRelationListProperty property, | |
396 HeapVector<Member<Element>>& result) const { | |
397 Element* element = this->GetElement(); | |
398 if (!element) | |
399 return false; | |
400 | |
401 return AccessibleNode::GetProperty(element, property, result); | |
402 } | |
403 | |
404 bool AXObject::HasAOMPropertyOrARIAAttribute( | |
405 AOMRelationListProperty property, | |
406 HeapVector<Member<Element>>& result) const { | |
407 Element* element = this->GetElement(); | |
408 if (!element) | |
409 return false; | |
410 | |
411 return AccessibleNode::GetPropertyOrARIAAttribute(element, property, result); | |
412 } | |
413 | |
395 bool AXObject::HasAOMPropertyOrARIAAttribute(AOMBooleanProperty property, | 414 bool AXObject::HasAOMPropertyOrARIAAttribute(AOMBooleanProperty property, |
396 bool& result) const { | 415 bool& result) const { |
397 Element* element = this->GetElement(); | 416 Element* element = this->GetElement(); |
398 if (!element) | 417 if (!element) |
399 return false; | 418 return false; |
400 | 419 |
401 bool is_null = true; | 420 bool is_null = true; |
402 result = | 421 result = |
403 AccessibleNode::GetPropertyOrARIAAttribute(element, property, is_null); | 422 AccessibleNode::GetPropertyOrARIAAttribute(element, property, is_null); |
404 return !is_null; | 423 return !is_null; |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
968 | 987 |
969 // Step 2A from: http://www.w3.org/TR/accname-aam-1.1 | 988 // Step 2A from: http://www.w3.org/TR/accname-aam-1.1 |
970 // If you change this logic, update AXNodeObject::nameFromLabelElement, too. | 989 // If you change this logic, update AXNodeObject::nameFromLabelElement, too. |
971 if (!in_aria_labelled_by_traversal && | 990 if (!in_aria_labelled_by_traversal && |
972 IsHiddenForTextAlternativeCalculation()) { | 991 IsHiddenForTextAlternativeCalculation()) { |
973 *found_text_alternative = true; | 992 *found_text_alternative = true; |
974 return String(); | 993 return String(); |
975 } | 994 } |
976 | 995 |
977 // Step 2B from: http://www.w3.org/TR/accname-aam-1.1 | 996 // Step 2B from: http://www.w3.org/TR/accname-aam-1.1 |
997 // AOM version | |
998 // If you change this logic, update AXNodeObject::nameFromLabelElement, too. | |
999 if (!in_aria_labelled_by_traversal && !already_visited) { | |
1000 name_from = kAXNameFromRelatedElement; | |
1001 if (name_sources) { | |
1002 name_sources->push_back( | |
1003 NameSource(*found_text_alternative, aria_labeledbyAttr)); | |
aboxhall
2017/07/06 05:37:14
Hm, I think we should have a different source for
dmazzoni
2017/07/06 06:34:25
For aria-label and almost every other place in the
aboxhall
2017/07/06 06:55:15
Makes sense!
| |
1004 name_sources->back().type = name_from; | |
1005 } | |
1006 | |
1007 HeapVector<Member<Element>> elements; | |
1008 if (HasAOMProperty(AOMRelationListProperty::kLabeledBy, elements)) { | |
1009 // Operate on a copy of |visited| so that if |nameSources| is not null, | |
1010 // the set of visited objects is preserved unmodified for future | |
1011 // calculations. | |
1012 AXObjectSet visited_copy = visited; | |
1013 text_alternative = | |
1014 TextFromElements(true, visited_copy, elements, related_objects); | |
1015 if (!text_alternative.IsNull()) { | |
1016 if (name_sources) { | |
1017 NameSource& source = name_sources->back(); | |
1018 source.type = name_from; | |
1019 source.related_objects = *related_objects; | |
1020 source.text = text_alternative; | |
1021 *found_text_alternative = true; | |
1022 } else { | |
1023 *found_text_alternative = true; | |
1024 return text_alternative; | |
1025 } | |
1026 } else if (name_sources) { | |
1027 name_sources->back().invalid = true; | |
1028 } | |
1029 } | |
1030 } | |
1031 | |
1032 // Step 2B from: http://www.w3.org/TR/accname-aam-1.1 | |
1033 // ARIA version | |
978 // If you change this logic, update AXNodeObject::nameFromLabelElement, too. | 1034 // If you change this logic, update AXNodeObject::nameFromLabelElement, too. |
979 if (!in_aria_labelled_by_traversal && !already_visited) { | 1035 if (!in_aria_labelled_by_traversal && !already_visited) { |
980 const QualifiedName& attr = | 1036 const QualifiedName& attr = |
981 HasAttribute(aria_labeledbyAttr) && !HasAttribute(aria_labelledbyAttr) | 1037 HasAttribute(aria_labeledbyAttr) && !HasAttribute(aria_labelledbyAttr) |
982 ? aria_labeledbyAttr | 1038 ? aria_labeledbyAttr |
983 : aria_labelledbyAttr; | 1039 : aria_labelledbyAttr; |
984 name_from = kAXNameFromRelatedElement; | 1040 name_from = kAXNameFromRelatedElement; |
985 if (name_sources) { | 1041 if (name_sources) { |
986 name_sources->push_back(NameSource(*found_text_alternative, attr)); | 1042 name_sources->push_back(NameSource(*found_text_alternative, attr)); |
987 name_sources->back().type = name_from; | 1043 name_sources->back().type = name_from; |
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2100 } | 2156 } |
2101 | 2157 |
2102 DEFINE_TRACE(AXObject) { | 2158 DEFINE_TRACE(AXObject) { |
2103 visitor->Trace(children_); | 2159 visitor->Trace(children_); |
2104 visitor->Trace(parent_); | 2160 visitor->Trace(parent_); |
2105 visitor->Trace(cached_live_region_root_); | 2161 visitor->Trace(cached_live_region_root_); |
2106 visitor->Trace(ax_object_cache_); | 2162 visitor->Trace(ax_object_cache_); |
2107 } | 2163 } |
2108 | 2164 |
2109 } // namespace blink | 2165 } // namespace blink |
OLD | NEW |