Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXObject.cpp

Issue 2945773002: Relation properties for Accessibility Object Model phase 1 (Closed)
Patch Set: Fix merge error, format Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
374 return !ax_object_cache_; 374 return !ax_object_cache_;
375 } 375 }
376 376
377 const AtomicString& AXObject::GetAOMPropertyOrARIAAttribute( 377 const AtomicString& AXObject::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* AXObject::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 AXObject::HasAOMPropertyOrARIAAttribute(AOMBooleanProperty property, 395 bool AXObject::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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 UpdateCachedAttributeValuesIfNeeded(); 833 UpdateCachedAttributeValuesIfNeeded();
823 return cached_is_presentational_child_; 834 return cached_is_presentational_child_;
824 } 835 }
825 836
826 bool AXObject::CanReceiveAccessibilityFocus() const { 837 bool AXObject::CanReceiveAccessibilityFocus() const {
827 const Element* elem = GetElement(); 838 const Element* elem = GetElement();
828 if (!elem) 839 if (!elem)
829 return false; 840 return false;
830 841
831 // Focusable, and not forwarding the focus somewhere else 842 // Focusable, and not forwarding the focus somewhere else
832 if (elem->IsFocusable() && !elem->FastHasAttribute(aria_activedescendantAttr)) 843 if (elem->IsFocusable() &&
844 !GetAOMPropertyOrARIAAttribute(AOMRelationProperty::kActiveDescendant))
833 return true; 845 return true;
834 846
835 // aria-activedescendant focus 847 // aria-activedescendant focus
836 return elem->FastHasAttribute(idAttr) && AncestorExposesActiveDescendant(); 848 return elem->FastHasAttribute(idAttr) && AncestorExposesActiveDescendant();
837 } 849 }
838 850
839 bool AXObject::AncestorExposesActiveDescendant() const { 851 bool AXObject::AncestorExposesActiveDescendant() const {
840 UpdateCachedAttributeValuesIfNeeded(); 852 UpdateCachedAttributeValuesIfNeeded();
841 return cached_ancestor_exposes_active_descendant_; 853 return cached_ancestor_exposes_active_descendant_;
842 } 854 }
843 855
844 bool AXObject::ComputeAncestorExposesActiveDescendant() const { 856 bool AXObject::ComputeAncestorExposesActiveDescendant() const {
845 const AXObject* parent = ParentObjectUnignored(); 857 const AXObject* parent = ParentObjectUnignored();
846 if (!parent) 858 if (!parent)
847 return false; 859 return false;
848 860
849 if (parent->SupportsActiveDescendant() && 861 if (parent->SupportsActiveDescendant() &&
850 parent->HasAttribute(aria_activedescendantAttr)) { 862 parent->GetAOMPropertyOrARIAAttribute(
863 AOMRelationProperty::kActiveDescendant)) {
851 return true; 864 return true;
852 } 865 }
853 866
854 return parent->AncestorExposesActiveDescendant(); 867 return parent->AncestorExposesActiveDescendant();
855 } 868 }
856 869
857 // Simplify whitespace, but preserve a single leading and trailing whitespace 870 // Simplify whitespace, but preserve a single leading and trailing whitespace
858 // character if it's present. 871 // character if it's present.
859 // static 872 // static
860 String AXObject::CollapseWhitespace(const String& str) { 873 String AXObject::CollapseWhitespace(const String& str) {
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after
2087 } 2100 }
2088 2101
2089 DEFINE_TRACE(AXObject) { 2102 DEFINE_TRACE(AXObject) {
2090 visitor->Trace(children_); 2103 visitor->Trace(children_);
2091 visitor->Trace(parent_); 2104 visitor->Trace(parent_);
2092 visitor->Trace(cached_live_region_root_); 2105 visitor->Trace(cached_live_region_root_);
2093 visitor->Trace(ax_object_cache_); 2106 visitor->Trace(ax_object_cache_);
2094 } 2107 }
2095 2108
2096 } // namespace blink 2109 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698