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