Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 614553002: Make sure the IME composition is canceled before forwarding the mouse pressed event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added an unit test. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 3b8bb93ebc947770f8bf58510255cefc2a5a92a3..aea511565cfca8163fe1efbf80fdc03e22a0db56 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -1919,6 +1919,11 @@ void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) {
host_->ForwardWheelEvent(mouse_wheel_event);
} else if (CanRendererHandleEvent(event) &&
!(event->flags() & ui::EF_FROM_TOUCH)) {
+ // Confirm existing composition text on mouse press, to make sure
+ // the input caret won't be moved with an ongoing composition text.
+ if (event->type() == ui::ET_MOUSE_PRESSED)
+ FinishImeCompositionSession();
+
blink::WebMouseEvent mouse_event = MakeWebMouseEvent(event);
ModifyEventMovementAndCoords(&mouse_event);
host_->ForwardMouseEvent(mouse_event);
@@ -1931,9 +1936,6 @@ void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) {
switch (event->type()) {
case ui::ET_MOUSE_PRESSED:
window_->SetCapture();
- // Confirm existing composition text on mouse click events, to make sure
- // the input caret won't be moved with an ongoing composition text.
- FinishImeCompositionSession();
break;
case ui::ET_MOUSE_RELEASED:
if (!NeedsMouseCapture())
@@ -1949,7 +1951,7 @@ void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) {
// In fullscreen mode which is typically used by flash, don't forward
// the mouse events to the parent. The renderer and the plugin process
// handle these events.
- if (!is_fullscreen_ && window_->parent()->delegate() &&
+ if (!is_fullscreen_ && window_->parent() && window_->parent()->delegate() &&
!(event->flags() & ui::EF_FROM_TOUCH)) {
event->ConvertLocationToTarget(window_, window_->parent());
window_->parent()->delegate()->OnMouseEvent(event);
@@ -2027,6 +2029,11 @@ void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) {
if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event))
return;
+ // Confirm existing composition text on TAP gesture, to make sure the input
+ // caret won't be moved with an ongoing composition text.
+ if (event->type() == ui::ET_GESTURE_TAP)
+ FinishImeCompositionSession();
+
RenderViewHostDelegate* delegate = NULL;
if (host_->IsRenderView())
delegate = RenderViewHost::From(host_)->GetDelegate();

Powered by Google App Engine
This is Rietveld 408576698