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

Unified Diff: content/browser/renderer_host/input/web_input_event_builders_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: Filter more private use characters 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/input/web_input_event_builders_mac.mm
diff --git a/content/browser/renderer_host/input/web_input_event_builders_mac.mm b/content/browser/renderer_host/input/web_input_event_builders_mac.mm
index 1e116e84b939c24efb5f248caebe1e6f07c4f72f..dc628c42c744dd5646fce199652c3d9c5c7d2408 100644
--- a/content/browser/renderer_host/input/web_input_event_builders_mac.mm
+++ b/content/browser/renderer_host/input/web_input_event_builders_mac.mm
@@ -631,6 +631,28 @@ blink::WebKeyboardEvent WebKeyboardEventBuilder::Build(NSEvent* event) {
// End Apple code.
+ // Handle Apple's private use character
+ if ([text_str length] == 1) {
dtapuska 2015/12/10 20:50:12 Can we do this in TextFromEvent and UnmodifiedText
chongz 2015/12/11 06:38:46 Moved text_str filter into a single function, but
+ unichar c = [text_str characterAtIndex:0];
+ if (c == NSDeleteFunctionKey) {
+ // Delete should be 0x7F
+ text_str = @"\x7F";
+ } else if (c >= 0xF700 && c <= 0xF747) {
erikchen 2015/12/10 21:48:09 Where are you getting 0xF747 from? https://code
dtapuska 2015/12/10 21:53:01 F7FF I'd prefer; would match this: http://www.ope
chongz 2015/12/11 06:38:46 Done.
+ // Other Apple private use characters should be "\0"
+ text_str = @"\0";
+ }
+ }
+ if ([unmodified_str length] == 1) {
+ unichar c = [unmodified_str characterAtIndex:0];
+ if (c == NSDeleteFunctionKey) {
+ // Delete should be 0x7F
+ unmodified_str = @"\x7F";
+ } else if (c >= 0xF700 && c <= 0xF747) {
+ // Other Apple private use characters should be "\0"
+ unmodified_str = @"\0";
+ }
+ }
+
if ([text_str length] < blink::WebKeyboardEvent::textLengthCap &&
[unmodified_str length] < blink::WebKeyboardEvent::textLengthCap) {
[text_str getCharacters:&result.text[0]];

Powered by Google App Engine
This is Rietveld 408576698