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

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

Issue 2671563002: MacViews: Implement NSAccessibilityPressAction for Views with clickable roles. (Closed)
Patch Set: Use method instead of private member. Created 3 years, 10 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
« no previous file with comments | « no previous file | ui/accessibility/BUILD.gn » ('j') | ui/accessibility/BUILD.gn » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "content/browser/accessibility/browser_accessibility_manager.h" 14 #include "content/browser/accessibility/browser_accessibility_manager.h"
15 #include "content/common/accessibility_messages.h" 15 #include "content/common/accessibility_messages.h"
16 #include "ui/accessibility/ax_text_utils.h" 16 #include "ui/accessibility/ax_text_utils.h"
17 #include "ui/accessibility/ax_utils.h"
17 #include "ui/accessibility/platform/ax_platform_node.h" 18 #include "ui/accessibility/platform/ax_platform_node.h"
18 #include "ui/gfx/geometry/rect_conversions.h" 19 #include "ui/gfx/geometry/rect_conversions.h"
19 #include "ui/gfx/geometry/rect_f.h" 20 #include "ui/gfx/geometry/rect_f.h"
20 21
21 namespace content { 22 namespace content {
22 23
23 namespace { 24 namespace {
24 25
25 // Map from unique_id to BrowserAccessibility 26 // Map from unique_id to BrowserAccessibility
26 using UniqueIDMap = base::hash_map<int32_t, BrowserAccessibility*>; 27 using UniqueIDMap = base::hash_map<int32_t, BrowserAccessibility*>;
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 } 1020 }
1020 1021
1021 BrowserAccessibility* parent = GetParent(); 1022 BrowserAccessibility* parent = GetParent();
1022 if (!parent) 1023 if (!parent)
1023 return false; 1024 return false;
1024 1025
1025 return parent->GetRole() == ui::AX_ROLE_IFRAME_PRESENTATIONAL; 1026 return parent->GetRole() == ui::AX_ROLE_IFRAME_PRESENTATIONAL;
1026 } 1027 }
1027 1028
1028 bool BrowserAccessibility::IsClickable() const { 1029 bool BrowserAccessibility::IsClickable() const {
1029 switch (GetRole()) { 1030 return ui::IsRoleClickable((ui::AXRole)GetRole());
tapted 2017/02/09 02:45:18 we aren't allowed to use C-style casts in Chromium
Patti Lor 2017/02/09 23:11:23 Done.
1030 case ui::AX_ROLE_BUTTON:
1031 case ui::AX_ROLE_CHECK_BOX:
1032 case ui::AX_ROLE_COLOR_WELL:
1033 case ui::AX_ROLE_DISCLOSURE_TRIANGLE:
1034 case ui::AX_ROLE_IMAGE_MAP_LINK:
1035 case ui::AX_ROLE_LINK:
1036 case ui::AX_ROLE_LIST_BOX_OPTION:
1037 case ui::AX_ROLE_MENU_BUTTON:
1038 case ui::AX_ROLE_MENU_ITEM:
1039 case ui::AX_ROLE_MENU_ITEM_CHECK_BOX:
1040 case ui::AX_ROLE_MENU_ITEM_RADIO:
1041 case ui::AX_ROLE_MENU_LIST_OPTION:
1042 case ui::AX_ROLE_MENU_LIST_POPUP:
1043 case ui::AX_ROLE_POP_UP_BUTTON:
1044 case ui::AX_ROLE_RADIO_BUTTON:
1045 case ui::AX_ROLE_SWITCH:
1046 case ui::AX_ROLE_TAB:
1047 case ui::AX_ROLE_TOGGLE_BUTTON:
1048 return true;
1049 default:
1050 return false;
1051 }
1052 } 1031 }
1053 1032
1054 bool BrowserAccessibility::IsControl() const { 1033 bool BrowserAccessibility::IsControl() const {
1055 switch (GetRole()) { 1034 switch (GetRole()) {
1056 case ui::AX_ROLE_BUTTON: 1035 case ui::AX_ROLE_BUTTON:
1057 case ui::AX_ROLE_CHECK_BOX: 1036 case ui::AX_ROLE_CHECK_BOX:
1058 case ui::AX_ROLE_COLOR_WELL: 1037 case ui::AX_ROLE_COLOR_WELL:
1059 case ui::AX_ROLE_COMBO_BOX: 1038 case ui::AX_ROLE_COMBO_BOX:
1060 case ui::AX_ROLE_DISCLOSURE_TRIANGLE: 1039 case ui::AX_ROLE_DISCLOSURE_TRIANGLE:
1061 case ui::AX_ROLE_LIST_BOX: 1040 case ui::AX_ROLE_LIST_BOX:
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 } 1211 }
1233 } 1212 }
1234 1213
1235 node = container; 1214 node = container;
1236 } 1215 }
1237 1216
1238 return gfx::ToEnclosingRect(bounds); 1217 return gfx::ToEnclosingRect(bounds);
1239 } 1218 }
1240 1219
1241 } // namespace content 1220 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/accessibility/BUILD.gn » ('j') | ui/accessibility/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698