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

Side by Side Diff: ui/accessibility/platform/ax_platform_node_win.cc

Issue 2694903010: AX checked state changes (Closed)
Patch Set: git cl try 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <atlbase.h> 5 #include <atlbase.h>
6 #include <atlcom.h> 6 #include <atlcom.h>
7 #include <limits.h> 7 #include <limits.h>
8 #include <oleacc.h> 8 #include <oleacc.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 case ui::AX_ROLE_WINDOW: 1046 case ui::AX_ROLE_WINDOW:
1047 return ROLE_SYSTEM_WINDOW; 1047 return ROLE_SYSTEM_WINDOW;
1048 case ui::AX_ROLE_CLIENT: 1048 case ui::AX_ROLE_CLIENT:
1049 default: 1049 default:
1050 // This is the default role for MSAA. 1050 // This is the default role for MSAA.
1051 return ROLE_SYSTEM_CLIENT; 1051 return ROLE_SYSTEM_CLIENT;
1052 } 1052 }
1053 } 1053 }
1054 1054
1055 int AXPlatformNodeWin::MSAAState() { 1055 int AXPlatformNodeWin::MSAAState() {
1056 uint32_t state = GetData().state; 1056 const AXNodeData& data = GetData();
1057 const uint32_t state = data.state;
1057 1058
1058 int msaa_state = 0; 1059 int msaa_state = 0;
1059 if (state & (1 << ui::AX_STATE_CHECKED))
1060 msaa_state |= STATE_SYSTEM_CHECKED;
1061 if (state & (1 << ui::AX_STATE_COLLAPSED)) 1060 if (state & (1 << ui::AX_STATE_COLLAPSED))
1062 msaa_state |= STATE_SYSTEM_COLLAPSED; 1061 msaa_state |= STATE_SYSTEM_COLLAPSED;
1063 if (state & (1 << ui::AX_STATE_DEFAULT)) 1062 if (state & (1 << ui::AX_STATE_DEFAULT))
1064 msaa_state |= STATE_SYSTEM_DEFAULT; 1063 msaa_state |= STATE_SYSTEM_DEFAULT;
1065 if (state & (1 << ui::AX_STATE_EXPANDED)) 1064 if (state & (1 << ui::AX_STATE_EXPANDED))
1066 msaa_state |= STATE_SYSTEM_EXPANDED; 1065 msaa_state |= STATE_SYSTEM_EXPANDED;
1067 if (state & (1 << ui::AX_STATE_FOCUSABLE)) 1066 if (state & (1 << ui::AX_STATE_FOCUSABLE))
1068 msaa_state |= STATE_SYSTEM_FOCUSABLE; 1067 msaa_state |= STATE_SYSTEM_FOCUSABLE;
1069 if (state & (1 << ui::AX_STATE_HASPOPUP)) 1068 if (state & (1 << ui::AX_STATE_HASPOPUP))
1070 msaa_state |= STATE_SYSTEM_HASPOPUP; 1069 msaa_state |= STATE_SYSTEM_HASPOPUP;
(...skipping 11 matching lines...) Expand all
1082 msaa_state |= STATE_SYSTEM_PROTECTED; 1081 msaa_state |= STATE_SYSTEM_PROTECTED;
1083 if (state & (1 << ui::AX_STATE_READ_ONLY)) 1082 if (state & (1 << ui::AX_STATE_READ_ONLY))
1084 msaa_state |= STATE_SYSTEM_READONLY; 1083 msaa_state |= STATE_SYSTEM_READONLY;
1085 if (state & (1 << ui::AX_STATE_SELECTABLE)) 1084 if (state & (1 << ui::AX_STATE_SELECTABLE))
1086 msaa_state |= STATE_SYSTEM_SELECTABLE; 1085 msaa_state |= STATE_SYSTEM_SELECTABLE;
1087 if (state & (1 << ui::AX_STATE_SELECTED)) 1086 if (state & (1 << ui::AX_STATE_SELECTED))
1088 msaa_state |= STATE_SYSTEM_SELECTED; 1087 msaa_state |= STATE_SYSTEM_SELECTED;
1089 if (state & (1 << ui::AX_STATE_DISABLED)) 1088 if (state & (1 << ui::AX_STATE_DISABLED))
1090 msaa_state |= STATE_SYSTEM_UNAVAILABLE; 1089 msaa_state |= STATE_SYSTEM_UNAVAILABLE;
1091 1090
1091 // Checked state
1092 const auto checked_state = static_cast<ui::AXCheckedState>(
1093 GetIntAttribute(ui::AX_ATTR_CHECKED_STATE));
1094 switch (checked_state) {
1095 case ui::AX_CHECKED_STATE_TRUE:
1096 msaa_state |= STATE_SYSTEM_CHECKED;
1097 break;
1098 case ui::AX_CHECKED_STATE_MIXED:
1099 msaa_state |= STATE_SYSTEM_MIXED;
1100 break;
1101 default:
1102 break;
1103 }
1104
1092 gfx::NativeViewAccessible focus = delegate_->GetFocus(); 1105 gfx::NativeViewAccessible focus = delegate_->GetFocus();
1093 if (focus == GetNativeViewAccessible()) 1106 if (focus == GetNativeViewAccessible())
1094 msaa_state |= STATE_SYSTEM_FOCUSED; 1107 msaa_state |= STATE_SYSTEM_FOCUSED;
1095 1108
1096 // On Windows, the "focus" bit should be set on certain containers, like 1109 // On Windows, the "focus" bit should be set on certain containers, like
1097 // menu bars, when visible. 1110 // menu bars, when visible.
1098 // 1111 //
1099 // TODO(dmazzoni): this should probably check if focus is actually inside 1112 // TODO(dmazzoni): this should probably check if focus is actually inside
1100 // the menu bar, but we don't currently track focus inside menu pop-ups, 1113 // the menu bar, but we don't currently track focus inside menu pop-ups,
1101 // and Chrome only has one menu visible at a time so this works for now. 1114 // and Chrome only has one menu visible at a time so this works for now.
1102 if (GetData().role == ui::AX_ROLE_MENU_BAR && 1115 if (data.role == ui::AX_ROLE_MENU_BAR &&
1103 !(state & (1 << ui::AX_STATE_INVISIBLE))) { 1116 !(state & (1 << ui::AX_STATE_INVISIBLE))) {
1104 msaa_state |= STATE_SYSTEM_FOCUSED; 1117 msaa_state |= STATE_SYSTEM_FOCUSED;
1105 } 1118 }
1106 1119
1107 return msaa_state; 1120 return msaa_state;
1108 } 1121 }
1109 1122
1110 int AXPlatformNodeWin::MSAAEvent(ui::AXEvent event) { 1123 int AXPlatformNodeWin::MSAAEvent(ui::AXEvent event) {
1111 switch (event) { 1124 switch (event) {
1112 case ui::AX_EVENT_ALERT: 1125 case ui::AX_EVENT_ALERT:
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 ui::TextBoundaryDirection direction) { 1213 ui::TextBoundaryDirection direction) {
1201 HandleSpecialTextOffset(&start_offset); 1214 HandleSpecialTextOffset(&start_offset);
1202 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); 1215 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary);
1203 std::vector<int32_t> line_breaks; 1216 std::vector<int32_t> line_breaks;
1204 return static_cast<LONG>(ui::FindAccessibleTextBoundary( 1217 return static_cast<LONG>(ui::FindAccessibleTextBoundary(
1205 text, line_breaks, boundary, start_offset, direction, 1218 text, line_breaks, boundary, start_offset, direction,
1206 AX_TEXT_AFFINITY_DOWNSTREAM)); 1219 AX_TEXT_AFFINITY_DOWNSTREAM));
1207 } 1220 }
1208 1221
1209 } // namespace ui 1222 } // namespace ui
OLDNEW
« no previous file with comments | « ui/accessibility/platform/ax_platform_node_auralinux.cc ('k') | ui/views/controls/button/checkbox.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698