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

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

Issue 2793913007: Switch to equalIgnoringASCIICase throughout modules/accessibility (Closed)
Patch Set: Created 3 years, 8 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 return parent; 589 return parent;
590 590
591 return parent->leafNodeAncestor(); 591 return parent->leafNodeAncestor();
592 } 592 }
593 593
594 return 0; 594 return 0;
595 } 595 }
596 596
597 const AXObject* AXObject::ariaHiddenRoot() const { 597 const AXObject* AXObject::ariaHiddenRoot() const {
598 for (const AXObject* object = this; object; object = object->parentObject()) { 598 for (const AXObject* object = this; object; object = object->parentObject()) {
599 if (equalIgnoringCase(object->getAttribute(aria_hiddenAttr), "true")) 599 if (equalIgnoringASCIICase(object->getAttribute(aria_hiddenAttr), "true"))
600 return object; 600 return object;
601 } 601 }
602 602
603 return 0; 603 return 0;
604 } 604 }
605 605
606 bool AXObject::isDescendantOfDisabledNode() const { 606 bool AXObject::isDescendantOfDisabledNode() const {
607 updateCachedAttributeValuesIfNeeded(); 607 updateCachedAttributeValuesIfNeeded();
608 return m_cachedIsDescendantOfDisabledNode; 608 return m_cachedIsDescendantOfDisabledNode;
609 } 609 }
610 610
611 const AXObject* AXObject::disabledAncestor() const { 611 const AXObject* AXObject::disabledAncestor() const {
612 const AtomicString& disabled = getAttribute(aria_disabledAttr); 612 const AtomicString& disabled = getAttribute(aria_disabledAttr);
613 if (equalIgnoringCase(disabled, "true")) 613 if (equalIgnoringASCIICase(disabled, "true"))
614 return this; 614 return this;
615 if (equalIgnoringCase(disabled, "false")) 615 if (equalIgnoringASCIICase(disabled, "false"))
616 return 0; 616 return 0;
617 617
618 if (AXObject* parent = parentObject()) 618 if (AXObject* parent = parentObject())
619 return parent->disabledAncestor(); 619 return parent->disabledAncestor();
620 620
621 return 0; 621 return 0;
622 } 622 }
623 623
624 bool AXObject::lastKnownIsIgnoredValue() { 624 bool AXObject::lastKnownIsIgnoredValue() {
625 if (m_lastKnownIsIgnoredValue == DefaultBehavior) 625 if (m_lastKnownIsIgnoredValue == DefaultBehavior)
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 AXObjectSet& visited) { 716 AXObjectSet& visited) {
717 if (visited.contains(&axObj) && !inAriaLabelledByTraversal) 717 if (visited.contains(&axObj) && !inAriaLabelledByTraversal)
718 return String(); 718 return String();
719 719
720 AXNameFrom tmpNameFrom; 720 AXNameFrom tmpNameFrom;
721 return axObj.textAlternative(true, inAriaLabelledByTraversal, visited, 721 return axObj.textAlternative(true, inAriaLabelledByTraversal, visited,
722 tmpNameFrom, nullptr, nullptr); 722 tmpNameFrom, nullptr, nullptr);
723 } 723 }
724 724
725 bool AXObject::isHiddenForTextAlternativeCalculation() const { 725 bool AXObject::isHiddenForTextAlternativeCalculation() const {
726 if (equalIgnoringCase(getAttribute(aria_hiddenAttr), "false")) 726 if (equalIgnoringASCIICase(getAttribute(aria_hiddenAttr), "false"))
727 return false; 727 return false;
728 728
729 if (getLayoutObject()) 729 if (getLayoutObject())
730 return getLayoutObject()->style()->visibility() != EVisibility::kVisible; 730 return getLayoutObject()->style()->visibility() != EVisibility::kVisible;
731 731
732 // This is an obscure corner case: if a node has no LayoutObject, that means 732 // This is an obscure corner case: if a node has no LayoutObject, that means
733 // it's not rendered, but we still may be exploring it as part of a text 733 // it's not rendered, but we still may be exploring it as part of a text
734 // alternative calculation, for example if it was explicitly referenced by 734 // alternative calculation, for example if it was explicitly referenced by
735 // aria-labelledby. So we need to explicitly call the style resolver to check 735 // aria-labelledby. So we need to explicitly call the style resolver to check
736 // whether it's invisible or display:none, rather than relying on the style 736 // whether it's invisible or display:none, rather than relying on the style
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 case PopUpButtonRole: 948 case PopUpButtonRole:
949 return AXSupportedAction::Open; 949 return AXSupportedAction::Open;
950 default: 950 default:
951 return AXSupportedAction::Click; 951 return AXSupportedAction::Click;
952 } 952 }
953 } 953 }
954 954
955 AccessibilityButtonState AXObject::checkboxOrRadioValue() const { 955 AccessibilityButtonState AXObject::checkboxOrRadioValue() const {
956 const AtomicString& checkedAttribute = 956 const AtomicString& checkedAttribute =
957 getAOMPropertyOrARIAAttribute(AOMStringProperty::kChecked); 957 getAOMPropertyOrARIAAttribute(AOMStringProperty::kChecked);
958 if (equalIgnoringCase(checkedAttribute, "true")) 958 if (equalIgnoringASCIICase(checkedAttribute, "true"))
959 return ButtonStateOn; 959 return ButtonStateOn;
960 960
961 if (equalIgnoringCase(checkedAttribute, "mixed")) { 961 if (equalIgnoringASCIICase(checkedAttribute, "mixed")) {
962 // Only checkboxes should support the mixed state. 962 // Only checkboxes should support the mixed state.
963 AccessibilityRole role = ariaRoleAttribute(); 963 AccessibilityRole role = ariaRoleAttribute();
964 if (role == CheckBoxRole || role == MenuItemCheckBoxRole) 964 if (role == CheckBoxRole || role == MenuItemCheckBoxRole)
965 return ButtonStateMixed; 965 return ButtonStateMixed;
966 } 966 }
967 967
968 return ButtonStateOff; 968 return ButtonStateOff;
969 } 969 }
970 970
971 bool AXObject::isMultiline() const { 971 bool AXObject::isMultiline() const {
972 Node* node = this->getNode(); 972 Node* node = this->getNode();
973 if (!node) 973 if (!node)
974 return false; 974 return false;
975 975
976 if (isHTMLTextAreaElement(*node)) 976 if (isHTMLTextAreaElement(*node))
977 return true; 977 return true;
978 978
979 if (hasEditableStyle(*node)) 979 if (hasEditableStyle(*node))
980 return true; 980 return true;
981 981
982 if (!isNativeTextControl() && !isNonNativeTextControl()) 982 if (!isNativeTextControl() && !isNonNativeTextControl())
983 return false; 983 return false;
984 984
985 return equalIgnoringCase(getAttribute(aria_multilineAttr), "true"); 985 return equalIgnoringASCIICase(getAttribute(aria_multilineAttr), "true");
986 } 986 }
987 987
988 bool AXObject::ariaPressedIsPresent() const { 988 bool AXObject::ariaPressedIsPresent() const {
989 return !getAttribute(aria_pressedAttr).isEmpty(); 989 return !getAttribute(aria_pressedAttr).isEmpty();
990 } 990 }
991 991
992 bool AXObject::supportsActiveDescendant() const { 992 bool AXObject::supportsActiveDescendant() const {
993 // According to the ARIA Spec, all ARIA composite widgets, ARIA text boxes 993 // According to the ARIA Spec, all ARIA composite widgets, ARIA text boxes
994 // and ARIA groups should be able to expose an active descendant. 994 // and ARIA groups should be able to expose an active descendant.
995 // Implicitly, <input> and <textarea> elements should also have this ability. 995 // Implicitly, <input> and <textarea> elements should also have this ability.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 for (int index = 0; index < childCount; ++index) { 1056 for (int index = 0; index < childCount; ++index) {
1057 if (siblings[index].get() == this) { 1057 if (siblings[index].get() == this) {
1058 return index; 1058 return index;
1059 } 1059 }
1060 } 1060 }
1061 return 0; 1061 return 0;
1062 } 1062 }
1063 1063
1064 bool AXObject::isLiveRegion() const { 1064 bool AXObject::isLiveRegion() const {
1065 const AtomicString& liveRegion = liveRegionStatus(); 1065 const AtomicString& liveRegion = liveRegionStatus();
1066 return equalIgnoringCase(liveRegion, "polite") || 1066 return equalIgnoringASCIICase(liveRegion, "polite") ||
1067 equalIgnoringCase(liveRegion, "assertive"); 1067 equalIgnoringASCIICase(liveRegion, "assertive");
1068 } 1068 }
1069 1069
1070 AXObject* AXObject::liveRegionRoot() const { 1070 AXObject* AXObject::liveRegionRoot() const {
1071 updateCachedAttributeValuesIfNeeded(); 1071 updateCachedAttributeValuesIfNeeded();
1072 return m_cachedLiveRegionRoot; 1072 return m_cachedLiveRegionRoot;
1073 } 1073 }
1074 1074
1075 const AtomicString& AXObject::containerLiveRegionStatus() const { 1075 const AtomicString& AXObject::containerLiveRegionStatus() const {
1076 updateCachedAttributeValuesIfNeeded(); 1076 updateCachedAttributeValuesIfNeeded();
1077 return m_cachedLiveRegionRoot ? m_cachedLiveRegionRoot->liveRegionStatus() 1077 return m_cachedLiveRegionRoot ? m_cachedLiveRegionRoot->liveRegionStatus()
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
1787 } 1787 }
1788 1788
1789 DEFINE_TRACE(AXObject) { 1789 DEFINE_TRACE(AXObject) {
1790 visitor->trace(m_children); 1790 visitor->trace(m_children);
1791 visitor->trace(m_parent); 1791 visitor->trace(m_parent);
1792 visitor->trace(m_cachedLiveRegionRoot); 1792 visitor->trace(m_cachedLiveRegionRoot);
1793 visitor->trace(m_axObjectCache); 1793 visitor->trace(m_axObjectCache);
1794 } 1794 }
1795 1795
1796 } // namespace blink 1796 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698