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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 688253002: Implemented smooth scrolling using xinput2 in X11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disabled coalescing for all scroll events Created 5 years, 1 month 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
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

Powered by Google App Engine
This is Rietveld 408576698