Send keypress() events for ctrl-key and cmd-key in addition to keydown().

The ctrl-key behavior matches what Safari does: We first send a keydown for ctrl-key, and only if the key is not an emacs shortcut, we send a keypress.

The cmd-key behavior is slightly different from Safari: Safari triggers menu items after the keypress command has not been swallowed by javascript. We trigger menu items after keydown. That means that if the user hits cmd-key, we send a keydown and only send a keypress if the shortcut doesn't trigger a menu item. Safari always sends both keydown and keypress.

BUG=25249
TEST=Go to http://unixpapa.com/js/testkey.html . Hit ctrl-a, only a keydown should be generated. Hit ctrl-s, both keydown and keypress should be generated. Hit cmd-a, only a keydown should be generated. Hit cmd-shift-a, both keypress and keydown should be generated. Also, ctrl-1 now makes something a heading in google docs. Cmd-s and Cmd-f should still work in docs.

Review URL: http://codereview.chromium.org/293019

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31287 0039d316-1c4b-4281-b951-d872f2087c98
2 files changed