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

Unified Diff: Source/web/WebViewImpl.cpp

Issue 889803004: Add touchpad pinch zoom support to Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Incorporate review feedback Created 5 years, 11 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
« Source/core/frame/PinchViewport.h ('K') | « Source/core/frame/PinchViewport.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebViewImpl.cpp
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
index 06e1c3efd3a9d6a137123b869811287b1502407b..26186dce3e68c3257acc877c76722f158580bf92 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -2140,8 +2140,25 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent)
// Unhandled touchpad gesture pinch events synthesize mouse wheel events.
if (inputEvent.type == WebInputEvent::GesturePinchUpdate) {
- if (handleSyntheticWheelFromTouchpadPinchEvent(static_cast<const WebGestureEvent&>(inputEvent)))
+ const WebGestureEvent& pinchEvent = static_cast<const WebGestureEvent&>(inputEvent);
+
+ // First, synthesize a Windows-like wheel event to send to any handlers that may exist.
+ if (handleSyntheticWheelFromTouchpadPinchEvent(pinchEvent))
return true;
+
+ if (pinchVirtualViewportEnabled()) {
+ const float oldPageScale = pageScaleFactor();
+ const float newPageScale = clampPageScaleFactorToLimits(oldPageScale * pinchEvent.data.pinchUpdate.scale);
+ if (newPageScale != oldPageScale) {
bokan 2015/02/03 03:05:16 Please fold this "changed" check inside the method
ccameron 2015/02/03 17:03:28 Done.
+ page()->frameHost().pinchViewport().setScaleAroundAnchor(
+ newPageScale, FloatPoint(pinchEvent.x, pinchEvent.y));
+ }
+ }
+
+ // TODO(ccameron): Always return that the event was handled. Once the pinch-zoom content scale
+ // handlers have been removed from content, this function may return false if the page scale does
+ // not change.
+ return true;
}
return false;
« Source/core/frame/PinchViewport.h ('K') | « Source/core/frame/PinchViewport.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698