| 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 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 UpdateCachedAttributeValuesIfNeeded(); | 767 UpdateCachedAttributeValuesIfNeeded(); |
| 768 return cached_ancestor_exposes_active_descendant_; | 768 return cached_ancestor_exposes_active_descendant_; |
| 769 } | 769 } |
| 770 | 770 |
| 771 bool AXObjectImpl::ComputeAncestorExposesActiveDescendant() const { | 771 bool AXObjectImpl::ComputeAncestorExposesActiveDescendant() const { |
| 772 const AXObjectImpl* parent = ParentObjectUnignored(); | 772 const AXObjectImpl* parent = ParentObjectUnignored(); |
| 773 if (!parent) | 773 if (!parent) |
| 774 return false; | 774 return false; |
| 775 | 775 |
| 776 if (parent->SupportsActiveDescendant() && | 776 if (parent->SupportsActiveDescendant() && |
| 777 !parent->GetAttribute(aria_activedescendantAttr).IsEmpty()) { | 777 parent->HasAttribute(aria_activedescendantAttr)) { |
| 778 return true; | 778 return true; |
| 779 } | 779 } |
| 780 | 780 |
| 781 return parent->AncestorExposesActiveDescendant(); | 781 return parent->AncestorExposesActiveDescendant(); |
| 782 } | 782 } |
| 783 | 783 |
| 784 // Simplify whitespace, but preserve a single leading and trailing whitespace | 784 // Simplify whitespace, but preserve a single leading and trailing whitespace |
| 785 // character if it's present. | 785 // character if it's present. |
| 786 // static | 786 // static |
| 787 String AXObjectImpl::CollapseWhitespace(const String& str) { | 787 String AXObjectImpl::CollapseWhitespace(const String& str) { |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 | 1248 |
| 1249 AXObjectImpl* AXObjectImpl::ParentObjectUnignored() const { | 1249 AXObjectImpl* AXObjectImpl::ParentObjectUnignored() const { |
| 1250 AXObjectImpl* parent; | 1250 AXObjectImpl* parent; |
| 1251 for (parent = ParentObject(); parent && parent->AccessibilityIsIgnored(); | 1251 for (parent = ParentObject(); parent && parent->AccessibilityIsIgnored(); |
| 1252 parent = parent->ParentObject()) { | 1252 parent = parent->ParentObject()) { |
| 1253 } | 1253 } |
| 1254 | 1254 |
| 1255 return parent; | 1255 return parent; |
| 1256 } | 1256 } |
| 1257 | 1257 |
| 1258 // Container widgets are those that a user tabs into and arrows around |
| 1259 // sub-widgets |
| 1260 bool AXObjectImpl::IsContainerWidget() const { |
| 1261 switch (RoleValue()) { |
| 1262 case kComboBoxRole: |
| 1263 case kGridRole: |
| 1264 case kListBoxRole: |
| 1265 case kMenuBarRole: |
| 1266 case kMenuRole: |
| 1267 case kRadioGroupRole: |
| 1268 case kSpinButtonRole: |
| 1269 case kTabListRole: |
| 1270 case kToolbarRole: |
| 1271 case kTreeGridRole: |
| 1272 case kTreeRole: |
| 1273 return true; |
| 1274 default: |
| 1275 return false; |
| 1276 } |
| 1277 } |
| 1278 |
| 1279 AXObjectImpl* AXObjectImpl::ContainerWidget() const { |
| 1280 AXObjectImpl* ancestor = ParentObjectUnignored(); |
| 1281 while (ancestor && !ancestor->IsContainerWidget()) |
| 1282 ancestor = ancestor->ParentObjectUnignored(); |
| 1283 |
| 1284 return ancestor; |
| 1285 } |
| 1286 |
| 1258 void AXObjectImpl::UpdateChildrenIfNecessary() { | 1287 void AXObjectImpl::UpdateChildrenIfNecessary() { |
| 1259 if (!HasChildren()) | 1288 if (!HasChildren()) |
| 1260 AddChildren(); | 1289 AddChildren(); |
| 1261 } | 1290 } |
| 1262 | 1291 |
| 1263 void AXObjectImpl::ClearChildren() { | 1292 void AXObjectImpl::ClearChildren() { |
| 1264 // Detach all weak pointers from objects to their parents. | 1293 // Detach all weak pointers from objects to their parents. |
| 1265 for (const auto& child : children_) | 1294 for (const auto& child : children_) |
| 1266 child->DetachFromParent(); | 1295 child->DetachFromParent(); |
| 1267 | 1296 |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2022 } | 2051 } |
| 2023 | 2052 |
| 2024 DEFINE_TRACE(AXObjectImpl) { | 2053 DEFINE_TRACE(AXObjectImpl) { |
| 2025 visitor->Trace(children_); | 2054 visitor->Trace(children_); |
| 2026 visitor->Trace(parent_); | 2055 visitor->Trace(parent_); |
| 2027 visitor->Trace(cached_live_region_root_); | 2056 visitor->Trace(cached_live_region_root_); |
| 2028 visitor->Trace(ax_object_cache_); | 2057 visitor->Trace(ax_object_cache_); |
| 2029 } | 2058 } |
| 2030 | 2059 |
| 2031 } // namespace blink | 2060 } // namespace blink |
| OLD | NEW |