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 b6bd563b3e1211450d526bc87da35a88c3996db4..2bc7f33f92449579c3d22421e9a539fe02ee9800 100644 |
| --- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
| +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
| @@ -1924,6 +1924,24 @@ void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { |
| event->type() == ui::ET_MOUSE_DRAGGED) && |
| mouse_event.x == center.x() && mouse_event.y == center.y(); |
| + // For fractional scale factors, the conversion from pixels to dip and |
| + // vice versa could result in off by 1 or 2 errors which hurts us because |
| + // we want to avoid sending the artificial move to center event to the |
| + // renderer. Sending the move to center to the renderer cause the cursor |
| + // to bounce around the center of the screen leading to the lock operation |
| + // not working correctly. |
| + // Workaround is to treat a mouse move or drag event off by at most 2 px |
| + // from the center as a move to center event. |
| + if (synthetic_move_sent_ && (current_device_scale_factor_ != 1)) { |
|
cpu_(ooo_6.6-7.5)
2015/03/19 03:06:11
but !=1 does not mean fractional scale ..
ananta
2015/03/19 19:49:17
Yeah. I added a function called IsFractionalScaleF
|
| + if (event->type() == ui::ET_MOUSE_MOVED || |
| + event->type() == ui::ET_MOUSE_DRAGGED) { |
| + if ((abs(mouse_event.x - center.x()) <= 2) && |
| + (abs(mouse_event.y - center.y()) <= 2)) { |
| + is_move_to_center_event = true; |
| + } |
| + } |
| + } |
| + |
| ModifyEventMovementAndCoords(&mouse_event); |
| bool should_not_forward = is_move_to_center_event && synthetic_move_sent_; |