OLD | NEW |
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 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 case ui::AX_ROLE_WINDOW: | 1037 case ui::AX_ROLE_WINDOW: |
1038 return ROLE_SYSTEM_WINDOW; | 1038 return ROLE_SYSTEM_WINDOW; |
1039 case ui::AX_ROLE_CLIENT: | 1039 case ui::AX_ROLE_CLIENT: |
1040 default: | 1040 default: |
1041 // This is the default role for MSAA. | 1041 // This is the default role for MSAA. |
1042 return ROLE_SYSTEM_CLIENT; | 1042 return ROLE_SYSTEM_CLIENT; |
1043 } | 1043 } |
1044 } | 1044 } |
1045 | 1045 |
1046 int AXPlatformNodeWin::MSAAState() { | 1046 int AXPlatformNodeWin::MSAAState() { |
1047 uint32_t state = GetData().state; | 1047 const AXNodeData& data = GetData(); |
| 1048 uint32_t state = data.state; |
1048 | 1049 |
1049 int msaa_state = 0; | 1050 int msaa_state = 0; |
1050 if (state & (1 << ui::AX_STATE_CHECKED)) | |
1051 msaa_state |= STATE_SYSTEM_CHECKED; | |
1052 if (state & (1 << ui::AX_STATE_COLLAPSED)) | 1051 if (state & (1 << ui::AX_STATE_COLLAPSED)) |
1053 msaa_state |= STATE_SYSTEM_COLLAPSED; | 1052 msaa_state |= STATE_SYSTEM_COLLAPSED; |
1054 if (state & (1 << ui::AX_STATE_DEFAULT)) | 1053 if (state & (1 << ui::AX_STATE_DEFAULT)) |
1055 msaa_state |= STATE_SYSTEM_DEFAULT; | 1054 msaa_state |= STATE_SYSTEM_DEFAULT; |
1056 if (state & (1 << ui::AX_STATE_EXPANDED)) | 1055 if (state & (1 << ui::AX_STATE_EXPANDED)) |
1057 msaa_state |= STATE_SYSTEM_EXPANDED; | 1056 msaa_state |= STATE_SYSTEM_EXPANDED; |
1058 if (state & (1 << ui::AX_STATE_FOCUSABLE)) | 1057 if (state & (1 << ui::AX_STATE_FOCUSABLE)) |
1059 msaa_state |= STATE_SYSTEM_FOCUSABLE; | 1058 msaa_state |= STATE_SYSTEM_FOCUSABLE; |
1060 if (state & (1 << ui::AX_STATE_HASPOPUP)) | 1059 if (state & (1 << ui::AX_STATE_HASPOPUP)) |
1061 msaa_state |= STATE_SYSTEM_HASPOPUP; | 1060 msaa_state |= STATE_SYSTEM_HASPOPUP; |
(...skipping 11 matching lines...) Expand all Loading... |
1073 msaa_state |= STATE_SYSTEM_PROTECTED; | 1072 msaa_state |= STATE_SYSTEM_PROTECTED; |
1074 if (state & (1 << ui::AX_STATE_READ_ONLY)) | 1073 if (state & (1 << ui::AX_STATE_READ_ONLY)) |
1075 msaa_state |= STATE_SYSTEM_READONLY; | 1074 msaa_state |= STATE_SYSTEM_READONLY; |
1076 if (state & (1 << ui::AX_STATE_SELECTABLE)) | 1075 if (state & (1 << ui::AX_STATE_SELECTABLE)) |
1077 msaa_state |= STATE_SYSTEM_SELECTABLE; | 1076 msaa_state |= STATE_SYSTEM_SELECTABLE; |
1078 if (state & (1 << ui::AX_STATE_SELECTED)) | 1077 if (state & (1 << ui::AX_STATE_SELECTED)) |
1079 msaa_state |= STATE_SYSTEM_SELECTED; | 1078 msaa_state |= STATE_SYSTEM_SELECTED; |
1080 if (state & (1 << ui::AX_STATE_DISABLED)) | 1079 if (state & (1 << ui::AX_STATE_DISABLED)) |
1081 msaa_state |= STATE_SYSTEM_UNAVAILABLE; | 1080 msaa_state |= STATE_SYSTEM_UNAVAILABLE; |
1082 | 1081 |
| 1082 // Checked state |
| 1083 const int checked = GetIntAttribute(ui::AX_ATTR_INVALID_STATE); |
| 1084 switch (checked) { |
| 1085 case ui::AX_CHECKED_STATE_TRUE: |
| 1086 msaa_state |= STATE_SYSTEM_CHECKED; |
| 1087 break; |
| 1088 case ui::AX_CHECKED_STATE_MIXED: |
| 1089 msaa_state |= (STATE_SYSTEM_MIXED | STATE_SYSTEM_CHECKED); |
| 1090 break; |
| 1091 default: |
| 1092 break; |
| 1093 } |
| 1094 |
1083 gfx::NativeViewAccessible focus = delegate_->GetFocus(); | 1095 gfx::NativeViewAccessible focus = delegate_->GetFocus(); |
1084 if (focus == GetNativeViewAccessible()) | 1096 if (focus == GetNativeViewAccessible()) |
1085 msaa_state |= STATE_SYSTEM_FOCUSED; | 1097 msaa_state |= STATE_SYSTEM_FOCUSED; |
1086 | 1098 |
1087 // On Windows, the "focus" bit should be set on certain containers, like | 1099 // On Windows, the "focus" bit should be set on certain containers, like |
1088 // menu bars, when visible. | 1100 // menu bars, when visible. |
1089 // | 1101 // |
1090 // TODO(dmazzoni): this should probably check if focus is actually inside | 1102 // TODO(dmazzoni): this should probably check if focus is actually inside |
1091 // the menu bar, but we don't currently track focus inside menu pop-ups, | 1103 // the menu bar, but we don't currently track focus inside menu pop-ups, |
1092 // and Chrome only has one menu visible at a time so this works for now. | 1104 // and Chrome only has one menu visible at a time so this works for now. |
1093 if (GetData().role == ui::AX_ROLE_MENU_BAR && | 1105 if (data.role == ui::AX_ROLE_MENU_BAR && |
1094 !(state & (1 << ui::AX_STATE_INVISIBLE))) { | 1106 !(state & (1 << ui::AX_STATE_INVISIBLE))) { |
1095 msaa_state |= STATE_SYSTEM_FOCUSED; | 1107 msaa_state |= STATE_SYSTEM_FOCUSED; |
1096 } | 1108 } |
1097 | 1109 |
1098 return msaa_state; | 1110 return msaa_state; |
1099 } | 1111 } |
1100 | 1112 |
1101 int AXPlatformNodeWin::MSAAEvent(ui::AXEvent event) { | 1113 int AXPlatformNodeWin::MSAAEvent(ui::AXEvent event) { |
1102 switch (event) { | 1114 switch (event) { |
1103 case ui::AX_EVENT_ALERT: | 1115 case ui::AX_EVENT_ALERT: |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 ui::TextBoundaryDirection direction) { | 1203 ui::TextBoundaryDirection direction) { |
1192 HandleSpecialTextOffset(&start_offset); | 1204 HandleSpecialTextOffset(&start_offset); |
1193 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); | 1205 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); |
1194 std::vector<int32_t> line_breaks; | 1206 std::vector<int32_t> line_breaks; |
1195 return static_cast<LONG>(ui::FindAccessibleTextBoundary( | 1207 return static_cast<LONG>(ui::FindAccessibleTextBoundary( |
1196 text, line_breaks, boundary, start_offset, direction, | 1208 text, line_breaks, boundary, start_offset, direction, |
1197 AX_TEXT_AFFINITY_DOWNSTREAM)); | 1209 AX_TEXT_AFFINITY_DOWNSTREAM)); |
1198 } | 1210 } |
1199 | 1211 |
1200 } // namespace ui | 1212 } // namespace ui |
OLD | NEW |