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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 378 |
379 ax_object_cache_ = nullptr; | 379 ax_object_cache_ = nullptr; |
380 } | 380 } |
381 | 381 |
382 bool AXObject::IsDetached() const { | 382 bool AXObject::IsDetached() const { |
383 return !ax_object_cache_; | 383 return !ax_object_cache_; |
384 } | 384 } |
385 | 385 |
386 const AtomicString& AXObject::GetAOMPropertyOrARIAAttribute( | 386 const AtomicString& AXObject::GetAOMPropertyOrARIAAttribute( |
387 AOMStringProperty property) const { | 387 AOMStringProperty property) const { |
388 Node* node = this->GetNode(); | 388 if (Element* element = this->GetElement()) |
389 if (!node || !node->IsElementNode()) | 389 return AccessibleNode::GetProperty(element, property); |
390 return g_null_atom; | 390 return g_null_atom; |
| 391 } |
391 | 392 |
392 return AccessibleNode::GetProperty(ToElement(node), property); | 393 bool AXObject::HasAOMPropertyOrARIAAttribute(AOMBooleanProperty property, |
| 394 bool& result) const { |
| 395 Element* element = this->GetElement(); |
| 396 if (!element) |
| 397 return false; |
| 398 |
| 399 bool is_null = true; |
| 400 result = AccessibleNode::GetProperty(element, property, is_null); |
| 401 return !is_null; |
| 402 } |
| 403 |
| 404 bool AXObject::AOMPropertyOrARIAAttributeIsTrue( |
| 405 AOMBooleanProperty property) const { |
| 406 bool result; |
| 407 if (HasAOMPropertyOrARIAAttribute(property, result)) |
| 408 return result; |
| 409 return false; |
| 410 } |
| 411 |
| 412 bool AXObject::AOMPropertyOrARIAAttributeIsFalse( |
| 413 AOMBooleanProperty property) const { |
| 414 bool result; |
| 415 if (HasAOMPropertyOrARIAAttribute(property, result)) |
| 416 return !result; |
| 417 return false; |
393 } | 418 } |
394 | 419 |
395 bool AXObject::IsARIATextControl() const { | 420 bool AXObject::IsARIATextControl() const { |
396 return AriaRoleAttribute() == kTextFieldRole || | 421 return AriaRoleAttribute() == kTextFieldRole || |
397 AriaRoleAttribute() == kSearchBoxRole || | 422 AriaRoleAttribute() == kSearchBoxRole || |
398 AriaRoleAttribute() == kComboBoxRole; | 423 AriaRoleAttribute() == kComboBoxRole; |
399 } | 424 } |
400 | 425 |
401 bool AXObject::IsButton() const { | 426 bool AXObject::IsButton() const { |
402 AccessibilityRole role = RoleValue(); | 427 AccessibilityRole role = RoleValue(); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 cached_live_region_root_ = | 585 cached_live_region_root_ = |
561 IsLiveRegion() | 586 IsLiveRegion() |
562 ? const_cast<AXObject*>(this) | 587 ? const_cast<AXObject*>(this) |
563 : (ParentObjectIfExists() ? ParentObjectIfExists()->LiveRegionRoot() | 588 : (ParentObjectIfExists() ? ParentObjectIfExists()->LiveRegionRoot() |
564 : 0); | 589 : 0); |
565 cached_ancestor_exposes_active_descendant_ = | 590 cached_ancestor_exposes_active_descendant_ = |
566 ComputeAncestorExposesActiveDescendant(); | 591 ComputeAncestorExposesActiveDescendant(); |
567 } | 592 } |
568 | 593 |
569 bool AXObject::AccessibilityIsIgnoredByDefault( | 594 bool AXObject::AccessibilityIsIgnoredByDefault( |
570 IgnoredReasons* ignored_reasons) const { | 595 IgnoredReasons* ignoredReasons) const { |
571 return DefaultObjectInclusion(ignored_reasons) == kIgnoreObject; | 596 return DefaultObjectInclusion(ignoredReasons) == kIgnoreObject; |
572 } | 597 } |
573 | 598 |
574 AXObjectInclusion AXObject::AccessibilityPlatformIncludesObject() const { | 599 AXObjectInclusion AXObject::AccessibilityPlatformIncludesObject() const { |
575 if (IsMenuListPopup() || IsMenuListOption()) | 600 if (IsMenuListPopup() || IsMenuListOption()) |
576 return kIncludeObject; | 601 return kIncludeObject; |
577 | 602 |
578 return kDefaultBehavior; | 603 return kDefaultBehavior; |
579 } | 604 } |
580 | 605 |
581 AXObjectInclusion AXObject::DefaultObjectInclusion( | 606 AXObjectInclusion AXObject::DefaultObjectInclusion( |
(...skipping 15 matching lines...) Expand all Loading... |
597 | 622 |
598 return AccessibilityPlatformIncludesObject(); | 623 return AccessibilityPlatformIncludesObject(); |
599 } | 624 } |
600 | 625 |
601 bool AXObject::IsInertOrAriaHidden() const { | 626 bool AXObject::IsInertOrAriaHidden() const { |
602 UpdateCachedAttributeValuesIfNeeded(); | 627 UpdateCachedAttributeValuesIfNeeded(); |
603 return cached_is_inert_or_aria_hidden_; | 628 return cached_is_inert_or_aria_hidden_; |
604 } | 629 } |
605 | 630 |
606 bool AXObject::ComputeIsInertOrAriaHidden( | 631 bool AXObject::ComputeIsInertOrAriaHidden( |
607 IgnoredReasons* ignored_reasons) const { | 632 IgnoredReasons* ignoredReasons) const { |
608 if (GetNode()) { | 633 if (GetNode()) { |
609 if (GetNode()->IsInert()) { | 634 if (GetNode()->IsInert()) { |
610 if (ignored_reasons) { | 635 if (ignoredReasons) { |
611 HTMLDialogElement* dialog = GetActiveDialogElement(GetNode()); | 636 HTMLDialogElement* dialog = GetActiveDialogElement(GetNode()); |
612 if (dialog) { | 637 if (dialog) { |
613 AXObject* dialog_object = AxObjectCache().GetOrCreate(dialog); | 638 AXObject* dialog_object = AxObjectCache().GetOrCreate(dialog); |
614 if (dialog_object) | 639 if (dialog_object) |
615 ignored_reasons->push_back( | 640 ignoredReasons->push_back( |
616 IgnoredReason(kAXActiveModalDialog, dialog_object)); | 641 IgnoredReason(kAXActiveModalDialog, dialog_object)); |
617 else | 642 else |
618 ignored_reasons->push_back(IgnoredReason(kAXInert)); | 643 ignoredReasons->push_back(IgnoredReason(kAXInert)); |
619 } else { | 644 } else { |
620 // TODO(aboxhall): handle inert attribute if it eventuates | 645 // TODO(aboxhall): handle inert attribute if it eventuates |
621 ignored_reasons->push_back(IgnoredReason(kAXInert)); | 646 ignoredReasons->push_back(IgnoredReason(kAXInert)); |
622 } | 647 } |
623 } | 648 } |
624 return true; | 649 return true; |
625 } | 650 } |
626 } else { | 651 } else { |
627 AXObject* parent = ParentObject(); | 652 AXObject* parent = ParentObject(); |
628 if (parent && parent->IsInertOrAriaHidden()) { | 653 if (parent && parent->IsInertOrAriaHidden()) { |
629 if (ignored_reasons) | 654 if (ignoredReasons) |
630 parent->ComputeIsInertOrAriaHidden(ignored_reasons); | 655 parent->ComputeIsInertOrAriaHidden(ignoredReasons); |
631 return true; | 656 return true; |
632 } | 657 } |
633 } | 658 } |
634 | 659 |
635 const AXObject* hidden_root = AriaHiddenRoot(); | 660 const AXObject* hidden_root = AriaHiddenRoot(); |
636 if (hidden_root) { | 661 if (hidden_root) { |
637 if (ignored_reasons) { | 662 if (ignoredReasons) { |
638 if (hidden_root == this) | 663 if (hidden_root == this) |
639 ignored_reasons->push_back(IgnoredReason(kAXAriaHidden)); | 664 ignoredReasons->push_back(IgnoredReason(kAXAriaHidden)); |
640 else | 665 else |
641 ignored_reasons->push_back( | 666 ignoredReasons->push_back( |
642 IgnoredReason(kAXAriaHiddenRoot, hidden_root)); | 667 IgnoredReason(kAXAriaHiddenRoot, hidden_root)); |
643 } | 668 } |
644 return true; | 669 return true; |
645 } | 670 } |
646 | 671 |
647 return false; | 672 return false; |
648 } | 673 } |
649 | 674 |
650 bool AXObject::IsDescendantOfLeafNode() const { | 675 bool AXObject::IsDescendantOfLeafNode() const { |
651 UpdateCachedAttributeValuesIfNeeded(); | 676 UpdateCachedAttributeValuesIfNeeded(); |
652 return cached_is_descendant_of_leaf_node_; | 677 return cached_is_descendant_of_leaf_node_; |
653 } | 678 } |
654 | 679 |
655 AXObject* AXObject::LeafNodeAncestor() const { | 680 AXObject* AXObject::LeafNodeAncestor() const { |
656 if (AXObject* parent = ParentObject()) { | 681 if (AXObject* parent = ParentObject()) { |
657 if (!parent->CanHaveChildren()) | 682 if (!parent->CanHaveChildren()) |
658 return parent; | 683 return parent; |
659 | 684 |
660 return parent->LeafNodeAncestor(); | 685 return parent->LeafNodeAncestor(); |
661 } | 686 } |
662 | 687 |
663 return 0; | 688 return 0; |
664 } | 689 } |
665 | 690 |
666 const AXObject* AXObject::AriaHiddenRoot() const { | 691 const AXObject* AXObject::AriaHiddenRoot() const { |
667 for (const AXObject* object = this; object; object = object->ParentObject()) { | 692 for (const AXObject* object = this; object; object = object->ParentObject()) { |
668 if (EqualIgnoringASCIICase(object->GetAttribute(aria_hiddenAttr), "true")) | 693 if (object->AOMPropertyOrARIAAttributeIsTrue(AOMBooleanProperty::kHidden)) |
669 return object; | 694 return object; |
670 } | 695 } |
671 | 696 |
672 return 0; | 697 return 0; |
673 } | 698 } |
674 | 699 |
675 bool AXObject::IsDescendantOfDisabledNode() const { | 700 bool AXObject::IsDescendantOfDisabledNode() const { |
676 UpdateCachedAttributeValuesIfNeeded(); | 701 UpdateCachedAttributeValuesIfNeeded(); |
677 return cached_is_descendant_of_disabled_node_; | 702 return cached_is_descendant_of_disabled_node_; |
678 } | 703 } |
679 | 704 |
680 const AXObject* AXObject::DisabledAncestor() const { | 705 const AXObject* AXObject::DisabledAncestor() const { |
681 const AtomicString& disabled = GetAttribute(aria_disabledAttr); | 706 bool disabled = false; |
682 if (EqualIgnoringASCIICase(disabled, "true")) | 707 if (HasAOMPropertyOrARIAAttribute(AOMBooleanProperty::kDisabled, disabled)) { |
683 return this; | 708 if (disabled) |
684 if (EqualIgnoringASCIICase(disabled, "false")) | 709 return this; |
685 return 0; | 710 return nullptr; |
| 711 } |
686 | 712 |
687 if (AXObject* parent = ParentObject()) | 713 if (AXObject* parent = ParentObject()) |
688 return parent->DisabledAncestor(); | 714 return parent->DisabledAncestor(); |
689 | 715 |
690 return 0; | 716 return nullptr; |
691 } | 717 } |
692 | 718 |
693 bool AXObject::LastKnownIsIgnoredValue() { | 719 bool AXObject::LastKnownIsIgnoredValue() { |
694 if (last_known_is_ignored_value_ == kDefaultBehavior) | 720 if (last_known_is_ignored_value_ == kDefaultBehavior) |
695 last_known_is_ignored_value_ = | 721 last_known_is_ignored_value_ = |
696 AccessibilityIsIgnored() ? kIgnoreObject : kIncludeObject; | 722 AccessibilityIsIgnored() ? kIgnoreObject : kIncludeObject; |
697 | 723 |
698 return last_known_is_ignored_value_ == kIgnoreObject; | 724 return last_known_is_ignored_value_ == kIgnoreObject; |
699 } | 725 } |
700 | 726 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 AXObjectSet& visited) { | 811 AXObjectSet& visited) { |
786 if (visited.Contains(&ax_obj) && !in_aria_labelled_by_traversal) | 812 if (visited.Contains(&ax_obj) && !in_aria_labelled_by_traversal) |
787 return String(); | 813 return String(); |
788 | 814 |
789 AXNameFrom tmp_name_from; | 815 AXNameFrom tmp_name_from; |
790 return ax_obj.TextAlternative(true, in_aria_labelled_by_traversal, visited, | 816 return ax_obj.TextAlternative(true, in_aria_labelled_by_traversal, visited, |
791 tmp_name_from, nullptr, nullptr); | 817 tmp_name_from, nullptr, nullptr); |
792 } | 818 } |
793 | 819 |
794 bool AXObject::IsHiddenForTextAlternativeCalculation() const { | 820 bool AXObject::IsHiddenForTextAlternativeCalculation() const { |
795 if (EqualIgnoringASCIICase(GetAttribute(aria_hiddenAttr), "false")) | 821 if (AOMPropertyOrARIAAttributeIsFalse(AOMBooleanProperty::kHidden)) |
796 return false; | 822 return false; |
797 | 823 |
798 if (GetLayoutObject()) | 824 if (GetLayoutObject()) |
799 return GetLayoutObject()->Style()->Visibility() != EVisibility::kVisible; | 825 return GetLayoutObject()->Style()->Visibility() != EVisibility::kVisible; |
800 | 826 |
801 // This is an obscure corner case: if a node has no LayoutObject, that means | 827 // This is an obscure corner case: if a node has no LayoutObject, that means |
802 // it's not rendered, but we still may be exploring it as part of a text | 828 // it's not rendered, but we still may be exploring it as part of a text |
803 // alternative calculation, for example if it was explicitly referenced by | 829 // alternative calculation, for example if it was explicitly referenced by |
804 // aria-labelledby. So we need to explicitly call the style resolver to check | 830 // aria-labelledby. So we need to explicitly call the style resolver to check |
805 // whether it's invisible or display:none, rather than relying on the style | 831 // whether it's invisible or display:none, rather than relying on the style |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 } | 957 } |
932 if (!found_valid_element) | 958 if (!found_valid_element) |
933 return String(); | 959 return String(); |
934 if (related_objects) | 960 if (related_objects) |
935 *related_objects = local_related_objects; | 961 *related_objects = local_related_objects; |
936 return accumulated_text.ToString(); | 962 return accumulated_text.ToString(); |
937 } | 963 } |
938 | 964 |
939 void AXObject::TokenVectorFromAttribute(Vector<String>& tokens, | 965 void AXObject::TokenVectorFromAttribute(Vector<String>& tokens, |
940 const QualifiedName& attribute) const { | 966 const QualifiedName& attribute) const { |
941 Node* node = this->GetNode(); | |
942 if (!node || !node->IsElementNode()) | |
943 return; | |
944 | |
945 String attribute_value = GetAttribute(attribute).GetString(); | 967 String attribute_value = GetAttribute(attribute).GetString(); |
946 if (attribute_value.IsEmpty()) | 968 if (attribute_value.IsEmpty()) |
947 return; | 969 return; |
948 | 970 |
949 attribute_value.SimplifyWhiteSpace(); | 971 attribute_value.SimplifyWhiteSpace(); |
950 attribute_value.Split(' ', tokens); | 972 attribute_value.Split(' ', tokens); |
951 } | 973 } |
952 | 974 |
953 void AXObject::ElementsFromAttribute(HeapVector<Member<Element>>& elements, | 975 void AXObject::ElementsFromAttribute(HeapVector<Member<Element>>& elements, |
954 const QualifiedName& attribute) const { | 976 const QualifiedName& attribute) const { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 | 1053 |
1032 if (isHTMLTextAreaElement(*node)) | 1054 if (isHTMLTextAreaElement(*node)) |
1033 return true; | 1055 return true; |
1034 | 1056 |
1035 if (HasEditableStyle(*node)) | 1057 if (HasEditableStyle(*node)) |
1036 return true; | 1058 return true; |
1037 | 1059 |
1038 if (!IsNativeTextControl() && !IsNonNativeTextControl()) | 1060 if (!IsNativeTextControl() && !IsNonNativeTextControl()) |
1039 return false; | 1061 return false; |
1040 | 1062 |
1041 return EqualIgnoringASCIICase(GetAttribute(aria_multilineAttr), "true"); | 1063 return AOMPropertyOrARIAAttributeIsTrue(AOMBooleanProperty::kMultiline); |
1042 } | 1064 } |
1043 | 1065 |
1044 bool AXObject::AriaPressedIsPresent() const { | 1066 bool AXObject::AriaPressedIsPresent() const { |
1045 return !GetAttribute(aria_pressedAttr).IsEmpty(); | 1067 return !GetAttribute(aria_pressedAttr).IsEmpty(); |
1046 } | 1068 } |
1047 | 1069 |
1048 bool AXObject::SupportsActiveDescendant() const { | 1070 bool AXObject::SupportsActiveDescendant() const { |
1049 // According to the ARIA Spec, all ARIA composite widgets, ARIA text boxes | 1071 // According to the ARIA Spec, all ARIA composite widgets, ARIA text boxes |
1050 // and ARIA groups should be able to expose an active descendant. | 1072 // and ARIA groups should be able to expose an active descendant. |
1051 // Implicitly, <input> and <textarea> elements should also have this ability. | 1073 // Implicitly, <input> and <textarea> elements should also have this ability. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 | 1230 |
1209 void AXObject::ClearChildren() { | 1231 void AXObject::ClearChildren() { |
1210 // Detach all weak pointers from objects to their parents. | 1232 // Detach all weak pointers from objects to their parents. |
1211 for (const auto& child : children_) | 1233 for (const auto& child : children_) |
1212 child->DetachFromParent(); | 1234 child->DetachFromParent(); |
1213 | 1235 |
1214 children_.clear(); | 1236 children_.clear(); |
1215 have_children_ = false; | 1237 have_children_ = false; |
1216 } | 1238 } |
1217 | 1239 |
| 1240 Element* AXObject::GetElement() const { |
| 1241 Node* node = GetNode(); |
| 1242 return node && node->IsElementNode() ? ToElement(node) : nullptr; |
| 1243 } |
| 1244 |
1218 Document* AXObject::GetDocument() const { | 1245 Document* AXObject::GetDocument() const { |
1219 FrameView* frame_view = DocumentFrameView(); | 1246 FrameView* frame_view = DocumentFrameView(); |
1220 if (!frame_view) | 1247 if (!frame_view) |
1221 return 0; | 1248 return 0; |
1222 | 1249 |
1223 return frame_view->GetFrame().GetDocument(); | 1250 return frame_view->GetFrame().GetDocument(); |
1224 } | 1251 } |
1225 | 1252 |
1226 FrameView* AXObject::DocumentFrameView() const { | 1253 FrameView* AXObject::DocumentFrameView() const { |
1227 const AXObject* object = this; | 1254 const AXObject* object = this; |
(...skipping 19 matching lines...) Expand all Loading... |
1247 Document* doc = GetDocument(); | 1274 Document* doc = GetDocument(); |
1248 if (doc) | 1275 if (doc) |
1249 return doc->ContentLanguage(); | 1276 return doc->ContentLanguage(); |
1250 return g_null_atom; | 1277 return g_null_atom; |
1251 } | 1278 } |
1252 | 1279 |
1253 return parent->Language(); | 1280 return parent->Language(); |
1254 } | 1281 } |
1255 | 1282 |
1256 bool AXObject::HasAttribute(const QualifiedName& attribute) const { | 1283 bool AXObject::HasAttribute(const QualifiedName& attribute) const { |
1257 Node* element_node = GetNode(); | 1284 if (Element* element = GetElement()) |
1258 if (!element_node) | 1285 return element->FastHasAttribute(attribute); |
1259 return false; | 1286 return false; |
1260 | |
1261 if (!element_node->IsElementNode()) | |
1262 return false; | |
1263 | |
1264 Element* element = ToElement(element_node); | |
1265 return element->FastHasAttribute(attribute); | |
1266 } | 1287 } |
1267 | 1288 |
1268 const AtomicString& AXObject::GetAttribute( | 1289 const AtomicString& AXObject::GetAttribute( |
1269 const QualifiedName& attribute) const { | 1290 const QualifiedName& attribute) const { |
1270 Node* element_node = GetNode(); | 1291 if (Element* element = GetElement()) |
1271 if (!element_node) | 1292 return element->FastGetAttribute(attribute); |
1272 return g_null_atom; | 1293 return g_null_atom; |
1273 | |
1274 if (!element_node->IsElementNode()) | |
1275 return g_null_atom; | |
1276 | |
1277 Element* element = ToElement(element_node); | |
1278 return element->FastGetAttribute(attribute); | |
1279 } | 1294 } |
1280 | 1295 |
1281 // | 1296 // |
1282 // Scrollable containers. | 1297 // Scrollable containers. |
1283 // | 1298 // |
1284 | 1299 |
1285 bool AXObject::IsScrollableContainer() const { | 1300 bool AXObject::IsScrollableContainer() const { |
1286 return !!GetScrollableAreaIfScrollable(); | 1301 return !!GetScrollableAreaIfScrollable(); |
1287 } | 1302 } |
1288 | 1303 |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1713 previous_position = current_position; | 1728 previous_position = current_position; |
1714 current_position = PreviousLinePosition(current_position, LayoutUnit(), | 1729 current_position = PreviousLinePosition(current_position, LayoutUnit(), |
1715 kHasEditableAXRole); | 1730 kHasEditableAXRole); |
1716 ++line_count; | 1731 ++line_count; |
1717 } while (current_position.IsNotNull() && | 1732 } while (current_position.IsNotNull() && |
1718 !InSameLine(current_position, previous_position)); | 1733 !InSameLine(current_position, previous_position)); |
1719 | 1734 |
1720 return line_count; | 1735 return line_count; |
1721 } | 1736 } |
1722 | 1737 |
1723 bool AXObject::IsARIAControl(AccessibilityRole aria_role) { | 1738 bool AXObject::IsARIAControl(AccessibilityRole ariaRole) { |
1724 return IsARIAInput(aria_role) || aria_role == kButtonRole || | 1739 return IsARIAInput(ariaRole) || ariaRole == kButtonRole || |
1725 aria_role == kComboBoxRole || aria_role == kSliderRole; | 1740 ariaRole == kComboBoxRole || ariaRole == kSliderRole; |
1726 } | 1741 } |
1727 | 1742 |
1728 bool AXObject::IsARIAInput(AccessibilityRole aria_role) { | 1743 bool AXObject::IsARIAInput(AccessibilityRole ariaRole) { |
1729 return aria_role == kRadioButtonRole || aria_role == kCheckBoxRole || | 1744 return ariaRole == kRadioButtonRole || ariaRole == kCheckBoxRole || |
1730 aria_role == kTextFieldRole || aria_role == kSwitchRole || | 1745 ariaRole == kTextFieldRole || ariaRole == kSwitchRole || |
1731 aria_role == kSearchBoxRole; | 1746 ariaRole == kSearchBoxRole; |
1732 } | 1747 } |
1733 | 1748 |
1734 AccessibilityRole AXObject::AriaRoleToWebCoreRole(const String& value) { | 1749 AccessibilityRole AXObject::AriaRoleToWebCoreRole(const String& value) { |
1735 DCHECK(!value.IsEmpty()); | 1750 DCHECK(!value.IsEmpty()); |
1736 | 1751 |
1737 static const ARIARoleMap* role_map = CreateARIARoleMap(); | 1752 static const ARIARoleMap* role_map = CreateARIARoleMap(); |
1738 | 1753 |
1739 Vector<String> role_vector; | 1754 Vector<String> role_vector; |
1740 value.Split(' ', role_vector); | 1755 value.Split(' ', role_vector); |
1741 AccessibilityRole role = kUnknownRole; | 1756 AccessibilityRole role = kUnknownRole; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1820 case kTreeItemRole: | 1835 case kTreeItemRole: |
1821 case kUserInterfaceTooltipRole: | 1836 case kUserInterfaceTooltipRole: |
1822 return true; | 1837 return true; |
1823 case kRowRole: { | 1838 case kRowRole: { |
1824 // Spec says we should always expose the name on rows, | 1839 // Spec says we should always expose the name on rows, |
1825 // but for performance reasons we only do it | 1840 // but for performance reasons we only do it |
1826 // if the row might receive focus | 1841 // if the row might receive focus |
1827 if (AncestorExposesActiveDescendant()) { | 1842 if (AncestorExposesActiveDescendant()) { |
1828 return true; | 1843 return true; |
1829 } | 1844 } |
1830 const Node* node = this->GetNode(); | 1845 const Element* element = this->GetElement(); |
1831 return node && node->IsElementNode() && ToElement(node)->IsFocusable(); | 1846 return element && element->IsFocusable(); |
1832 } | 1847 } |
1833 default: | 1848 default: |
1834 return false; | 1849 return false; |
1835 } | 1850 } |
1836 } | 1851 } |
1837 | 1852 |
1838 AccessibilityRole AXObject::ButtonRoleType() const { | 1853 AccessibilityRole AXObject::ButtonRoleType() const { |
1839 // If aria-pressed is present, then it should be exposed as a toggle button. | 1854 // If aria-pressed is present, then it should be exposed as a toggle button. |
1840 // http://www.w3.org/TR/wai-aria/states_and_properties#aria-pressed | 1855 // http://www.w3.org/TR/wai-aria/states_and_properties#aria-pressed |
1841 if (AriaPressedIsPresent()) | 1856 if (AriaPressedIsPresent()) |
(...skipping 20 matching lines...) Expand all Loading... |
1862 } | 1877 } |
1863 | 1878 |
1864 DEFINE_TRACE(AXObject) { | 1879 DEFINE_TRACE(AXObject) { |
1865 visitor->Trace(children_); | 1880 visitor->Trace(children_); |
1866 visitor->Trace(parent_); | 1881 visitor->Trace(parent_); |
1867 visitor->Trace(cached_live_region_root_); | 1882 visitor->Trace(cached_live_region_root_); |
1868 visitor->Trace(ax_object_cache_); | 1883 visitor->Trace(ax_object_cache_); |
1869 } | 1884 } |
1870 | 1885 |
1871 } // namespace blink | 1886 } // namespace blink |
OLD | NEW |