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

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: Created 5 years, 1 month 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 10
(...skipping 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after
2290 if (!textInserted && textToBeInserted_.length() == 1) { 2290 if (!textInserted && textToBeInserted_.length() == 1) {
2291 // If a single character was inserted, then we just send it as a keypress 2291 // If a single character was inserted, then we just send it as a keypress
2292 // event. 2292 // event.
2293 event.type = blink::WebInputEvent::Char; 2293 event.type = blink::WebInputEvent::Char;
2294 event.text[0] = textToBeInserted_[0]; 2294 event.text[0] = textToBeInserted_[0];
2295 event.text[1] = 0; 2295 event.text[1] = 0;
2296 event.skip_in_browser = true; 2296 event.skip_in_browser = true;
2297 widgetHost->ForwardKeyboardEvent(event); 2297 widgetHost->ForwardKeyboardEvent(event);
2298 } else if ((!textInserted || delayEventUntilAfterImeCompostion) && 2298 } else if ((!textInserted || delayEventUntilAfterImeCompostion) &&
2299 [[theEvent characters] length] > 0 && 2299 [[theEvent characters] length] > 0 &&
2300 base::mac::StringIsPrintable([theEvent characters]) &&
2300 (([theEvent modifierFlags] & kCtrlCmdKeyMask) || 2301 (([theEvent modifierFlags] & kCtrlCmdKeyMask) ||
2301 (hasEditCommands_ && editCommands_.empty()))) { 2302 (hasEditCommands_ && editCommands_.empty()))) {
2302 // We don't get insertText: calls if ctrl or cmd is down, or the key event 2303 // We don't get insertText: calls if ctrl or cmd is down, or the key event
2303 // generates an insert command. So synthesize a keypress event for these 2304 // generates an insert command. So synthesize a keypress event for these
2304 // cases, unless the key event generated any other command. 2305 // cases, unless the key event generated any other command.
2305 event.type = blink::WebInputEvent::Char; 2306 event.type = blink::WebInputEvent::Char;
2306 event.skip_in_browser = true; 2307 event.skip_in_browser = true;
2307 widgetHost->ForwardKeyboardEvent(event); 2308 widgetHost->ForwardKeyboardEvent(event);
2308 } 2309 }
2309 } 2310 }
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
3441 3442
3442 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3443 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3443 // regions that are not draggable. (See ControlRegionView in 3444 // regions that are not draggable. (See ControlRegionView in
3444 // native_app_window_cocoa.mm). This requires the render host view to be 3445 // native_app_window_cocoa.mm). This requires the render host view to be
3445 // draggable by default. 3446 // draggable by default.
3446 - (BOOL)mouseDownCanMoveWindow { 3447 - (BOOL)mouseDownCanMoveWindow {
3447 return YES; 3448 return YES;
3448 } 3449 }
3449 3450
3450 @end 3451 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698