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

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

Issue 2386103004: Ensure that we don't report huge mouse movement deltas for mouse enter and leave events. (Closed)
Patch Set: Address sky review comments Created 4 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 852e71fb99f8c7bcbf6ca9e0e96fbc77f07a1d10..3a549939f7a54fda956d7a3b9fa64a31066901d0 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -1897,7 +1897,7 @@ void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) {
}
}
- ModifyEventMovementAndCoords(&mouse_event);
+ ModifyEventMovementAndCoords(*event, &mouse_event);
bool should_not_forward = is_move_to_center_event && synthetic_move_sent_;
if (should_not_forward) {
@@ -1976,7 +1976,7 @@ void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) {
blink::WebMouseEvent mouse_event = ui::MakeWebMouseEvent(
*event, base::Bind(&GetScreenLocationFromEvent));
- ModifyEventMovementAndCoords(&mouse_event);
+ ModifyEventMovementAndCoords(*event, &mouse_event);
if (ShouldRouteEvent(event)) {
host_->delegate()->GetInputEventRouter()->RouteMouseEvent(this,
&mouse_event);
@@ -2522,12 +2522,14 @@ void RenderWidgetHostViewAura::FinishImeCompositionSession() {
}
void RenderWidgetHostViewAura::ModifyEventMovementAndCoords(
+ const ui::MouseEvent& ui_mouse_event,
blink::WebMouseEvent* 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698