| 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 return !ax_object_cache_; | 374 return !ax_object_cache_; |
| 375 } | 375 } |
| 376 | 376 |
| 377 const AtomicString& AXObjectImpl::GetAOMPropertyOrARIAAttribute( | 377 const AtomicString& AXObjectImpl::GetAOMPropertyOrARIAAttribute( |
| 378 AOMStringProperty property) const { | 378 AOMStringProperty property) const { |
| 379 if (Element* element = this->GetElement()) | 379 if (Element* element = this->GetElement()) |
| 380 return AccessibleNode::GetPropertyOrARIAAttribute(element, property); | 380 return AccessibleNode::GetPropertyOrARIAAttribute(element, property); |
| 381 return g_null_atom; | 381 return g_null_atom; |
| 382 } | 382 } |
| 383 | 383 |
| 384 Element* AXObjectImpl::GetAOMPropertyOrARIAAttribute( |
| 385 AOMRelationProperty property) const { |
| 386 Element* element = this->GetElement(); |
| 387 if (!element) |
| 388 return nullptr; |
| 389 |
| 390 AccessibleNode* target = |
| 391 AccessibleNode::GetPropertyOrARIAAttribute(element, property); |
| 392 return target ? target->element() : nullptr; |
| 393 } |
| 394 |
| 384 bool AXObjectImpl::HasAOMPropertyOrARIAAttribute(AOMBooleanProperty property, | 395 bool AXObjectImpl::HasAOMPropertyOrARIAAttribute(AOMBooleanProperty property, |
| 385 bool& result) const { | 396 bool& result) const { |
| 386 Element* element = this->GetElement(); | 397 Element* element = this->GetElement(); |
| 387 if (!element) | 398 if (!element) |
| 388 return false; | 399 return false; |
| 389 | 400 |
| 390 bool is_null = true; | 401 bool is_null = true; |
| 391 result = | 402 result = |
| 392 AccessibleNode::GetPropertyOrARIAAttribute(element, property, is_null); | 403 AccessibleNode::GetPropertyOrARIAAttribute(element, property, is_null); |
| 393 return !is_null; | 404 return !is_null; |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 UpdateCachedAttributeValuesIfNeeded(); | 834 UpdateCachedAttributeValuesIfNeeded(); |
| 824 return cached_is_presentational_child_; | 835 return cached_is_presentational_child_; |
| 825 } | 836 } |
| 826 | 837 |
| 827 bool AXObjectImpl::CanReceiveAccessibilityFocus() const { | 838 bool AXObjectImpl::CanReceiveAccessibilityFocus() const { |
| 828 const Element* elem = GetElement(); | 839 const Element* elem = GetElement(); |
| 829 if (!elem) | 840 if (!elem) |
| 830 return false; | 841 return false; |
| 831 | 842 |
| 832 // Focusable, and not forwarding the focus somewhere else | 843 // Focusable, and not forwarding the focus somewhere else |
| 833 if (elem->IsFocusable() && !elem->FastHasAttribute(aria_activedescendantAttr)) | 844 if (elem->IsFocusable() && |
| 845 !GetAOMPropertyOrARIAAttribute(AOMRelationProperty::kActiveDescendant)) |
| 834 return true; | 846 return true; |
| 835 | 847 |
| 836 // aria-activedescendant focus | 848 // aria-activedescendant focus |
| 837 return elem->FastHasAttribute(idAttr) && AncestorExposesActiveDescendant(); | 849 return elem->FastHasAttribute(idAttr) && AncestorExposesActiveDescendant(); |
| 838 } | 850 } |
| 839 | 851 |
| 840 bool AXObjectImpl::AncestorExposesActiveDescendant() const { | 852 bool AXObjectImpl::AncestorExposesActiveDescendant() const { |
| 841 UpdateCachedAttributeValuesIfNeeded(); | 853 UpdateCachedAttributeValuesIfNeeded(); |
| 842 return cached_ancestor_exposes_active_descendant_; | 854 return cached_ancestor_exposes_active_descendant_; |
| 843 } | 855 } |
| 844 | 856 |
| 845 bool AXObjectImpl::ComputeAncestorExposesActiveDescendant() const { | 857 bool AXObjectImpl::ComputeAncestorExposesActiveDescendant() const { |
| 846 const AXObjectImpl* parent = ParentObjectUnignored(); | 858 const AXObjectImpl* parent = ParentObjectUnignored(); |
| 847 if (!parent) | 859 if (!parent) |
| 848 return false; | 860 return false; |
| 849 | 861 |
| 850 if (parent->SupportsActiveDescendant() && | 862 if (parent->SupportsActiveDescendant() && |
| 851 parent->HasAttribute(aria_activedescendantAttr)) { | 863 parent->GetAOMPropertyOrARIAAttribute( |
| 864 AOMRelationProperty::kActiveDescendant)) { |
| 852 return true; | 865 return true; |
| 853 } | 866 } |
| 854 | 867 |
| 855 return parent->AncestorExposesActiveDescendant(); | 868 return parent->AncestorExposesActiveDescendant(); |
| 856 } | 869 } |
| 857 | 870 |
| 858 // Simplify whitespace, but preserve a single leading and trailing whitespace | 871 // Simplify whitespace, but preserve a single leading and trailing whitespace |
| 859 // character if it's present. | 872 // character if it's present. |
| 860 // static | 873 // static |
| 861 String AXObjectImpl::CollapseWhitespace(const String& str) { | 874 String AXObjectImpl::CollapseWhitespace(const String& str) { |
| (...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2093 } | 2106 } |
| 2094 | 2107 |
| 2095 DEFINE_TRACE(AXObjectImpl) { | 2108 DEFINE_TRACE(AXObjectImpl) { |
| 2096 visitor->Trace(children_); | 2109 visitor->Trace(children_); |
| 2097 visitor->Trace(parent_); | 2110 visitor->Trace(parent_); |
| 2098 visitor->Trace(cached_live_region_root_); | 2111 visitor->Trace(cached_live_region_root_); |
| 2099 visitor->Trace(ax_object_cache_); | 2112 visitor->Trace(ax_object_cache_); |
| 2100 } | 2113 } |
| 2101 | 2114 |
| 2102 } // namespace blink | 2115 } // namespace blink |
| OLD | NEW |