summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsuzhe@google.com <suzhe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-05 18:36:24 +0000
committersuzhe@google.com <suzhe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-05 18:36:24 +0000
commit6b3496508c43ceda2e3476c4d75165891c6a6e44 (patch)
tree75cf792ac4d6bb368292c59448429af20a040b67
parent5885edba2c88322ca909218f10b26823fe9639fa (diff)
downloadchromium_src-6b3496508c43ceda2e3476c4d75165891c6a6e44.zip
chromium_src-6b3496508c43ceda2e3476c4d75165891c6a6e44.tar.gz
chromium_src-6b3496508c43ceda2e3476c4d75165891c6a6e44.tar.bz2
Uses bool WebKit::WebWidget::confirmComposition(const WebString& text).
Before this CL, following events will be received by the web page when a text is inserted by an IME: compositionstart compositionend textInput With this CL, the web page will only receive textInput event. See also: https://bugs.webkit.org/show_bug.cgi?id=51693 BUG=none TEST=none Review URL: http://codereview.chromium.org/5999012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70525 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/renderer_host/render_widget_host.cc6
-rw-r--r--chrome/common/render_messages_internal.h3
-rw-r--r--chrome/renderer/render_view_browsertest.cc13
-rw-r--r--chrome/renderer/render_widget.cc4
-rw-r--r--chrome/renderer/render_widget.h2
5 files changed, 13 insertions, 15 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc
index 28862af..7a7a5d6 100644
--- a/chrome/browser/renderer_host/render_widget_host.cc
+++ b/chrome/browser/renderer_host/render_widget_host.cc
@@ -714,13 +714,11 @@ void RenderWidgetHost::ImeSetComposition(
}
void RenderWidgetHost::ImeConfirmComposition(const string16& text) {
- Send(new ViewMsg_ImeSetComposition(routing_id(),
- text, std::vector<WebKit::WebCompositionUnderline>(), 0, 0));
- Send(new ViewMsg_ImeConfirmComposition(routing_id()));
+ Send(new ViewMsg_ImeConfirmComposition(routing_id(), text));
}
void RenderWidgetHost::ImeConfirmComposition() {
- Send(new ViewMsg_ImeConfirmComposition(routing_id()));
+ Send(new ViewMsg_ImeConfirmComposition(routing_id(), string16()));
}
void RenderWidgetHost::ImeCancelComposition() {
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index f94f1ed..999a72f 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -530,7 +530,8 @@ IPC_MESSAGE_ROUTED4(
int /* selection_end */)
// This message confirms an ongoing composition.
-IPC_MESSAGE_ROUTED0(ViewMsg_ImeConfirmComposition)
+IPC_MESSAGE_ROUTED1(ViewMsg_ImeConfirmComposition,
+ string16 /* text */)
// This passes a set of webkit preferences down to the renderer.
IPC_MESSAGE_ROUTED1(ViewMsg_UpdateWebPreferences, WebPreferences)
diff --git a/chrome/renderer/render_view_browsertest.cc b/chrome/renderer/render_view_browsertest.cc
index f7f58c8..51303e4 100644
--- a/chrome/renderer/render_view_browsertest.cc
+++ b/chrome/renderer/render_view_browsertest.cc
@@ -248,9 +248,7 @@ TEST_F(RenderViewTest, ImeComposition) {
{IME_SETCOMPOSITION, false, 3, 3, L"nih", L"nih"},
{IME_SETCOMPOSITION, false, 4, 4, L"niha", L"niha"},
{IME_SETCOMPOSITION, false, 5, 5, L"nihao", L"nihao"},
- {IME_SETCOMPOSITION, false, 2, 2, L"\x4F60\x597D", L"\x4F60\x597D"},
- {IME_CONFIRMCOMPOSITION, false, -1, -1, NULL, L"\x4F60\x597D"},
- {IME_CANCELCOMPOSITION, false, -1, -1, L"", L"\x4F60\x597D"},
+ {IME_CONFIRMCOMPOSITION, false, -1, -1, L"\x4F60\x597D", L"\x4F60\x597D"},
// Scenario 2: input a Japanese word with Microsoft IME (on Vista).
{IME_INITIALIZE, true, 0, 0, NULL, NULL},
{IME_SETINPUTMODE, true, 0, 0, NULL, NULL},
@@ -264,7 +262,7 @@ TEST_F(RenderViewTest, ImeComposition) {
L"\x304B\x3093\x3058"},
{IME_SETCOMPOSITION, false, 0, 2, L"\x611F\x3058", L"\x611F\x3058"},
{IME_SETCOMPOSITION, false, 0, 2, L"\x6F22\x5B57", L"\x6F22\x5B57"},
- {IME_CONFIRMCOMPOSITION, false, -1, -1, NULL, L"\x6F22\x5B57"},
+ {IME_CONFIRMCOMPOSITION, false, -1, -1, L"", L"\x6F22\x5B57"},
{IME_CANCELCOMPOSITION, false, -1, -1, L"", L"\x6F22\x5B57"},
// Scenario 3: input a Korean word with Microsot IME (on Vista).
{IME_INITIALIZE, true, 0, 0, NULL, NULL},
@@ -273,13 +271,13 @@ TEST_F(RenderViewTest, ImeComposition) {
{IME_SETCOMPOSITION, false, 0, 1, L"\x3147", L"\x3147"},
{IME_SETCOMPOSITION, false, 0, 1, L"\xC544", L"\xC544"},
{IME_SETCOMPOSITION, false, 0, 1, L"\xC548", L"\xC548"},
- {IME_CONFIRMCOMPOSITION, false, -1, -1, NULL, L"\xC548"},
+ {IME_CONFIRMCOMPOSITION, false, -1, -1, L"", L"\xC548"},
{IME_SETCOMPOSITION, false, 0, 1, L"\x3134", L"\xC548\x3134"},
{IME_SETCOMPOSITION, false, 0, 1, L"\xB140", L"\xC548\xB140"},
{IME_SETCOMPOSITION, false, 0, 1, L"\xB155", L"\xC548\xB155"},
{IME_CANCELCOMPOSITION, false, -1, -1, L"", L"\xC548"},
{IME_SETCOMPOSITION, false, 0, 1, L"\xB155", L"\xC548\xB155"},
- {IME_CONFIRMCOMPOSITION, false, -1, -1, NULL, L"\xC548\xB155"},
+ {IME_CONFIRMCOMPOSITION, false, -1, -1, L"", L"\xC548\xB155"},
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kImeMessages); i++) {
@@ -320,7 +318,8 @@ TEST_F(RenderViewTest, ImeComposition) {
break;
case IME_CONFIRMCOMPOSITION:
- view_->OnImeConfirmComposition();
+ view_->OnImeConfirmComposition(
+ WideToUTF16Hack(ime_message->ime_string));
break;
case IME_CANCELCOMPOSITION:
diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc
index 2f14576..6ec3040 100644
--- a/chrome/renderer/render_widget.cc
+++ b/chrome/renderer/render_widget.cc
@@ -810,9 +810,9 @@ void RenderWidget::OnImeSetComposition(
}
}
-void RenderWidget::OnImeConfirmComposition() {
+void RenderWidget::OnImeConfirmComposition(const string16& text) {
if (webwidget_)
- webwidget_->confirmComposition();
+ webwidget_->confirmComposition(text);
}
// This message causes the renderer to render an image of the
diff --git a/chrome/renderer/render_widget.h b/chrome/renderer/render_widget.h
index f847ce2..ed99bbd 100644
--- a/chrome/renderer/render_widget.h
+++ b/chrome/renderer/render_widget.h
@@ -188,7 +188,7 @@ class RenderWidget : public IPC::Channel::Listener,
const std::vector<WebKit::WebCompositionUnderline>& underlines,
int selection_start,
int selection_end);
- void OnImeConfirmComposition();
+ void OnImeConfirmComposition(const string16& text);
void OnMsgPaintAtSize(const TransportDIB::Handle& dib_id,
int tag,
const gfx::Size& page_size,