Index: content/browser/web_contents/web_contents_impl.cc |
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
index c36e3a7772a42c2db4136b046e7e05f35b378305..85c189550575dd819ffd0a3f5c02daf84fc0617a 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -1591,7 +1591,14 @@ bool WebContentsImpl::HandleWheelEvent( |
if (delegate_ && event.wheelTicksY && |
(event.modifiers & blink::WebInputEvent::ControlKey) && |
!event.canScroll) { |
- delegate_->ContentsZoomChange(event.wheelTicksY > 0); |
+ // Count only integer cumulative scrolls as zoom events; this handles |
+ // smooth scroll and regular scroll device behavior. |
+ zoom_scroll_amount_ += event.wheelTicksY; |
+ int whole_zoom_scroll_amount = round(zoom_scroll_amount_); |
+ zoom_scroll_amount_ -= whole_zoom_scroll_amount; |
+ if (whole_zoom_scroll_amount != 0) { |
+ delegate_->ContentsZoomChange(whole_zoom_scroll_amount > 0); |
+ } |
return true; |
} |
#endif |