diff options
author | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-25 08:47:51 +0000 |
---|---|---|
committer | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-25 08:47:51 +0000 |
commit | 688ccb5793b4b6a1160f8d71897d817ed9f39a57 (patch) | |
tree | 948b982b774f1613d86cc1bf070b5841759872d7 /chrome/browser/renderer_host/render_widget_host.cc | |
parent | cdea81f62d479132b29de3e8386bb5a8093f6f58 (diff) | |
download | chromium_src-688ccb5793b4b6a1160f8d71897d817ed9f39a57.zip chromium_src-688ccb5793b4b6a1160f8d71897d817ed9f39a57.tar.gz chromium_src-688ccb5793b4b6a1160f8d71897d817ed9f39a57.tar.bz2 |
Integrating GtkIMContext into the RenderWidgetHostViewGtk class (Take 2).
This change is an updated version of <http://codereview.chromium.org/126118> that I reverted because of issue 15024 <http://crbug.com/15024>. This issue 15024 is caused by my bonehead mistake that I forgot handling the case that gtk_im_context_filter_keypress() returns false. (The GtkIMContext usually returns false when we type control keys, such as return, page up, page down, etc.) To handle this case, this change added code that manually creates a Char
event and send it to the renderer in RenderWidgetHostViewGtkWidget::KeyPressReleaseEvent(). Except this code, it is exactly the same as <http://codereview.chromium.org/126118>.
Unfortunately, this change still uses std::wstring, I'm going to send another change which replace std::wstring with string16.
(The following message is copied from <http://codereview.chromium.org/126118>.)
This change implements signal handers of the GtkIMContext object to support IMEs anddead-keys. Also, to improve compatibility with Windows Chrome, this changeemulates IPC messages sent on Windows when we input characters and fixes
Issue13604 as well as Issue 10953 and 11226. Even though I notice we need more workfor fixing edge cases (e.g. disabling IMEs on a password input) on Linux, Ithink this is the good starting point. (Supporting edge-cases requirescomplicated code and it makes hard to review.)
BUG=10953 "IME support"
BUG=11226 "Dead keys and accents input not working"
BUG=13604 "Hotkeys not working in non-us keyboard layout"
BUG=13711 "Alt-D does not work when in editbox"
TEST=Open a web page which contains an <input> form, type a '[{' key and an 'A' key on a Canadian-French keyboard, and see a Latin character "U+00E2" is displayed in the <input> form.
TEST=Open a web page which contains an <input> form, enable an Chinese Pinyin IME, type a 'W' key, type an 'O' key, and see a Chinese character is displayed in the <input> form.
TEST=Change the keyboard layout to Hebrew (or Russian), open a web page which contains an <input> form, input some characters in the <input> form, type control+a, and see the text in the <input> form is selected.
TEST=Open a web page which contains a <textarea> form, type a return key, and see a new line is inserted.
Review URL: http://codereview.chromium.org/147011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19238 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host/render_widget_host.cc')
-rw-r--r-- | chrome/browser/renderer_host/render_widget_host.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc index 9b18841..da18bd8 100644 --- a/chrome/browser/renderer_host/render_widget_host.cc +++ b/chrome/browser/renderer_host/render_widget_host.cc @@ -431,6 +431,28 @@ void RenderWidgetHost::NotifyTextDirection() { } } +void RenderWidgetHost::ImeSetInputMode(bool activate) { + Send(new ViewMsg_ImeSetInputMode(routing_id(), activate)); +} + +void RenderWidgetHost::ImeSetComposition(const std::wstring& ime_string, + int cursor_position, + int target_start, + int target_end) { + Send(new ViewMsg_ImeSetComposition(routing_id(), 0, cursor_position, + target_start, target_end, ime_string)); +} + +void RenderWidgetHost::ImeConfirmComposition(const std::wstring& ime_string) { + Send(new ViewMsg_ImeSetComposition(routing_id(), 1, -1, -1, -1, ime_string)); +} + +void RenderWidgetHost::ImeCancelComposition() { + std::wstring empty_string; + Send(new ViewMsg_ImeSetComposition(routing_id(), -1, -1, -1, -1, + empty_string)); +} + gfx::Rect RenderWidgetHost::GetRootWindowResizerRect() const { return gfx::Rect(); } |