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 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 msaa_state |= STATE_SYSTEM_PROTECTED; | 1000 msaa_state |= STATE_SYSTEM_PROTECTED; |
1001 if (state & (1 << ui::AX_STATE_READ_ONLY)) | 1001 if (state & (1 << ui::AX_STATE_READ_ONLY)) |
1002 msaa_state |= STATE_SYSTEM_READONLY; | 1002 msaa_state |= STATE_SYSTEM_READONLY; |
1003 if (state & (1 << ui::AX_STATE_SELECTABLE)) | 1003 if (state & (1 << ui::AX_STATE_SELECTABLE)) |
1004 msaa_state |= STATE_SYSTEM_SELECTABLE; | 1004 msaa_state |= STATE_SYSTEM_SELECTABLE; |
1005 if (state & (1 << ui::AX_STATE_SELECTED)) | 1005 if (state & (1 << ui::AX_STATE_SELECTED)) |
1006 msaa_state |= STATE_SYSTEM_SELECTED; | 1006 msaa_state |= STATE_SYSTEM_SELECTED; |
1007 if (state & (1 << ui::AX_STATE_DISABLED)) | 1007 if (state & (1 << ui::AX_STATE_DISABLED)) |
1008 msaa_state |= STATE_SYSTEM_UNAVAILABLE; | 1008 msaa_state |= STATE_SYSTEM_UNAVAILABLE; |
1009 | 1009 |
| 1010 gfx::NativeViewAccessible focus = delegate_->GetFocus(); |
| 1011 if (focus == GetNativeViewAccessible()) |
| 1012 data_.state |= (1 << ui::AX_STATE_FOCUSED); |
| 1013 |
| 1014 // On Windows, the "focus" bit should be set on certain containers, like |
| 1015 // menu bars, when one of their children has focus. |
| 1016 if (GetData().role == ui::AX_ROLE_MENU_BAR && focus) |
| 1017 state->AddStateFlag(ui::AX_STATE_FOCUSED); |
| 1018 |
1010 return msaa_state; | 1019 return msaa_state; |
1011 } | 1020 } |
1012 | 1021 |
1013 int AXPlatformNodeWin::MSAAEvent(ui::AXEvent event) { | 1022 int AXPlatformNodeWin::MSAAEvent(ui::AXEvent event) { |
1014 switch (event) { | 1023 switch (event) { |
1015 case ui::AX_EVENT_ALERT: | 1024 case ui::AX_EVENT_ALERT: |
1016 return EVENT_SYSTEM_ALERT; | 1025 return EVENT_SYSTEM_ALERT; |
1017 case ui::AX_EVENT_FOCUS: | 1026 case ui::AX_EVENT_FOCUS: |
1018 return EVENT_OBJECT_FOCUS; | 1027 return EVENT_OBJECT_FOCUS; |
1019 case ui::AX_EVENT_MENU_START: | 1028 case ui::AX_EVENT_MENU_START: |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 LONG start_offset, | 1113 LONG start_offset, |
1105 ui::TextBoundaryDirection direction) { | 1114 ui::TextBoundaryDirection direction) { |
1106 HandleSpecialTextOffset(text, &start_offset); | 1115 HandleSpecialTextOffset(text, &start_offset); |
1107 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); | 1116 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); |
1108 std::vector<int32_t> line_breaks; | 1117 std::vector<int32_t> line_breaks; |
1109 return static_cast<LONG>(ui::FindAccessibleTextBoundary( | 1118 return static_cast<LONG>(ui::FindAccessibleTextBoundary( |
1110 text, line_breaks, boundary, start_offset, direction)); | 1119 text, line_breaks, boundary, start_offset, direction)); |
1111 } | 1120 } |
1112 | 1121 |
1113 } // namespace ui | 1122 } // namespace ui |
OLD | NEW |