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

Side by Side Diff: third_party/WebKit/Source/platform/exported/WebActiveGestureAnimation.cpp

Issue 2908073008: Remove a frame of delay on main-thread FlingStart. [2nd land] (Closed)
Patch Set: Fix pad-gesture-fling properlyy Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 15 matching lines...) Expand all
26 #include "platform/exported/WebActiveGestureAnimation.h" 26 #include "platform/exported/WebActiveGestureAnimation.h"
27 27
28 #include <memory> 28 #include <memory>
29 #include "platform/wtf/PtrUtil.h" 29 #include "platform/wtf/PtrUtil.h"
30 #include "public/platform/WebGestureCurve.h" 30 #include "public/platform/WebGestureCurve.h"
31 #include "public/platform/WebGestureCurveTarget.h" 31 #include "public/platform/WebGestureCurveTarget.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 std::unique_ptr<WebActiveGestureAnimation> 35 std::unique_ptr<WebActiveGestureAnimation>
36 WebActiveGestureAnimation::CreateAtAnimationStart(
37 std::unique_ptr<WebGestureCurve> curve,
38 WebGestureCurveTarget* target) {
39 return WTF::WrapUnique(
40 new WebActiveGestureAnimation(std::move(curve), target, 0, true));
41 }
42
43 std::unique_ptr<WebActiveGestureAnimation>
44 WebActiveGestureAnimation::CreateWithTimeOffset( 36 WebActiveGestureAnimation::CreateWithTimeOffset(
45 std::unique_ptr<WebGestureCurve> curve, 37 std::unique_ptr<WebGestureCurve> curve,
46 WebGestureCurveTarget* target, 38 WebGestureCurveTarget* target,
47 double start_time) { 39 double start_time) {
48 return WTF::WrapUnique(new WebActiveGestureAnimation(std::move(curve), target, 40 return WTF::WrapUnique(
49 start_time, false)); 41 new WebActiveGestureAnimation(std::move(curve), target, start_time));
50 } 42 }
51 43
52 WebActiveGestureAnimation::~WebActiveGestureAnimation() {} 44 WebActiveGestureAnimation::~WebActiveGestureAnimation() {}
53 45
54 WebActiveGestureAnimation::WebActiveGestureAnimation( 46 WebActiveGestureAnimation::WebActiveGestureAnimation(
55 std::unique_ptr<WebGestureCurve> curve, 47 std::unique_ptr<WebGestureCurve> curve,
56 WebGestureCurveTarget* target, 48 WebGestureCurveTarget* target,
57 double start_time, 49 double start_time)
58 bool waiting_for_first_tick) 50 : start_time_(start_time), curve_(std::move(curve)), target_(target) {}
59 : start_time_(start_time),
60 waiting_for_first_tick_(waiting_for_first_tick),
61 curve_(std::move(curve)),
62 target_(target) {}
63 51
64 bool WebActiveGestureAnimation::Animate(double time) { 52 bool WebActiveGestureAnimation::Animate(double time) {
65 if (waiting_for_first_tick_) {
66 start_time_ = time;
67 waiting_for_first_tick_ = false;
68 }
69 // All WebGestureCurves assume zero-based time, so we subtract 53 // All WebGestureCurves assume zero-based time, so we subtract
70 // the animation start time before passing to the curve. 54 // the animation start time before passing to the curve.
71 return curve_->Apply(time - start_time_, target_); 55 return curve_->Apply(time - start_time_, target_);
72 } 56 }
73 57
74 } // namespace blink 58 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/exported/WebActiveGestureAnimation.h ('k') | third_party/WebKit/Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698