| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 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 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 return AXNodeObject::TextAlternative(recursive, in_aria_labelled_by_traversal, | 1257 return AXNodeObject::TextAlternative(recursive, in_aria_labelled_by_traversal, |
| 1258 visited, name_from, related_objects, | 1258 visited, name_from, related_objects, |
| 1259 name_sources); | 1259 name_sources); |
| 1260 } | 1260 } |
| 1261 | 1261 |
| 1262 // | 1262 // |
| 1263 // ARIA attributes. | 1263 // ARIA attributes. |
| 1264 // | 1264 // |
| 1265 | 1265 |
| 1266 void AXLayoutObject::AriaOwnsElements(AXObjectVector& owns) const { | 1266 void AXLayoutObject::AriaOwnsElements(AXObjectVector& owns) const { |
| 1267 AccessibilityChildrenFromAttribute(aria_ownsAttr, owns); | 1267 AccessibilityChildrenFromAOMProperty(AOMRelationListProperty::kOwns, owns); |
| 1268 } | 1268 } |
| 1269 | 1269 |
| 1270 void AXLayoutObject::AriaDescribedbyElements( | 1270 void AXLayoutObject::AriaDescribedbyElements( |
| 1271 AXObjectVector& describedby) const { | 1271 AXObjectVector& describedby) const { |
| 1272 AccessibilityChildrenFromAttribute(aria_describedbyAttr, describedby); | 1272 AccessibilityChildrenFromAOMProperty(AOMRelationListProperty::kDescribedBy, |
| 1273 describedby); |
| 1273 } | 1274 } |
| 1274 | 1275 |
| 1275 void AXLayoutObject::AriaLabelledbyElements(AXObjectVector& labelledby) const { | 1276 void AXLayoutObject::AriaLabelledbyElements(AXObjectVector& labelledby) const { |
| 1276 AccessibilityChildrenFromAttribute(aria_labelledbyAttr, labelledby); | 1277 AccessibilityChildrenFromAOMProperty(AOMRelationListProperty::kLabeledBy, |
| 1278 labelledby); |
| 1277 } | 1279 } |
| 1278 | 1280 |
| 1279 bool AXLayoutObject::AriaHasPopup() const { | 1281 bool AXLayoutObject::AriaHasPopup() const { |
| 1280 return ElementAttributeValue(aria_haspopupAttr); | 1282 return ElementAttributeValue(aria_haspopupAttr); |
| 1281 } | 1283 } |
| 1282 | 1284 |
| 1283 bool AXLayoutObject::AriaRoleHasPresentationalChildren() const { | 1285 bool AXLayoutObject::AriaRoleHasPresentationalChildren() const { |
| 1284 switch (aria_role_) { | 1286 switch (aria_role_) { |
| 1285 case kButtonRole: | 1287 case kButtonRole: |
| 1286 case kSliderRole: | 1288 case kSliderRole: |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2250 return false; | 2252 return false; |
| 2251 | 2253 |
| 2252 // The ARIA spec says a tab item can also be selected if it is aria-labeled by | 2254 // The ARIA spec says a tab item can also be selected if it is aria-labeled by |
| 2253 // a tabpanel that has keyboard focus inside of it, or if a tabpanel in its | 2255 // a tabpanel that has keyboard focus inside of it, or if a tabpanel in its |
| 2254 // aria-controls list has KB focus inside of it. | 2256 // aria-controls list has KB focus inside of it. |
| 2255 AXObject* focused_element = AxObjectCache().FocusedObject(); | 2257 AXObject* focused_element = AxObjectCache().FocusedObject(); |
| 2256 if (!focused_element) | 2258 if (!focused_element) |
| 2257 return false; | 2259 return false; |
| 2258 | 2260 |
| 2259 HeapVector<Member<Element>> elements; | 2261 HeapVector<Member<Element>> elements; |
| 2260 ElementsFromAttribute(elements, aria_controlsAttr); | 2262 if (!HasAOMPropertyOrARIAAttribute(AOMRelationListProperty::kControls, |
| 2263 elements)) |
| 2264 return false; |
| 2261 | 2265 |
| 2262 for (const auto& element : elements) { | 2266 for (const auto& element : elements) { |
| 2263 AXObject* tab_panel = AxObjectCache().GetOrCreate(element); | 2267 AXObject* tab_panel = AxObjectCache().GetOrCreate(element); |
| 2264 | 2268 |
| 2265 // A tab item should only control tab panels. | 2269 // A tab item should only control tab panels. |
| 2266 if (!tab_panel || tab_panel->RoleValue() != kTabPanelRole) | 2270 if (!tab_panel || tab_panel->RoleValue() != kTabPanelRole) |
| 2267 continue; | 2271 continue; |
| 2268 | 2272 |
| 2269 AXObject* check_focus_element = focused_element; | 2273 AXObject* check_focus_element = focused_element; |
| 2270 // Check if the focused element is a descendant of the element controlled by | 2274 // Check if the focused element is a descendant of the element controlled by |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2521 | 2525 |
| 2522 bool AXLayoutObject::ElementAttributeValue( | 2526 bool AXLayoutObject::ElementAttributeValue( |
| 2523 const QualifiedName& attribute_name) const { | 2527 const QualifiedName& attribute_name) const { |
| 2524 if (!layout_object_) | 2528 if (!layout_object_) |
| 2525 return false; | 2529 return false; |
| 2526 | 2530 |
| 2527 return EqualIgnoringASCIICase(GetAttribute(attribute_name), "true"); | 2531 return EqualIgnoringASCIICase(GetAttribute(attribute_name), "true"); |
| 2528 } | 2532 } |
| 2529 | 2533 |
| 2530 } // namespace blink | 2534 } // namespace blink |
| OLD | NEW |