summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbcwhite@chromium.org <bcwhite@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-23 18:31:22 +0000
committerbcwhite@chromium.org <bcwhite@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-23 18:31:22 +0000
commita2214ebddba47a6170fc0e7e212198caa6b09dd4 (patch)
tree4222001888b0388171ee9aed957a8b8b34394769
parentbc4f946cf0d4110706a05b300229c2fa538851c8 (diff)
downloadchromium_src-a2214ebddba47a6170fc0e7e212198caa6b09dd4.zip
chromium_src-a2214ebddba47a6170fc0e7e212198caa6b09dd4.tar.gz
chromium_src-a2214ebddba47a6170fc0e7e212198caa6b09dd4.tar.bz2
Changed IME messages from View to Input.
There is a race condition caused by some messages (e.g. KeyDown) going through the compositor while others like IME composition do not, the result being that the composition occurs before the KeyDown event. By moving the IME messages to also be Input messages, they will also go through the compositor and be ordered correctly. BUG=376273 Review URL: https://codereview.chromium.org/324133002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279147 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/browser_plugin/browser_plugin_guest.cc26
-rw-r--r--content/browser/renderer_host/render_widget_host_impl.cc12
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura_unittest.cc6
-rw-r--r--content/common/input_messages.h27
-rw-r--r--content/common/view_messages.h26
-rw-r--r--content/renderer/render_frame_impl.cc2
-rw-r--r--content/renderer/render_view_impl.cc2
-rw-r--r--content/renderer/render_widget.cc10
8 files changed, 56 insertions, 55 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index 4cf4fb6..ae4b3ef 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -435,6 +435,12 @@ bool BrowserPluginGuest::ShouldForwardToBrowserPluginGuest(
bool BrowserPluginGuest::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuest, message)
+ IPC_MESSAGE_HANDLER(InputHostMsg_ImeCancelComposition,
+ OnImeCancelComposition)
+#if defined(OS_MACOSX) || defined(USE_AURA)
+ IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged,
+ OnImeCompositionRangeChanged)
+#endif
IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers,
OnHasTouchEventHandlers)
IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse)
@@ -449,12 +455,6 @@ bool BrowserPluginGuest::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus)
IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
OnTextInputStateChanged)
- IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition,
- OnImeCancelComposition)
-#if defined(OS_MACOSX) || defined(USE_AURA)
- IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged,
- OnImeCompositionRangeChanged)
-#endif
IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect)
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -541,19 +541,19 @@ void BrowserPluginGuest::OnImeSetComposition(
const std::vector<blink::WebCompositionUnderline>& underlines,
int selection_start,
int selection_end) {
- Send(new ViewMsg_ImeSetComposition(routing_id(),
- base::UTF8ToUTF16(text), underlines,
- selection_start, selection_end));
+ Send(new InputMsg_ImeSetComposition(routing_id(),
+ base::UTF8ToUTF16(text), underlines,
+ selection_start, selection_end));
}
void BrowserPluginGuest::OnImeConfirmComposition(
int instance_id,
const std::string& text,
bool keep_selection) {
- Send(new ViewMsg_ImeConfirmComposition(routing_id(),
- base::UTF8ToUTF16(text),
- gfx::Range::InvalidRange(),
- keep_selection));
+ Send(new InputMsg_ImeConfirmComposition(routing_id(),
+ base::UTF8ToUTF16(text),
+ gfx::Range::InvalidRange(),
+ keep_selection));
}
void BrowserPluginGuest::OnExtendSelectionAndDelete(
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 40359e9..806b0ca 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -443,6 +443,8 @@ bool RenderWidgetHostImpl::OnMessageReceived(const IPC::Message &msg) {
IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostImpl, msg)
IPC_MESSAGE_HANDLER(InputHostMsg_QueueSyntheticGesture,
OnQueueSyntheticGesture)
+ IPC_MESSAGE_HANDLER(InputHostMsg_ImeCancelComposition,
+ OnImeCancelComposition)
IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady)
IPC_MESSAGE_HANDLER(ViewHostMsg_RenderProcessGone, OnRenderProcessGone)
IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose)
@@ -461,8 +463,6 @@ bool RenderWidgetHostImpl::OnMessageReceived(const IPC::Message &msg) {
OnSetTouchEventEmulationEnabled)
IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
OnTextInputStateChanged)
- IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition,
- OnImeCancelComposition)
IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse)
IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse)
IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDisambiguationPopup,
@@ -481,7 +481,7 @@ bool RenderWidgetHostImpl::OnMessageReceived(const IPC::Message &msg) {
OnCompositorSurfaceBuffersSwapped)
#endif
#if defined(OS_MACOSX) || defined(USE_AURA)
- IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged,
+ IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged,
OnImeCompositionRangeChanged)
#endif
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -1263,7 +1263,7 @@ void RenderWidgetHostImpl::ImeSetComposition(
const std::vector<blink::WebCompositionUnderline>& underlines,
int selection_start,
int selection_end) {
- Send(new ViewMsg_ImeSetComposition(
+ Send(new InputMsg_ImeSetComposition(
GetRoutingID(), text, underlines, selection_start, selection_end));
}
@@ -1271,12 +1271,12 @@ void RenderWidgetHostImpl::ImeConfirmComposition(
const base::string16& text,
const gfx::Range& replacement_range,
bool keep_selection) {
- Send(new ViewMsg_ImeConfirmComposition(
+ Send(new InputMsg_ImeConfirmComposition(
GetRoutingID(), text, replacement_range, keep_selection));
}
void RenderWidgetHostImpl::ImeCancelComposition() {
- Send(new ViewMsg_ImeSetComposition(GetRoutingID(), base::string16(),
+ Send(new InputMsg_ImeSetComposition(GetRoutingID(), base::string16(),
std::vector<blink::WebCompositionUnderline>(), 0, 0));
}
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
index d05bd44..a11b4e6 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -776,11 +776,11 @@ TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) {
EXPECT_TRUE(view_->has_composition_text_);
{
const IPC::Message* msg =
- sink_->GetFirstMessageMatching(ViewMsg_ImeSetComposition::ID);
+ sink_->GetFirstMessageMatching(InputMsg_ImeSetComposition::ID);
ASSERT_TRUE(msg != NULL);
- ViewMsg_ImeSetComposition::Param params;
- ViewMsg_ImeSetComposition::Read(msg, &params);
+ InputMsg_ImeSetComposition::Param params;
+ InputMsg_ImeSetComposition::Read(msg, &params);
// composition text
EXPECT_EQ(composition_text.text, params.a);
// underlines
diff --git a/content/common/input_messages.h b/content/common/input_messages.h
index 6b36bec..aa6c4f1 100644
--- a/content/common/input_messages.h
+++ b/content/common/input_messages.h
@@ -25,6 +25,7 @@
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "ui/events/ipc/latency_info_param_traits.h"
#include "ui/gfx/point.h"
+#include "ui/gfx/range/range.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/vector2d_f.h"
@@ -113,6 +114,20 @@ IPC_MESSAGE_ROUTED3(InputMsg_HandleInputEvent,
IPC_MESSAGE_ROUTED1(InputMsg_CursorVisibilityChange,
bool /* is_visible */)
+// This message sends a string being composed with an input method.
+IPC_MESSAGE_ROUTED4(
+ InputMsg_ImeSetComposition,
+ base::string16, /* text */
+ std::vector<blink::WebCompositionUnderline>, /* underlines */
+ int, /* selectiont_start */
+ int /* selection_end */)
+
+// This message confirms an ongoing composition.
+IPC_MESSAGE_ROUTED3(InputMsg_ImeConfirmComposition,
+ base::string16 /* text */,
+ gfx::Range /* replacement_range */,
+ bool /* keep_selection */)
+
// This message notifies the renderer that the next key event is bound to one
// or more pre-defined edit commands. If the next key event is not handled
// by webkit, the specified edit commands shall be executed against current
@@ -207,6 +222,18 @@ IPC_MESSAGE_ROUTED1(InputHostMsg_SetTouchAction,
IPC_MESSAGE_ROUTED1(InputHostMsg_DidOverscroll,
content::DidOverscrollParams /* params */)
+// Required for cancelling an ongoing input method composition.
+IPC_MESSAGE_ROUTED0(InputHostMsg_ImeCancelComposition)
+
+#if defined(OS_MACOSX) || defined(USE_AURA)
+// On Mac and Aura IME can request composition character bounds
+// synchronously (see crbug.com/120597). This IPC message sends the character
+// bounds after every composition change to always have correct bound info.
+IPC_MESSAGE_ROUTED2(InputHostMsg_ImeCompositionRangeChanged,
+ gfx::Range /* composition range */,
+ std::vector<gfx::Rect> /* character bounds */)
+#endif
+
// Adding a new message? Stick to the sort order above: first platform
// independent InputMsg, then ifdefs for platform specific InputMsg, then
// platform independent InputHostMsg, then ifdefs for platform specific
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index 87ffb84..5896ebb 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -735,20 +735,6 @@ IPC_MESSAGE_ROUTED0(ViewMsg_CandidateWindowShown)
IPC_MESSAGE_ROUTED0(ViewMsg_CandidateWindowUpdated)
IPC_MESSAGE_ROUTED0(ViewMsg_CandidateWindowHidden)
-// This message sends a string being composed with an input method.
-IPC_MESSAGE_ROUTED4(
- ViewMsg_ImeSetComposition,
- base::string16, /* text */
- std::vector<blink::WebCompositionUnderline>, /* underlines */
- int, /* selectiont_start */
- int /* selection_end */)
-
-// This message confirms an ongoing composition.
-IPC_MESSAGE_ROUTED3(ViewMsg_ImeConfirmComposition,
- base::string16 /* text */,
- gfx::Range /* replacement_range */,
- bool /* keep_selection */)
-
// Used to notify the render-view that we have received a target URL. Used
// to prevent target URLs spamming the browser.
IPC_MESSAGE_ROUTED0(ViewMsg_UpdateTargetURL_ACK)
@@ -1433,9 +1419,6 @@ IPC_MESSAGE_ROUTED1(ViewHostMsg_OpenDateTimeDialog,
IPC_MESSAGE_ROUTED1(ViewHostMsg_TextInputStateChanged,
ViewHostMsg_TextInputState_Params /* input state params */)
-// Required for cancelling an ongoing input method composition.
-IPC_MESSAGE_ROUTED0(ViewHostMsg_ImeCancelComposition)
-
// Sent when the renderer changes the zoom level for a particular url, so the
// browser can update its records. If the view is a plugin doc, then url is
// used to update the zoom level for all pages in that site. Otherwise, the
@@ -1717,15 +1700,6 @@ IPC_MESSAGE_CONTROL1(ViewHostMsg_FreeTransportDIB,
TransportDIB::Id /* DIB id */)
#endif
-#if defined(OS_MACOSX) || defined(USE_AURA)
-// On Mac and Aura IME can request composition character bounds
-// synchronously (see crbug.com/120597). This IPC message sends the character
-// bounds after every composition change to always have correct bound info.
-IPC_MESSAGE_ROUTED2(ViewHostMsg_ImeCompositionRangeChanged,
- gfx::Range /* composition range */,
- std::vector<gfx::Rect> /* character bounds */)
-#endif
-
// Adding a new message? Stick to the sort order above: first platform
// independent ViewMsg, then ifdefs for platform specific ViewMsg, then platform
// independent ViewHostMsg, then ifdefs for platform specific ViewHostMsg.
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 335bd75..7a1974d 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -512,7 +512,7 @@ void RenderFrameImpl::PepperCancelComposition(
PepperPluginInstanceImpl* instance) {
if (instance != render_view_->focused_pepper_plugin())
return;
- Send(new ViewHostMsg_ImeCancelComposition(render_view_->GetRoutingID()));;
+ Send(new InputHostMsg_ImeCancelComposition(render_view_->GetRoutingID()));;
#if defined(OS_MACOSX) || defined(USE_AURA)
GetRenderWidget()->UpdateCompositionInfo(true);
#endif
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 10e4427..154c0cb 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -1540,7 +1540,7 @@ void RenderViewImpl::FrameDidStopLoading(WebFrame* frame) {
}
void RenderViewImpl::didCancelCompositionOnSelectionChange() {
- Send(new ViewHostMsg_ImeCancelComposition(routing_id()));
+ Send(new InputHostMsg_ImeCancelComposition(routing_id()));
}
bool RenderViewImpl::handleCurrentKeyboardEvent() {
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 38af273..657a1c00 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -573,6 +573,8 @@ bool RenderWidget::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent)
IPC_MESSAGE_HANDLER(InputMsg_CursorVisibilityChange,
OnCursorVisibilityChange)
+ IPC_MESSAGE_HANDLER(InputMsg_ImeSetComposition, OnImeSetComposition)
+ IPC_MESSAGE_HANDLER(InputMsg_ImeConfirmComposition, OnImeConfirmComposition)
IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost)
IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus)
IPC_MESSAGE_HANDLER(InputMsg_SyntheticGestureCompleted,
@@ -589,8 +591,6 @@ bool RenderWidget::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_CandidateWindowUpdated,
OnCandidateWindowUpdated)
IPC_MESSAGE_HANDLER(ViewMsg_CandidateWindowHidden, OnCandidateWindowHidden)
- IPC_MESSAGE_HANDLER(ViewMsg_ImeSetComposition, OnImeSetComposition)
- IPC_MESSAGE_HANDLER(ViewMsg_ImeConfirmComposition, OnImeConfirmComposition)
IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint)
IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection)
IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck)
@@ -1424,7 +1424,7 @@ void RenderWidget::OnImeSetComposition(
// If we failed to set the composition text, then we need to let the browser
// process to cancel the input method's ongoing composition session, to make
// sure we are in a consistent state.
- Send(new ViewHostMsg_ImeCancelComposition(routing_id()));
+ Send(new InputHostMsg_ImeCancelComposition(routing_id()));
}
#if defined(OS_MACOSX) || defined(USE_AURA)
UpdateCompositionInfo(true);
@@ -1782,7 +1782,7 @@ void RenderWidget::UpdateCompositionInfo(bool should_update_range) {
return;
composition_character_bounds_ = character_bounds;
composition_range_ = range;
- Send(new ViewHostMsg_ImeCompositionRangeChanged(
+ Send(new InputHostMsg_ImeCompositionRangeChanged(
routing_id(), composition_range_, composition_character_bounds_));
}
@@ -1857,7 +1857,7 @@ void RenderWidget::resetInputMethod() {
// If a composition text exists, then we need to let the browser process
// to cancel the input method's ongoing composition session.
if (webwidget_->confirmComposition())
- Send(new ViewHostMsg_ImeCancelComposition(routing_id()));
+ Send(new InputHostMsg_ImeCancelComposition(routing_id()));
}
#if defined(OS_MACOSX) || defined(USE_AURA)