| 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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 if (state & (1 << ui::AX_STATE_SELECTED)) | 1019 if (state & (1 << ui::AX_STATE_SELECTED)) |
| 1020 msaa_state |= STATE_SYSTEM_SELECTED; | 1020 msaa_state |= STATE_SYSTEM_SELECTED; |
| 1021 if (state & (1 << ui::AX_STATE_DISABLED)) | 1021 if (state & (1 << ui::AX_STATE_DISABLED)) |
| 1022 msaa_state |= STATE_SYSTEM_UNAVAILABLE; | 1022 msaa_state |= STATE_SYSTEM_UNAVAILABLE; |
| 1023 | 1023 |
| 1024 gfx::NativeViewAccessible focus = delegate_->GetFocus(); | 1024 gfx::NativeViewAccessible focus = delegate_->GetFocus(); |
| 1025 if (focus == GetNativeViewAccessible()) | 1025 if (focus == GetNativeViewAccessible()) |
| 1026 msaa_state |= STATE_SYSTEM_FOCUSED; | 1026 msaa_state |= STATE_SYSTEM_FOCUSED; |
| 1027 | 1027 |
| 1028 // On Windows, the "focus" bit should be set on certain containers, like | 1028 // On Windows, the "focus" bit should be set on certain containers, like |
| 1029 // menu bars, when one of their children has focus. | 1029 // menu bars, when visible. |
| 1030 if (GetData().role == ui::AX_ROLE_MENU_BAR && focus) | 1030 // |
| 1031 // TODO(dmazzoni): this should probably check if focus is actually inside |
| 1032 // the menu bar, but we don't currently track focus inside menu pop-ups, |
| 1033 // and Chrome only has one menu visible at a time so this works for now. |
| 1034 if (GetData().role == ui::AX_ROLE_MENU_BAR && |
| 1035 !(state & (1 << ui::AX_STATE_INVISIBLE))) { |
| 1031 msaa_state |= STATE_SYSTEM_FOCUSED; | 1036 msaa_state |= STATE_SYSTEM_FOCUSED; |
| 1037 } |
| 1032 | 1038 |
| 1033 return msaa_state; | 1039 return msaa_state; |
| 1034 } | 1040 } |
| 1035 | 1041 |
| 1036 int AXPlatformNodeWin::MSAAEvent(ui::AXEvent event) { | 1042 int AXPlatformNodeWin::MSAAEvent(ui::AXEvent event) { |
| 1037 switch (event) { | 1043 switch (event) { |
| 1038 case ui::AX_EVENT_ALERT: | 1044 case ui::AX_EVENT_ALERT: |
| 1039 return EVENT_SYSTEM_ALERT; | 1045 return EVENT_SYSTEM_ALERT; |
| 1040 case ui::AX_EVENT_FOCUS: | 1046 case ui::AX_EVENT_FOCUS: |
| 1041 return EVENT_OBJECT_FOCUS; | 1047 return EVENT_OBJECT_FOCUS; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 LONG start_offset, | 1133 LONG start_offset, |
| 1128 ui::TextBoundaryDirection direction) { | 1134 ui::TextBoundaryDirection direction) { |
| 1129 HandleSpecialTextOffset(text, &start_offset); | 1135 HandleSpecialTextOffset(text, &start_offset); |
| 1130 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); | 1136 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); |
| 1131 std::vector<int32_t> line_breaks; | 1137 std::vector<int32_t> line_breaks; |
| 1132 return static_cast<LONG>(ui::FindAccessibleTextBoundary( | 1138 return static_cast<LONG>(ui::FindAccessibleTextBoundary( |
| 1133 text, line_breaks, boundary, start_offset, direction)); | 1139 text, line_breaks, boundary, start_offset, direction)); |
| 1134 } | 1140 } |
| 1135 | 1141 |
| 1136 } // namespace ui | 1142 } // namespace ui |
| OLD | NEW |