Index: components/exo/pointer.cc |
diff --git a/components/exo/pointer.cc b/components/exo/pointer.cc |
index fe25e944589c979ca614ba3fbbd30170ab05c15f..f81ebbe5f84c156d87b14aba0cd391fd1f428922 100644 |
--- a/components/exo/pointer.cc |
+++ b/components/exo/pointer.cc |
@@ -207,13 +207,26 @@ void Pointer::OnMouseEvent(ui::MouseEvent* event) { |
break; |
} |
case ui::ET_SCROLL_FLING_START: { |
+ // Fling start in chrome signals the lifting of fingers after scrolling. |
+ // In wayland terms this signals the end of a scroll sequence. |
delegate_->OnPointerScrollStop(event->time_stamp()); |
delegate_->OnPointerFrame(); |
break; |
} |
case ui::ET_SCROLL_FLING_CANCEL: { |
- delegate_->OnPointerScrollCancel(event->time_stamp()); |
- delegate_->OnPointerFrame(); |
+ // Fling cancel is generated very generously at every touch of the |
+ // touchpad. Since it's not directly supported by the delegate, we do not |
+ // want limit this event to only right after a fling start has been |
+ // generated to prevent erronous behavior. |
+ if (last_event_type_ == ui::ET_SCROLL_FLING_START) { |
+ // We emulate fling cancel by starting a new scroll sequence that |
+ // scrolls by 0 pixels, effectively stopping any kinetic scroll motion. |
+ delegate_->OnPointerScroll(event->time_stamp(), gfx::Vector2dF(), |
+ false); |
+ delegate_->OnPointerFrame(); |
+ delegate_->OnPointerScrollStop(event->time_stamp()); |
+ delegate_->OnPointerFrame(); |
+ } |
break; |
} |
case ui::ET_MOUSE_MOVED: |
@@ -227,6 +240,7 @@ void Pointer::OnMouseEvent(ui::MouseEvent* event) { |
break; |
} |
+ last_event_type_ = event->type(); |
UpdateCursorScale(); |
} |