summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authoravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-20 18:52:54 +0000
committeravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-20 18:52:54 +0000
commita6ddd6c851efab03f413235bff13897fdcbc70df (patch)
tree2a45168df6b08d2ffdb9803d29b32828485917da /webkit
parent3c6b2bfef53cca801e9b1b1859784f955df9335b (diff)
downloadchromium_src-a6ddd6c851efab03f413235bff13897fdcbc70df.zip
chromium_src-a6ddd6c851efab03f413235bff13897fdcbc70df.tar.gz
chromium_src-a6ddd6c851efab03f413235bff13897fdcbc70df.tar.bz2
Don't insert text if key event has ctrl|alt|meta modifiers.
Patch by ukai@google.com. BUG=9622 Review URL: http://codereview.chromium.org/67273 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14043 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/editor_client_impl.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/webkit/glue/editor_client_impl.cc b/webkit/glue/editor_client_impl.cc
index b6a2f37..4655f7a 100644
--- a/webkit/glue/editor_client_impl.cc
+++ b/webkit/glue/editor_client_impl.cc
@@ -611,6 +611,22 @@ bool EditorClientImpl::handleEditingKeyboardEvent(
return true;
}
+ // In WebKit/gtk/WebCoreSupport/EditorClient.cpp, handleKeyboardEvent()
+ // checks modifiers. If any modifiers (except shift) are pressed or
+ // no text in the key event, it won't try to insertText to the editor.
+ // This is necessary to prevent ascii letter from being inserted when a key
+ // pressed such as Ctrl-<letter>. For example, when Ctrl-L pressed,
+ // we'll have a KeyDown key event with ctrlKey() == true and text = 'l',
+ // which will be disambiguated to the following two key events on Gtk.
+ // RawKeyDown: ctrlKey == true, text = ""
+ // Char: ctrlKey == true, text = "l".
+ // For Mac, we'd like to ignore text if Command key (MetaKey) is pressed.
+ // Note that on Windows, we'll have a Char key event with ctrlKey() == true
+ // and text = "\x0c".
+ if (evt->keyEvent()->ctrlKey() || evt->keyEvent()->altKey() ||
+ evt->keyEvent()->metaKey() || evt->keyEvent()->text().isEmpty())
+ return false;
+
if (evt->keyEvent()->text().length() == 1) {
UChar ch = evt->keyEvent()->text()[0U];