Chromium Code Reviews| 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 5fb48340e8e0d9797cbd848df330f0bc9e38b379..61d35911b3f622d6d51323a5b831fdf77b986d77 100644 |
| --- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
| +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
| @@ -1819,7 +1819,21 @@ void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { |
| void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { |
| TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnMouseEvent"); |
| + if (event->type() == ui::ET_MOUSE_MOVED) { |
|
scheib
2016/10/04 02:01:34
It seems correct only if a move event will always
ananta
2016/10/04 02:21:20
On Windows, a visible window can safely assume tha
|
| + last_mouse_position_.set_x(event->x()); |
| + last_mouse_position_.set_y(event->y()); |
| + } else if (event->type() == ui::ET_MOUSE_ENTERED || |
| + event->type() == ui::ET_MOUSE_EXITED) { |
| + // For mouse entered and exited states the |ui_mouse_event| parameter |
| + // contains the location of the cursor which does not work for webpages as |
| + // they may track mouse movement deltas. To ensure that the deltas are |
| + // correct we set the location of the event to the last mouse move |
| + // location. |
| + event->set_location(last_mouse_position_); |
| + } |
| + |
| ForwardMouseEventToParent(event); |
| + |
| // TODO(mgiuca): Return if event->handled() returns true. This currently |
| // breaks drop-down lists which means something is incorrectly setting |
| // event->handled to true (http://crbug.com/577983). |
| @@ -1875,7 +1889,7 @@ void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { |
| } |
| } |
| - ModifyEventMovementAndCoords(&mouse_event); |
| + ModifyEventMovementAndCoords(&mouse_event, event); |
| bool should_not_forward = is_move_to_center_event && synthetic_move_sent_; |
| if (should_not_forward) { |
| @@ -1954,7 +1968,7 @@ void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { |
| blink::WebMouseEvent mouse_event = ui::MakeWebMouseEvent( |
| *event, base::Bind(&GetScreenLocationFromEvent)); |
| - ModifyEventMovementAndCoords(&mouse_event); |
| + ModifyEventMovementAndCoords(&mouse_event, event); |
| if (ShouldRouteEvent(event)) { |
| host_->delegate()->GetInputEventRouter()->RouteMouseEvent( |
| this, &mouse_event, *event->latency()); |
| @@ -2500,12 +2514,14 @@ void RenderWidgetHostViewAura::FinishImeCompositionSession() { |
| } |
| void RenderWidgetHostViewAura::ModifyEventMovementAndCoords( |
| - blink::WebMouseEvent* event) { |
| + blink::WebMouseEvent* event, |
| + ui::MouseEvent* ui_mouse_event) { |
| // If the mouse has just entered, we must report zero movementX/Y. Hence we |
| // reset any global_mouse_position set previously. |
| - if (event->type == blink::WebInputEvent::MouseEnter || |
| - event->type == blink::WebInputEvent::MouseLeave) |
| - global_mouse_position_.SetPoint(event->globalX, event->globalY); |
| + if ((ui_mouse_event->type() == ui::ET_MOUSE_ENTERED || |
| + ui_mouse_event->type() == ui::ET_MOUSE_EXITED)) { |
| + global_mouse_position_.SetPoint(event->globalX, event->globalY); |
| + } |
| // Movement is computed by taking the difference of the new cursor position |
| // and the previous. Under mouse lock the cursor will be warped back to the |