Commit 0c284454 authored by pkasting's avatar pkasting Committed by Commit Bot

Revert of Remove a frame of delay on main-thread FlingStart. (patchset #1 id:1...

Revert of Remove a frame of delay on main-thread FlingStart. (patchset #1 id:1 of https://codereview.chromium.org/2908073008/ )

Reason for revert:
Possible cause of flakiness in fast/events/touch/gesture/pad-gesture-fling.html ; see e.g. https://luci-milo.appspot.com/buildbot/chromium.webkit/WebKit%20Mac10.11%20%28dbg%29/8992 .

Original issue's description:
> Remove a frame of delay on main-thread FlingStart.
>
> Main-thread flings were waiting for the first frame of animation to
> populate the start timestamp, and only on the second frame would they
> start animating.  But the start timestamp is included in the FlingStart
> event, so there's no need for this (perhaps it was written that way for
> historical reasons when the event timestamp wasn't populated properly).
>
> This problem was extremely noticeable in prototype of middle-click autoscroll
> that issues a FlingStart on every MouseMove to change velocity, but
> the fix should also benefit touchscreen and touchpad flings slightly.
>
> BUG=727964
>
> Review-Url: https://codereview.chromium.org/2908073008
> Cr-Commit-Position: refs/heads/master@{#475984}
> Committed: https://chromium.googlesource.com/chromium/src/+/3562f1b7410b884e07bbd2fc75cfee7e96ed2a41

TBR=jbroman@chromium.org,dtapuska@chromium.org,aelias@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=727964

Review-Url: https://codereview.chromium.org/2917823003
Cr-Commit-Position: refs/heads/master@{#476181}
parent 769ddd4b
......@@ -204,14 +204,12 @@ if ('ScrollState' in window) {
assert_equals(document.scrollingElement.scrollTop, scrollingElementTop, "For scrollingElement on step " + step);
};
assertScrollTops(0, 0, 0, 0);
var frame_actions = [
function() {
eventSender.gestureFlingStart(10, 10, -1000000, -1000000, "touchscreen");
},
flingTest.step_func(function() {
assertScrollTops(100, 0, 0, 1);
assertScrollTops(0, 0, 0, 1);
}),
flingTest.step_func(function() {
assertScrollTops(100, 0, 0, 2);
......
......@@ -32,13 +32,21 @@
namespace blink {
std::unique_ptr<WebActiveGestureAnimation>
WebActiveGestureAnimation::CreateAtAnimationStart(
std::unique_ptr<WebGestureCurve> curve,
WebGestureCurveTarget* target) {
return WTF::WrapUnique(
new WebActiveGestureAnimation(std::move(curve), target, 0, true));
}
std::unique_ptr<WebActiveGestureAnimation>
WebActiveGestureAnimation::CreateWithTimeOffset(
std::unique_ptr<WebGestureCurve> curve,
WebGestureCurveTarget* target,
double start_time) {
return WTF::WrapUnique(
new WebActiveGestureAnimation(std::move(curve), target, start_time));
return WTF::WrapUnique(new WebActiveGestureAnimation(std::move(curve), target,
start_time, false));
}
WebActiveGestureAnimation::~WebActiveGestureAnimation() {}
......@@ -46,10 +54,18 @@ WebActiveGestureAnimation::~WebActiveGestureAnimation() {}
WebActiveGestureAnimation::WebActiveGestureAnimation(
std::unique_ptr<WebGestureCurve> curve,
WebGestureCurveTarget* target,
double start_time)
: start_time_(start_time), curve_(std::move(curve)), target_(target) {}
double start_time,
bool waiting_for_first_tick)
: start_time_(start_time),
waiting_for_first_tick_(waiting_for_first_tick),
curve_(std::move(curve)),
target_(target) {}
bool WebActiveGestureAnimation::Animate(double time) {
if (waiting_for_first_tick_) {
start_time_ = time;
waiting_for_first_tick_ = false;
}
// All WebGestureCurves assume zero-based time, so we subtract
// the animation start time before passing to the curve.
return curve_->Apply(time - start_time_, target_);
......
......@@ -46,6 +46,9 @@ class PLATFORM_EXPORT WebActiveGestureAnimation {
WTF_MAKE_NONCOPYABLE(WebActiveGestureAnimation);
public:
static std::unique_ptr<WebActiveGestureAnimation> CreateAtAnimationStart(
std::unique_ptr<WebGestureCurve>,
WebGestureCurveTarget*);
static std::unique_ptr<WebActiveGestureAnimation> CreateWithTimeOffset(
std::unique_ptr<WebGestureCurve>,
WebGestureCurveTarget*,
......@@ -58,9 +61,11 @@ class PLATFORM_EXPORT WebActiveGestureAnimation {
// Assumes a valid WebGestureCurveTarget that outlives the animation.
WebActiveGestureAnimation(std::unique_ptr<WebGestureCurve>,
WebGestureCurveTarget*,
double start_time);
double start_time,
bool waiting_for_first_tick);
double start_time_;
bool waiting_for_first_tick_;
std::unique_ptr<WebGestureCurve> curve_;
WebGestureCurveTarget* target_;
};
......
......@@ -698,8 +698,8 @@ WebInputEventResult WebViewImpl::HandleGestureEvent(
event.data.fling_start.velocity_y),
WebSize());
DCHECK(fling_curve);
gesture_animation_ = WebActiveGestureAnimation::CreateWithTimeOffset(
std::move(fling_curve), this, event.TimeStampSeconds());
gesture_animation_ = WebActiveGestureAnimation::CreateAtAnimationStart(
std::move(fling_curve), this);
MainFrameImpl()->FrameWidget()->ScheduleAnimation();
event_result = WebInputEventResult::kHandledSystem;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment