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

Side by Side Diff: content/test/web_gesture_curve_mock.cc

Issue 136173004: Early terminate flings when scrolling impossible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 8 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
« no previous file with comments | « content/renderer/input/input_handler_wrapper.cc ('k') | ui/gfx/android/scroller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/test/web_gesture_curve_mock.h" 5 #include "content/test/web_gesture_curve_mock.h"
6 6
7 #include "content/test/weburl_loader_mock_factory.h" 7 #include "content/test/weburl_loader_mock_factory.h"
8 #include "third_party/WebKit/public/platform/WebFloatSize.h" 8 #include "third_party/WebKit/public/platform/WebFloatSize.h"
9 #include "third_party/WebKit/public/platform/WebGestureCurveTarget.h" 9 #include "third_party/WebKit/public/platform/WebGestureCurveTarget.h"
10 10
11 WebGestureCurveMock::WebGestureCurveMock(const blink::WebFloatPoint& velocity, 11 WebGestureCurveMock::WebGestureCurveMock(const blink::WebFloatPoint& velocity,
12 const blink::WebSize& cumulative_scroll) 12 const blink::WebSize& cumulative_scroll)
13 : velocity_(velocity), 13 : velocity_(velocity),
14 cumulative_scroll_(cumulative_scroll) { 14 cumulative_scroll_(cumulative_scroll) {
15 } 15 }
16 16
17 WebGestureCurveMock::~WebGestureCurveMock() { 17 WebGestureCurveMock::~WebGestureCurveMock() {
18 } 18 }
19 19
20 bool WebGestureCurveMock::apply(double time, 20 bool WebGestureCurveMock::apply(double time,
21 blink::WebGestureCurveTarget* target) { 21 blink::WebGestureCurveTarget* target) {
22 blink::WebSize displacement(velocity_.x * time, velocity_.y * time); 22 blink::WebSize displacement(velocity_.x * time, velocity_.y * time);
23 blink::WebFloatSize increment(displacement.width - cumulative_scroll_.width, 23 blink::WebFloatSize increment(displacement.width - cumulative_scroll_.width,
24 displacement.height - cumulative_scroll_.height); 24 displacement.height - cumulative_scroll_.height);
25 cumulative_scroll_ = displacement; 25 cumulative_scroll_ = displacement;
26 target->notifyCurrentFlingVelocity(blink::WebFloatSize(velocity_.x, 26 blink::WebFloatSize velocity(velocity_.x, velocity_.y);
27 velocity_.y));
28 // scrollBy() could delete this curve if the animation is over, so don't 27 // scrollBy() could delete this curve if the animation is over, so don't
29 // touch any member variables after making that call. 28 // touch any member variables after making that call.
30 target->scrollBy(increment); 29 target->scrollBy(increment, velocity);
31 return true; 30 return true;
32 } 31 }
OLDNEW
« no previous file with comments | « content/renderer/input/input_handler_wrapper.cc ('k') | ui/gfx/android/scroller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698