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

Side by Side Diff: ui/events/test/cocoa_test_event_utils.mm

Issue 2095283002: MacViews: Don't handle character events in textfield_unittest's MockInputMethod::DispatchKeyEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modify comment. Created 4 years, 5 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 | ui/views/controls/textfield/textfield_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "ui/events/test/cocoa_test_event_utils.h" 5 #import "ui/events/test/cocoa_test_event_utils.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "ui/events/base_event_utils.h" 10 #include "ui/events/base_event_utils.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // Note on Mac (unlike other platforms) shift while caps is down does not go 169 // Note on Mac (unlike other platforms) shift while caps is down does not go
170 // back to lowercase. 170 // back to lowercase.
171 if (keycode >= ui::VKEY_A && keycode <= ui::VKEY_Z && 171 if (keycode >= ui::VKEY_A && keycode <= ui::VKEY_Z &&
172 (flags & NSAlphaShiftKeyMask)) 172 (flags & NSAlphaShiftKeyMask))
173 flags |= NSShiftKeyMask; 173 flags |= NSShiftKeyMask;
174 174
175 // Clear caps regardless -- MacKeyCodeForWindowsKeyCode doesn't implement 175 // Clear caps regardless -- MacKeyCodeForWindowsKeyCode doesn't implement
176 // logic to support it. 176 // logic to support it.
177 flags &= ~NSAlphaShiftKeyMask; 177 flags &= ~NSAlphaShiftKeyMask;
178 178
179 // Call sites may generate unicode character events with an undefined
180 // keycode. Since it's not feasible to determine the correct keycode for
181 // each unicode character, we use a dummy keycode corresponding to key 'A'.
182 if (dom_key.IsCharacter() && keycode == ui::VKEY_UNKNOWN)
183 keycode = ui::VKEY_A;
184
179 unichar character; 185 unichar character;
180 unichar shifted_character; 186 unichar shifted_character;
181 int macKeycode = ui::MacKeyCodeForWindowsKeyCode( 187 int macKeycode = ui::MacKeyCodeForWindowsKeyCode(
182 keycode, flags, &shifted_character, &character); 188 keycode, flags, &shifted_character, &character);
183 189
184 if (macKeycode < 0) 190 if (macKeycode < 0)
185 return nil; 191 return nil;
186 192
187 // If an explicit unicode character is provided, use that instead of the one 193 // If an explicit unicode character is provided, use that instead of the one
188 // derived from the keycode. 194 // derived from the keycode.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 context:nil 241 context:nil
236 characters:characters 242 characters:characters
237 charactersIgnoringModifiers:charactersIgnoringModifiers 243 charactersIgnoringModifiers:charactersIgnoringModifiers
238 isARepeat:NO 244 isARepeat:NO
239 keyCode:(unsigned short)macKeycode]; 245 keyCode:(unsigned short)macKeycode];
240 246
241 return event; 247 return event;
242 } 248 }
243 249
244 } // namespace cocoa_test_event_utils 250 } // namespace cocoa_test_event_utils
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/textfield/textfield_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698