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

Side by Side Diff: content/browser/accessibility/browser_accessibility.cc

Issue 2969603002: Move two BrowserAccessibility role predicates to ax_role_properties. (Closed)
Patch Set: macos Created 3 years, 5 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/accessibility/browser_accessibility.h" 5 #include "content/browser/accessibility/browser_accessibility.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 if (!parent) 888 if (!parent)
889 return false; 889 return false;
890 890
891 return parent->GetRole() == ui::AX_ROLE_IFRAME_PRESENTATIONAL; 891 return parent->GetRole() == ui::AX_ROLE_IFRAME_PRESENTATIONAL;
892 } 892 }
893 893
894 bool BrowserAccessibility::IsClickable() const { 894 bool BrowserAccessibility::IsClickable() const {
895 return ui::IsRoleClickable(GetRole()); 895 return ui::IsRoleClickable(GetRole());
896 } 896 }
897 897
898 bool BrowserAccessibility::IsControl() const {
899 switch (GetRole()) {
900 case ui::AX_ROLE_BUTTON:
901 case ui::AX_ROLE_CHECK_BOX:
902 case ui::AX_ROLE_COLOR_WELL:
903 case ui::AX_ROLE_COMBO_BOX:
904 case ui::AX_ROLE_DISCLOSURE_TRIANGLE:
905 case ui::AX_ROLE_LIST_BOX:
906 case ui::AX_ROLE_MENU:
907 case ui::AX_ROLE_MENU_BAR:
908 case ui::AX_ROLE_MENU_BUTTON:
909 case ui::AX_ROLE_MENU_ITEM:
910 case ui::AX_ROLE_MENU_ITEM_CHECK_BOX:
911 case ui::AX_ROLE_MENU_ITEM_RADIO:
912 case ui::AX_ROLE_MENU_LIST_OPTION:
913 case ui::AX_ROLE_MENU_LIST_POPUP:
914 case ui::AX_ROLE_POP_UP_BUTTON:
915 case ui::AX_ROLE_RADIO_BUTTON:
916 case ui::AX_ROLE_SCROLL_BAR:
917 case ui::AX_ROLE_SEARCH_BOX:
918 case ui::AX_ROLE_SLIDER:
919 case ui::AX_ROLE_SPIN_BUTTON:
920 case ui::AX_ROLE_SWITCH:
921 case ui::AX_ROLE_TAB:
922 case ui::AX_ROLE_TEXT_FIELD:
923 case ui::AX_ROLE_TOGGLE_BUTTON:
924 case ui::AX_ROLE_TREE:
925 return true;
926 default:
927 return false;
928 }
929 }
930
931 bool BrowserAccessibility::IsMenuRelated() const {
932 switch (GetRole()) {
933 case ui::AX_ROLE_MENU:
934 case ui::AX_ROLE_MENU_BAR:
935 case ui::AX_ROLE_MENU_BUTTON:
936 case ui::AX_ROLE_MENU_ITEM:
937 case ui::AX_ROLE_MENU_ITEM_CHECK_BOX:
938 case ui::AX_ROLE_MENU_ITEM_RADIO:
939 case ui::AX_ROLE_MENU_LIST_OPTION:
940 case ui::AX_ROLE_MENU_LIST_POPUP:
941 return true;
942 default:
943 return false;
944 }
945 }
946
947 bool BrowserAccessibility::IsNativeTextControl() const { 898 bool BrowserAccessibility::IsNativeTextControl() const {
948 const std::string& html_tag = GetStringAttribute(ui::AX_ATTR_HTML_TAG); 899 const std::string& html_tag = GetStringAttribute(ui::AX_ATTR_HTML_TAG);
949 if (html_tag == "input") { 900 if (html_tag == "input") {
950 std::string input_type; 901 std::string input_type;
951 if (!GetHtmlAttribute("type", &input_type)) 902 if (!GetHtmlAttribute("type", &input_type))
952 return true; 903 return true;
953 return input_type.empty() || input_type == "email" || 904 return input_type.empty() || input_type == "email" ||
954 input_type == "password" || input_type == "search" || 905 input_type == "password" || input_type == "search" ||
955 input_type == "tel" || input_type == "text" || input_type == "url" || 906 input_type == "tel" || input_type == "text" || input_type == "url" ||
956 input_type == "number"; 907 input_type == "number";
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 return false; 1111 return false;
1161 } 1112 }
1162 1113
1163 bool BrowserAccessibility::ShouldIgnoreHoveredStateForTesting() { 1114 bool BrowserAccessibility::ShouldIgnoreHoveredStateForTesting() {
1164 BrowserAccessibilityStateImpl* accessibility_state = 1115 BrowserAccessibilityStateImpl* accessibility_state =
1165 BrowserAccessibilityStateImpl::GetInstance(); 1116 BrowserAccessibilityStateImpl::GetInstance();
1166 return accessibility_state->disable_hot_tracking_for_testing(); 1117 return accessibility_state->disable_hot_tracking_for_testing();
1167 } 1118 }
1168 1119
1169 } // namespace content 1120 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility.h ('k') | content/browser/accessibility/browser_accessibility_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698