summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorananta <ananta@chromium.org>2015-03-12 16:05:54 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-12 23:06:29 +0000
commit25448ed3024720e7b829e8135fa046dfc05304d2 (patch)
tree551ca70b86221054f5c05e78140b9f6f92257e01 /content
parentc655cc2a17c6c7fd113346bedc8433488c4b6dbe (diff)
downloadchromium_src-25448ed3024720e7b829e8135fa046dfc05304d2.zip
chromium_src-25448ed3024720e7b829e8135fa046dfc05304d2.tar.gz
chromium_src-25448ed3024720e7b829e8135fa046dfc05304d2.tar.bz2
Don't forward mouse leaves to the renderer process if the mouse leave was generated due to a selection popup.
This typically happens if a select box is displayed or any popup for that matter. Sending the mouse leave to the renderer process for the original view confuses sites which use the mouseleave as a trigger to dismiss the popup. This is on the same lines as the original code in render_widget_host_view_win.cc. With this fix moz.com exhibits the same behavior in Chrome and Firefox where in the select dropdown is selectable with the mouse and is dismissed when we move away from the popup window. BUG=461291 R=cpu Review URL: https://codereview.chromium.org/1004543004 Cr-Commit-Position: refs/heads/master@{#320401}
Diffstat (limited to 'content')
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc43
1 files changed, 26 insertions, 17 deletions
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 b6bd563..874e34b 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -231,11 +231,14 @@ BOOL CALLBACK DismissOwnedPopups(HWND window, LPARAM arg) {
}
#endif
-bool CanRendererHandleEvent(const ui::MouseEvent* event, bool mouse_locked) {
+bool CanRendererHandleEvent(const ui::MouseEvent* event,
+ bool mouse_locked,
+ bool selection_popup) {
if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED)
return false;
- if (mouse_locked && (event->type() == ui::ET_MOUSE_EXITED))
+ if ((mouse_locked || selection_popup) &&
+ (event->type() == ui::ET_MOUSE_EXITED))
return false;
#if defined(OS_WIN)
@@ -1935,8 +1938,10 @@ void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) {
synthetic_move_sent_ = true;
window_->MoveCursorTo(center);
}
+ bool is_selection_popup = popup_child_host_view_ &&
+ popup_child_host_view_->NeedsInputGrab();
// Forward event to renderer.
- if (CanRendererHandleEvent(event, mouse_locked_) &&
+ if (CanRendererHandleEvent(event, mouse_locked_, is_selection_popup) &&
!(event->flags() & ui::EF_FROM_TOUCH)) {
host_->ForwardMouseEvent(mouse_event);
// Ensure that we get keyboard focus on mouse down as a plugin window
@@ -1986,20 +1991,24 @@ void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) {
MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event));
if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0)
host_->ForwardWheelEvent(mouse_wheel_event);
- } else if (CanRendererHandleEvent(event, mouse_locked_) &&
- !(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);
- // Ensure that we get keyboard focus on mouse down as a plugin window may
- // have grabbed keyboard focus.
- if (event->type() == ui::ET_MOUSE_PRESSED)
- SetKeyboardFocus();
+ } else {
+ bool is_selection_popup = popup_child_host_view_ &&
+ popup_child_host_view_->NeedsInputGrab();
+ if (CanRendererHandleEvent(event, mouse_locked_, is_selection_popup) &&
+ !(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);
+ // Ensure that we get keyboard focus on mouse down as a plugin window may
+ // have grabbed keyboard focus.
+ if (event->type() == ui::ET_MOUSE_PRESSED)
+ SetKeyboardFocus();
+ }
}
switch (event->type()) {