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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 1458203003: MacKeyboard: Don't generate keypress for non-printable char (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: erikchen and dtapuska's review Created 5 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <OpenGL/gl.h> 8 #include <OpenGL/gl.h>
9 #include <QuartzCore/QuartzCore.h> 9 #include <QuartzCore/QuartzCore.h>
10 #include <utility> 10 #include <utility>
(...skipping 2281 matching lines...) Expand 10 before | Expand all | Expand 10 after
2292 if (!hasMarkedText_) { 2292 if (!hasMarkedText_) {
2293 if (!textInserted && textToBeInserted_.length() == 1) { 2293 if (!textInserted && textToBeInserted_.length() == 1) {
2294 // If a single character was inserted, then we just send it as a keypress 2294 // If a single character was inserted, then we just send it as a keypress
2295 // event. 2295 // event.
2296 event.type = blink::WebInputEvent::Char; 2296 event.type = blink::WebInputEvent::Char;
2297 event.text[0] = textToBeInserted_[0]; 2297 event.text[0] = textToBeInserted_[0];
2298 event.text[1] = 0; 2298 event.text[1] = 0;
2299 event.skip_in_browser = true; 2299 event.skip_in_browser = true;
2300 widgetHost->ForwardKeyboardEvent(event); 2300 widgetHost->ForwardKeyboardEvent(event);
2301 } else if ((!textInserted || delayEventUntilAfterImeCompostion) && 2301 } else if ((!textInserted || delayEventUntilAfterImeCompostion) &&
2302 [[theEvent characters] length] > 0 && 2302 event.text[0] != '\0' &&
2303 (([theEvent modifierFlags] & kCtrlCmdKeyMask) || 2303 (([theEvent modifierFlags] & kCtrlCmdKeyMask) ||
2304 (hasEditCommands_ && editCommands_.empty()))) { 2304 (hasEditCommands_ && editCommands_.empty()))) {
2305 // We don't get insertText: calls if ctrl or cmd is down, or the key event 2305 // We don't get insertText: calls if ctrl or cmd is down, or the key event
2306 // generates an insert command. So synthesize a keypress event for these 2306 // generates an insert command. So synthesize a keypress event for these
2307 // cases, unless the key event generated any other command. 2307 // cases, unless the key event generated any other command.
2308 event.type = blink::WebInputEvent::Char; 2308 event.type = blink::WebInputEvent::Char;
2309 event.skip_in_browser = true; 2309 event.skip_in_browser = true;
2310 widgetHost->ForwardKeyboardEvent(event); 2310 widgetHost->ForwardKeyboardEvent(event);
2311 } 2311 }
2312 } 2312 }
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
3444 3444
3445 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3445 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3446 // regions that are not draggable. (See ControlRegionView in 3446 // regions that are not draggable. (See ControlRegionView in
3447 // native_app_window_cocoa.mm). This requires the render host view to be 3447 // native_app_window_cocoa.mm). This requires the render host view to be
3448 // draggable by default. 3448 // draggable by default.
3449 - (BOOL)mouseDownCanMoveWindow { 3449 - (BOOL)mouseDownCanMoveWindow {
3450 return YES; 3450 return YES;
3451 } 3451 }
3452 3452
3453 @end 3453 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698