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

Side by Side Diff: third_party/WebKit/Source/web/WebInputEventConversion.cpp

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 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 321
322 if (type == RawKeyDown) { 322 if (type == RawKeyDown) {
323 m_text = String(); 323 m_text = String();
324 m_unmodifiedText = String(); 324 m_unmodifiedText = String();
325 } else { 325 } else {
326 m_keyIdentifier = String(); 326 m_keyIdentifier = String();
327 m_windowsVirtualKeyCode = 0; 327 m_windowsVirtualKeyCode = 0;
328 } 328 }
329 } 329 }
330 330
331 // Please refer to bug http://b/issue?id=961192, which talks about Webkit
332 // keyboard event handling changes. It also mentions the list of keys
333 // which don't have associated character events.
334 bool PlatformKeyboardEventBuilder::isCharacterKey() const 331 bool PlatformKeyboardEventBuilder::isCharacterKey() const
335 { 332 {
336 switch (windowsVirtualKeyCode()) { 333 if (text().length() == 0)
337 case VKEY_BACK:
338 case VKEY_ESCAPE:
339 return false; 334 return false;
335
336 UChar32 c = text().characterStartingAt(0);
337 switch (c) {
338 case 0x08: // Backspace
339 case 0x1B: // Escape
340 case 0x7F: // Delete
341 return false;
342 default:
343 return true;
340 } 344 }
341 return true;
342 } 345 }
343 346
344 inline PlatformEvent::Type toPlatformTouchEventType(const WebInputEvent::Type ty pe) 347 inline PlatformEvent::Type toPlatformTouchEventType(const WebInputEvent::Type ty pe)
345 { 348 {
346 switch (type) { 349 switch (type) {
347 case WebInputEvent::TouchStart: 350 case WebInputEvent::TouchStart:
348 return PlatformEvent::TouchStart; 351 return PlatformEvent::TouchStart;
349 case WebInputEvent::TouchMove: 352 case WebInputEvent::TouchMove:
350 return PlatformEvent::TouchMove; 353 return PlatformEvent::TouchMove;
351 case WebInputEvent::TouchEnd: 354 case WebInputEvent::TouchEnd:
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 break; 733 break;
731 case GestureSourceTouchscreen: 734 case GestureSourceTouchscreen:
732 sourceDevice = WebGestureDeviceTouchscreen; 735 sourceDevice = WebGestureDeviceTouchscreen;
733 break; 736 break;
734 case GestureSourceUninitialized: 737 case GestureSourceUninitialized:
735 ASSERT_NOT_REACHED(); 738 ASSERT_NOT_REACHED();
736 } 739 }
737 } 740 }
738 741
739 } // namespace blink 742 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698