Dismiss autofill popup on screen orientation change.
[chromium-blink-merge.git] / webkit / support / web_gesture_curve_mock.cc
bloba3b49176a7f92b936a1043fc819835ae762999e1
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
3 // found in the LICENSE file.
5 #include "webkit/support/web_gesture_curve_mock.h"
7 #include "third_party/WebKit/public/platform/WebFloatSize.h"
8 #include "third_party/WebKit/public/platform/WebGestureCurveTarget.h"
9 #include "webkit/support/weburl_loader_mock_factory.h"
11 WebGestureCurveMock::WebGestureCurveMock(const WebKit::WebFloatPoint& velocity,
12 const WebKit::WebSize& cumulative_scroll)
13 : velocity_(velocity),
14 cumulative_scroll_(cumulative_scroll) {
17 WebGestureCurveMock::~WebGestureCurveMock() {
20 bool WebGestureCurveMock::apply(double time,
21 WebKit::WebGestureCurveTarget* target) {
22 WebKit::WebSize displacement(velocity_.x * time, velocity_.y * time);
23 WebKit::WebFloatSize increment(displacement.width - cumulative_scroll_.width,
24 displacement.height - cumulative_scroll_.height);
25 cumulative_scroll_ = displacement;
26 target->notifyCurrentFlingVelocity(WebKit::WebFloatSize(velocity_.x,
27 velocity_.y));
28 // scrollBy() could delete this curve if the animation is over, so don't
29 // touch any member variables after making that call.
30 target->scrollBy(increment);
31 return true;