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

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

Issue 1828853002: Merge to M50: Fix accessible focus state on menu bar container. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 if (state & (1 << ui::AX_STATE_SELECTED)) 1043 if (state & (1 << ui::AX_STATE_SELECTED))
1044 msaa_state |= STATE_SYSTEM_SELECTED; 1044 msaa_state |= STATE_SYSTEM_SELECTED;
1045 if (state & (1 << ui::AX_STATE_DISABLED)) 1045 if (state & (1 << ui::AX_STATE_DISABLED))
1046 msaa_state |= STATE_SYSTEM_UNAVAILABLE; 1046 msaa_state |= STATE_SYSTEM_UNAVAILABLE;
1047 1047
1048 gfx::NativeViewAccessible focus = delegate_->GetFocus(); 1048 gfx::NativeViewAccessible focus = delegate_->GetFocus();
1049 if (focus == GetNativeViewAccessible()) 1049 if (focus == GetNativeViewAccessible())
1050 msaa_state |= STATE_SYSTEM_FOCUSED; 1050 msaa_state |= STATE_SYSTEM_FOCUSED;
1051 1051
1052 // On Windows, the "focus" bit should be set on certain containers, like 1052 // On Windows, the "focus" bit should be set on certain containers, like
1053 // menu bars, when one of their children has focus. 1053 // menu bars, when visible.
1054 if (GetData().role == ui::AX_ROLE_MENU_BAR && focus) 1054 //
1055 // TODO(dmazzoni): this should probably check if focus is actually inside
1056 // the menu bar, but we don't currently track focus inside menu pop-ups,
1057 // and Chrome only has one menu visible at a time so this works for now.
1058 if (GetData().role == ui::AX_ROLE_MENU_BAR &&
1059 !(state & (1 << ui::AX_STATE_INVISIBLE))) {
1055 msaa_state |= STATE_SYSTEM_FOCUSED; 1060 msaa_state |= STATE_SYSTEM_FOCUSED;
1061 }
1056 1062
1057 return msaa_state; 1063 return msaa_state;
1058 } 1064 }
1059 1065
1060 int AXPlatformNodeWin::MSAAEvent(ui::AXEvent event) { 1066 int AXPlatformNodeWin::MSAAEvent(ui::AXEvent event) {
1061 switch (event) { 1067 switch (event) {
1062 case ui::AX_EVENT_ALERT: 1068 case ui::AX_EVENT_ALERT:
1063 return EVENT_SYSTEM_ALERT; 1069 return EVENT_SYSTEM_ALERT;
1064 case ui::AX_EVENT_FOCUS: 1070 case ui::AX_EVENT_FOCUS:
1065 return EVENT_OBJECT_FOCUS; 1071 return EVENT_OBJECT_FOCUS;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 LONG start_offset, 1157 LONG start_offset,
1152 ui::TextBoundaryDirection direction) { 1158 ui::TextBoundaryDirection direction) {
1153 HandleSpecialTextOffset(text, &start_offset); 1159 HandleSpecialTextOffset(text, &start_offset);
1154 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); 1160 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary);
1155 std::vector<int32_t> line_breaks; 1161 std::vector<int32_t> line_breaks;
1156 return static_cast<LONG>(ui::FindAccessibleTextBoundary( 1162 return static_cast<LONG>(ui::FindAccessibleTextBoundary(
1157 text, line_breaks, boundary, start_offset, direction)); 1163 text, line_breaks, boundary, start_offset, direction));
1158 } 1164 }
1159 1165
1160 } // namespace ui 1166 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698