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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 304793003: use enum to specify deviceSource for fling animation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased for parallel breaking changes Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 bool WebContentsImpl::PreHandleGestureEvent( 1226 bool WebContentsImpl::PreHandleGestureEvent(
1227 const blink::WebGestureEvent& event) { 1227 const blink::WebGestureEvent& event) {
1228 return delegate_ && delegate_->PreHandleGestureEvent(this, event); 1228 return delegate_ && delegate_->PreHandleGestureEvent(this, event);
1229 } 1229 }
1230 1230
1231 bool WebContentsImpl::HandleGestureEvent( 1231 bool WebContentsImpl::HandleGestureEvent(
1232 const blink::WebGestureEvent& event) { 1232 const blink::WebGestureEvent& event) {
1233 // Some platforms (eg. Mac) send GesturePinch events for trackpad pinch-zoom. 1233 // Some platforms (eg. Mac) send GesturePinch events for trackpad pinch-zoom.
1234 // Use them to implement browser zoom, as for HandleWheelEvent above. 1234 // Use them to implement browser zoom, as for HandleWheelEvent above.
1235 if (event.type == blink::WebInputEvent::GesturePinchUpdate && 1235 if (event.type == blink::WebInputEvent::GesturePinchUpdate &&
1236 event.sourceDevice == blink::WebGestureEvent::Touchpad) { 1236 event.sourceDevice == blink::WebGestureDeviceTouchpad) {
1237 // The scale difference necessary to trigger a zoom action. Derived from 1237 // The scale difference necessary to trigger a zoom action. Derived from
1238 // experimentation to find a value that feels reasonable. 1238 // experimentation to find a value that feels reasonable.
1239 const float kZoomStepValue = 0.6f; 1239 const float kZoomStepValue = 0.6f;
1240 1240
1241 // Find the (absolute) thresholds on either side of the current zoom factor, 1241 // Find the (absolute) thresholds on either side of the current zoom factor,
1242 // then convert those to actual numbers to trigger a zoom in or out. 1242 // then convert those to actual numbers to trigger a zoom in or out.
1243 // This logic deliberately makes the range around the starting zoom value 1243 // This logic deliberately makes the range around the starting zoom value
1244 // for the gesture twice as large as the other ranges (i.e., the notches are 1244 // for the gesture twice as large as the other ranges (i.e., the notches are
1245 // at ..., -3*step, -2*step, -step, step, 2*step, 3*step, ... but not at 0) 1245 // at ..., -3*step, -2*step, -step, step, 2*step, 3*step, ... but not at 0)
1246 // so that it's easier to get back to your starting point than it is to 1246 // so that it's easier to get back to your starting point than it is to
(...skipping 2800 matching lines...) Expand 10 before | Expand all | Expand 10 after
4047 4047
4048 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { 4048 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) {
4049 if (!delegate_) 4049 if (!delegate_)
4050 return; 4050 return;
4051 const gfx::Size new_size = GetPreferredSize(); 4051 const gfx::Size new_size = GetPreferredSize();
4052 if (new_size != old_size) 4052 if (new_size != old_size)
4053 delegate_->UpdatePreferredSize(this, new_size); 4053 delegate_->UpdatePreferredSize(this, new_size);
4054 } 4054 }
4055 4055
4056 } // namespace content 4056 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/web_input_event_aura.cc ('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