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

Unified Diff: ui/events/cocoa/events_mac.mm

Issue 492863002: mojo: Plumb through sufficient context to make real blink::WebInputEvents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final sky nits Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/services/public/interfaces/input_events/input_key_codes.mojom ('k') | ui/events/event.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/cocoa/events_mac.mm
diff --git a/ui/events/cocoa/events_mac.mm b/ui/events/cocoa/events_mac.mm
index 1d5d2b86c2c741af5eb7c94c41332643032d3b46..b9f010559ef392a0cf732d796760f1548884ee82 100644
--- a/ui/events/cocoa/events_mac.mm
+++ b/ui/events/cocoa/events_mac.mm
@@ -213,6 +213,48 @@ uint32 PlatformKeycodeFromNative(const base::NativeEvent& native_event) {
return native_event.keyCode;
}
+uint32 WindowsKeycodeFromNative(const base::NativeEvent& native_event) {
+ return static_cast<uint32>(KeyboardCodeFromNSEvent(native_event));
+}
+
+uint16 TextFromNative(const base::NativeEvent& native_event) {
+ NSString* text = @"";
+ if ([native_event type] != NSFlagsChanged)
+ text = [native_event characters];
+
+ // These exceptions are based on WebInputEventFactoryMac.mm:
+ uint32 windows_keycode = WindowsKeycodeFromNative(native_event);
+ if (windows_keycode == '\r')
+ text = @"\r";
+ if ([text isEqualToString:@"\x7F"])
+ text = @"\x8";
+ if (windows_keycode == 9)
+ text = @"\x9";
+
+ uint16 return_value;
+ [text getCharacters:&return_value];
+ return return_value;
+}
+
+uint16 UnmodifiedTextFromNative(const base::NativeEvent& native_event) {
+ NSString* text = @"";
+ if ([native_event type] != NSFlagsChanged)
+ text = [native_event charactersIgnoringModifiers];
+
+ // These exceptions are based on WebInputEventFactoryMac.mm:
+ uint32 windows_keycode = WindowsKeycodeFromNative(native_event);
+ if (windows_keycode == '\r')
+ text = @"\r";
+ if ([text isEqualToString:@"\x7F"])
+ text = @"\x8";
+ if (windows_keycode == 9)
+ text = @"\x9";
+
+ uint16 return_value;
+ [text getCharacters:&return_value];
+ return return_value;
+}
+
bool IsCharFromNative(const base::NativeEvent& native_event) {
return false;
}
« no previous file with comments | « mojo/services/public/interfaces/input_events/input_key_codes.mojom ('k') | ui/events/event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698