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

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

Issue 899283004: Remove pinch zoom handling from the browser process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
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 bb0546483a7a9c84bfcbc6a0ef90d87647996021..0856f2890c60db89044c2b8f0fc299e1dc7371b4 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -350,8 +350,6 @@ WebContentsImpl::WebContentsImpl(BrowserContext* browser_context,
closed_by_user_gesture_(false),
minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)),
maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)),
- totalPinchGestureAmount_(0),
- currentPinchZoomStepDelta_(0),
render_view_message_source_(NULL),
render_frame_message_source_(NULL),
fullscreen_widget_routing_id_(MSG_ROUTING_NONE),
@@ -1427,46 +1425,6 @@ bool WebContentsImpl::PreHandleGestureEvent(
return delegate_ && delegate_->PreHandleGestureEvent(this, event);
}
-bool WebContentsImpl::HandleGestureEvent(
- const blink::WebGestureEvent& event) {
- // Some platforms (eg. Mac) send GesturePinch events for trackpad pinch-zoom.
- // Use them to implement browser zoom, as for HandleWheelEvent above.
- if (event.type == blink::WebInputEvent::GesturePinchUpdate &&
- event.sourceDevice == blink::WebGestureDeviceTouchpad) {
- // The scale difference necessary to trigger a zoom action. Derived from
- // experimentation to find a value that feels reasonable.
- const float kZoomStepValue = 0.6f;
-
- // Find the (absolute) thresholds on either side of the current zoom factor,
- // then convert those to actual numbers to trigger a zoom in or out.
- // This logic deliberately makes the range around the starting zoom value
- // for the gesture twice as large as the other ranges (i.e., the notches are
- // at ..., -3*step, -2*step, -step, step, 2*step, 3*step, ... but not at 0)
- // so that it's easier to get back to your starting point than it is to
- // overshoot.
- float nextStep = (abs(currentPinchZoomStepDelta_) + 1) * kZoomStepValue;
- float backStep = abs(currentPinchZoomStepDelta_) * kZoomStepValue;
- float zoomInThreshold = (currentPinchZoomStepDelta_ >= 0) ? nextStep
- : -backStep;
- float zoomOutThreshold = (currentPinchZoomStepDelta_ <= 0) ? -nextStep
- : backStep;
-
- totalPinchGestureAmount_ += (event.data.pinchUpdate.scale - 1.0);
- if (totalPinchGestureAmount_ > zoomInThreshold) {
- currentPinchZoomStepDelta_++;
- if (delegate_)
- delegate_->ContentsZoomChange(true);
- } else if (totalPinchGestureAmount_ < zoomOutThreshold) {
- currentPinchZoomStepDelta_--;
- if (delegate_)
- delegate_->ContentsZoomChange(false);
- }
- return true;
- }
-
- return false;
-}
-
void WebContentsImpl::HandleMouseDown() {
if (delegate_)
delegate_->HandleMouseDown();
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/browser/web_contents/web_contents_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698