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

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

Issue 1801183002: Fix accessible focus state on menu bar container. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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