Commit e9798ce0 authored by rjkroege@chromium.org's avatar rjkroege@chromium.org

Removed reference to unnecessary WebFlingAnimator.

BUG=157656


Review URL: https://chromiumcodereview.appspot.com/11280255

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170857 0039d316-1c4b-4281-b951-d872f2087c98
parent 0c13eda2
......@@ -8,6 +8,7 @@
#include "base/android/scoped_java_ref.h"
#include "base/logging.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebGestureCurveTarget.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebPoint.h"
#include "ui/gfx/vector2d.h"
using base::android::AttachCurrentThread;
......@@ -48,29 +49,28 @@ FlingAnimatorImpl::~FlingAnimatorImpl()
{
}
void FlingAnimatorImpl::startFling(const WebKit::WebFloatPoint& velocity,
const WebKit::WebRect& /* range */)
void FlingAnimatorImpl::StartFling(const gfx::PointF& velocity)
{
// Ignore "range" as it's always empty -- see http://webkit.org/b/96403
// No bounds on the fling. See http://webkit.org/b/96403
// Instead, use the largest possible bounds for minX/maxX/minY/maxY. The
// compositor will ignore any attempt to scroll beyond the end of the page.
DCHECK(velocity.x || velocity.y);
DCHECK(velocity.x() || velocity.y());
if (is_active_)
cancelFling();
CancelFling();
is_active_ = true;
JNIEnv* env = AttachCurrentThread();
env->CallVoidMethod(java_scroller_.obj(), fling_method_id_, 0, 0,
static_cast<int>(velocity.x),
static_cast<int>(velocity.y),
static_cast<int>(velocity.x()),
static_cast<int>(velocity.y()),
INT_MIN, INT_MAX, INT_MIN, INT_MAX);
CheckException(env);
}
void FlingAnimatorImpl::cancelFling()
void FlingAnimatorImpl::CancelFling()
{
if (!is_active_)
return;
......@@ -81,7 +81,7 @@ void FlingAnimatorImpl::cancelFling()
CheckException(env);
}
bool FlingAnimatorImpl::updatePosition()
bool FlingAnimatorImpl::UpdatePosition()
{
JNIEnv* env = AttachCurrentThread();
bool result = env->CallBooleanMethod(java_scroller_.obj(),
......@@ -90,10 +90,10 @@ bool FlingAnimatorImpl::updatePosition()
return is_active_ = result;
}
WebKit::WebPoint FlingAnimatorImpl::getCurrentPosition()
gfx::Point FlingAnimatorImpl::GetCurrentPosition()
{
JNIEnv* env = AttachCurrentThread();
WebKit::WebPoint position(
gfx::Point position(
env->CallIntMethod(java_scroller_.obj(), getX_method_id_),
env->CallIntMethod(java_scroller_.obj(), getY_method_id_));
CheckException(env);
......@@ -102,10 +102,10 @@ WebKit::WebPoint FlingAnimatorImpl::getCurrentPosition()
bool FlingAnimatorImpl::apply(double time,
WebKit::WebGestureCurveTarget* target) {
if (!updatePosition())
if (!UpdatePosition())
return false;
gfx::Point current_position = getCurrentPosition();
gfx::Point current_position = GetCurrentPosition();
gfx::Vector2d diff(current_position - last_position_);
WebKit::WebPoint scroll_amount(diff.x(), diff.y());
target->scrollBy(scroll_amount);
......@@ -117,7 +117,7 @@ FlingAnimatorImpl* FlingAnimatorImpl::CreateAndroidGestureCurve(
const WebKit::WebFloatPoint& velocity,
const WebKit::WebSize&) {
FlingAnimatorImpl* gesture_curve = new FlingAnimatorImpl();
gesture_curve->startFling(velocity, WebKit::WebRect());
gesture_curve->StartFling(velocity);
return gesture_curve;
}
......
......@@ -6,13 +6,11 @@
#define WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_
#include "base/android/scoped_java_ref.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebFlingAnimator.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebGestureCurve.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebPoint.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
#include "ui/gfx/point.h"
#include "ui/gfx/point_f.h"
namespace WebKit {
class WebGestureCurveTarget;
......@@ -20,10 +18,7 @@ class WebGestureCurveTarget;
namespace webkit_glue {
// TODO(rjkroege): Remove WebFlingAnimator once all of the gesture curve
// implementation has moved to Chromium.
class FlingAnimatorImpl : public WebKit::WebFlingAnimator,
public WebKit::WebGestureCurve {
class FlingAnimatorImpl : public WebKit::WebGestureCurve {
public:
FlingAnimatorImpl();
virtual ~FlingAnimatorImpl();
......@@ -32,18 +27,15 @@ class FlingAnimatorImpl : public WebKit::WebFlingAnimator,
const WebKit::WebFloatPoint& velocity,
const WebKit::WebSize&);
// WebKit::WebFlingAnimator methods.
virtual void startFling(const WebKit::WebFloatPoint& velocity,
const WebKit::WebRect& range);
// Returns true if the animation is not yet finished.
virtual bool updatePosition();
virtual WebKit::WebPoint getCurrentPosition();
virtual void cancelFling();
// WebKit::WebGestureCurve methods.
virtual bool apply(double time,
WebKit::WebGestureCurveTarget* target);
private:
void StartFling(const gfx::PointF& velocity);
// Returns true if the animation is not yet finished.
bool UpdatePosition();
gfx::Point GetCurrentPosition();
virtual void CancelFling();
bool is_active_;
// Java OverScroller instance and methods.
......
......@@ -862,12 +862,6 @@ void WebKitPlatformSupportImpl::didStopWorkerRunLoop(
worker_task_runner->OnWorkerRunLoopStopped(runLoop);
}
#if defined(OS_ANDROID)
WebKit::WebFlingAnimator* WebKitPlatformSupportImpl::createFlingAnimator() {
return new FlingAnimatorImpl();
}
#endif
WebKit::WebGestureCurve* WebKitPlatformSupportImpl::createFlingAnimationCurve(
int device_source,
const WebKit::WebFloatPoint& velocity,
......
......@@ -32,7 +32,6 @@ struct WebPluginInfo;
}
namespace WebKit {
class WebFlingAnimator;
class WebSocketStreamHandle;
}
......@@ -154,10 +153,6 @@ class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl :
virtual void didStopWorkerRunLoop(
const WebKit::WebWorkerRunLoop& runLoop) OVERRIDE;
#if defined(OS_ANDROID)
virtual WebKit::WebFlingAnimator* createFlingAnimator();
#endif
virtual WebKit::WebGestureCurve* createFlingAnimationCurve(
int device_source,
const WebKit::WebFloatPoint& velocity,
......
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