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

Unified Diff: webkit/glue/editor_client_impl.cc

Issue 99216: Workaround fix for Alt-Gr case.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/editor_client_impl.cc
===================================================================
--- webkit/glue/editor_client_impl.cc (revision 14923)
+++ webkit/glue/editor_client_impl.cc (working copy)
@@ -613,16 +613,20 @@
// Here we need to filter key events.
// On Gtk/Linux, it emits key events with ASCII text and ctrl on for ctrl-<x>.
- // In Webkit, EditorClient::handleKeyboardEvent in
+ // In Webkit, EditorClient::handleKeyboardEvent in
// WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp drop such events.
// On Mac, it emits key events with ASCII text and meta on for Command-<x>.
// These key events should not emit text insert event.
// Alt key would be used to insert alternative character, so we should let
- // through. Also note that Ctrl-Alt combination equals to AltGr key which is
+ // through. Also note that Ctrl-Alt combination equals to AltGr key which is
// also used to insert alternative character.
// http://code.google.com/p/chromium/issues/detail?id=10846
- // In summary, we can't think of a scenario where you'd use control w/o alt or
- // meta to do insertion of a ASCII character.
+ // Windows sets both alt and meta are on when "Alt" key pressed.
+ // http://code.google.com/p/chromium/issues/detail?id=2215
+ // Also, we should not rely on an assumption that keyboards don't
+ // send ASCII characters when pressing a control key on Windows,
+ // which may be configured to do it so by user.
+ // See also http://en.wikipedia.org/wiki/Keyboard_Layout
// TODO(ukai): investigate more detail for various keyboard layout.
if (evt->keyEvent()->text().length() == 1) {
UChar ch = evt->keyEvent()->text()[0U];
@@ -631,11 +635,18 @@
// unexpected behaviour
if (ch < ' ')
return false;
+#if !defined(OS_WIN)
// Don't insert ASCII character if ctrl w/o alt or meta is on.
- if (ch < 0x80 &&
- ((evt->keyEvent()->ctrlKey() && !evt->keyEvent()->altKey()) ||
- evt->keyEvent()->metaKey()))
- return false;
+ // On Mac, we should ignore events when meta is on (Command-<x>).
+ if (ch < 0x80) {
+ if (evt->keyEvent()->ctrlKey() && !evt->keyEvent()->altKey())
+ return false;
+#if defined(OS_MACOSX)
+ if (evt->keyEvent()->metaKey())
+ return false;
+#endif
+ }
+#endif
}
if (!frame->editor()->canEdit())
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698