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 @@ ...@@ -8,6 +8,7 @@
#include "base/android/scoped_java_ref.h" #include "base/android/scoped_java_ref.h"
#include "base/logging.h" #include "base/logging.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebGestureCurveTarget.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" #include "ui/gfx/vector2d.h"
using base::android::AttachCurrentThread; using base::android::AttachCurrentThread;
...@@ -48,29 +49,28 @@ FlingAnimatorImpl::~FlingAnimatorImpl() ...@@ -48,29 +49,28 @@ FlingAnimatorImpl::~FlingAnimatorImpl()
{ {
} }
void FlingAnimatorImpl::startFling(const WebKit::WebFloatPoint& velocity, void FlingAnimatorImpl::StartFling(const gfx::PointF& velocity)
const WebKit::WebRect& /* range */)
{ {
// 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 // 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. // 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_) if (is_active_)
cancelFling(); CancelFling();
is_active_ = true; is_active_ = true;
JNIEnv* env = AttachCurrentThread(); JNIEnv* env = AttachCurrentThread();
env->CallVoidMethod(java_scroller_.obj(), fling_method_id_, 0, 0, env->CallVoidMethod(java_scroller_.obj(), fling_method_id_, 0, 0,
static_cast<int>(velocity.x), static_cast<int>(velocity.x()),
static_cast<int>(velocity.y), static_cast<int>(velocity.y()),
INT_MIN, INT_MAX, INT_MIN, INT_MAX); INT_MIN, INT_MAX, INT_MIN, INT_MAX);
CheckException(env); CheckException(env);
} }
void FlingAnimatorImpl::cancelFling() void FlingAnimatorImpl::CancelFling()
{ {
if (!is_active_) if (!is_active_)
return; return;
...@@ -81,7 +81,7 @@ void FlingAnimatorImpl::cancelFling() ...@@ -81,7 +81,7 @@ void FlingAnimatorImpl::cancelFling()
CheckException(env); CheckException(env);
} }
bool FlingAnimatorImpl::updatePosition() bool FlingAnimatorImpl::UpdatePosition()
{ {
JNIEnv* env = AttachCurrentThread(); JNIEnv* env = AttachCurrentThread();
bool result = env->CallBooleanMethod(java_scroller_.obj(), bool result = env->CallBooleanMethod(java_scroller_.obj(),
...@@ -90,10 +90,10 @@ bool FlingAnimatorImpl::updatePosition() ...@@ -90,10 +90,10 @@ bool FlingAnimatorImpl::updatePosition()
return is_active_ = result; return is_active_ = result;
} }
WebKit::WebPoint FlingAnimatorImpl::getCurrentPosition() gfx::Point FlingAnimatorImpl::GetCurrentPosition()
{ {
JNIEnv* env = AttachCurrentThread(); JNIEnv* env = AttachCurrentThread();
WebKit::WebPoint position( gfx::Point position(
env->CallIntMethod(java_scroller_.obj(), getX_method_id_), env->CallIntMethod(java_scroller_.obj(), getX_method_id_),
env->CallIntMethod(java_scroller_.obj(), getY_method_id_)); env->CallIntMethod(java_scroller_.obj(), getY_method_id_));
CheckException(env); CheckException(env);
...@@ -102,10 +102,10 @@ WebKit::WebPoint FlingAnimatorImpl::getCurrentPosition() ...@@ -102,10 +102,10 @@ WebKit::WebPoint FlingAnimatorImpl::getCurrentPosition()
bool FlingAnimatorImpl::apply(double time, bool FlingAnimatorImpl::apply(double time,
WebKit::WebGestureCurveTarget* target) { WebKit::WebGestureCurveTarget* target) {
if (!updatePosition()) if (!UpdatePosition())
return false; return false;
gfx::Point current_position = getCurrentPosition(); gfx::Point current_position = GetCurrentPosition();
gfx::Vector2d diff(current_position - last_position_); gfx::Vector2d diff(current_position - last_position_);
WebKit::WebPoint scroll_amount(diff.x(), diff.y()); WebKit::WebPoint scroll_amount(diff.x(), diff.y());
target->scrollBy(scroll_amount); target->scrollBy(scroll_amount);
...@@ -117,7 +117,7 @@ FlingAnimatorImpl* FlingAnimatorImpl::CreateAndroidGestureCurve( ...@@ -117,7 +117,7 @@ FlingAnimatorImpl* FlingAnimatorImpl::CreateAndroidGestureCurve(
const WebKit::WebFloatPoint& velocity, const WebKit::WebFloatPoint& velocity,
const WebKit::WebSize&) { const WebKit::WebSize&) {
FlingAnimatorImpl* gesture_curve = new FlingAnimatorImpl(); FlingAnimatorImpl* gesture_curve = new FlingAnimatorImpl();
gesture_curve->startFling(velocity, WebKit::WebRect()); gesture_curve->StartFling(velocity);
return gesture_curve; return gesture_curve;
} }
......
...@@ -6,13 +6,11 @@ ...@@ -6,13 +6,11 @@
#define WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_ #define WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_
#include "base/android/scoped_java_ref.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/WebFloatPoint.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebGestureCurve.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 "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
#include "ui/gfx/point.h" #include "ui/gfx/point.h"
#include "ui/gfx/point_f.h"
namespace WebKit { namespace WebKit {
class WebGestureCurveTarget; class WebGestureCurveTarget;
...@@ -20,10 +18,7 @@ class WebGestureCurveTarget; ...@@ -20,10 +18,7 @@ class WebGestureCurveTarget;
namespace webkit_glue { namespace webkit_glue {
// TODO(rjkroege): Remove WebFlingAnimator once all of the gesture curve class FlingAnimatorImpl : public WebKit::WebGestureCurve {
// implementation has moved to Chromium.
class FlingAnimatorImpl : public WebKit::WebFlingAnimator,
public WebKit::WebGestureCurve {
public: public:
FlingAnimatorImpl(); FlingAnimatorImpl();
virtual ~FlingAnimatorImpl(); virtual ~FlingAnimatorImpl();
...@@ -32,18 +27,15 @@ class FlingAnimatorImpl : public WebKit::WebFlingAnimator, ...@@ -32,18 +27,15 @@ class FlingAnimatorImpl : public WebKit::WebFlingAnimator,
const WebKit::WebFloatPoint& velocity, const WebKit::WebFloatPoint& velocity,
const WebKit::WebSize&); 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, virtual bool apply(double time,
WebKit::WebGestureCurveTarget* target); WebKit::WebGestureCurveTarget* target);
private: 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_; bool is_active_;
// Java OverScroller instance and methods. // Java OverScroller instance and methods.
......
...@@ -862,12 +862,6 @@ void WebKitPlatformSupportImpl::didStopWorkerRunLoop( ...@@ -862,12 +862,6 @@ void WebKitPlatformSupportImpl::didStopWorkerRunLoop(
worker_task_runner->OnWorkerRunLoopStopped(runLoop); worker_task_runner->OnWorkerRunLoopStopped(runLoop);
} }
#if defined(OS_ANDROID)
WebKit::WebFlingAnimator* WebKitPlatformSupportImpl::createFlingAnimator() {
return new FlingAnimatorImpl();
}
#endif
WebKit::WebGestureCurve* WebKitPlatformSupportImpl::createFlingAnimationCurve( WebKit::WebGestureCurve* WebKitPlatformSupportImpl::createFlingAnimationCurve(
int device_source, int device_source,
const WebKit::WebFloatPoint& velocity, const WebKit::WebFloatPoint& velocity,
......
...@@ -32,7 +32,6 @@ struct WebPluginInfo; ...@@ -32,7 +32,6 @@ struct WebPluginInfo;
} }
namespace WebKit { namespace WebKit {
class WebFlingAnimator;
class WebSocketStreamHandle; class WebSocketStreamHandle;
} }
...@@ -154,10 +153,6 @@ class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl : ...@@ -154,10 +153,6 @@ class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl :
virtual void didStopWorkerRunLoop( virtual void didStopWorkerRunLoop(
const WebKit::WebWorkerRunLoop& runLoop) OVERRIDE; const WebKit::WebWorkerRunLoop& runLoop) OVERRIDE;
#if defined(OS_ANDROID)
virtual WebKit::WebFlingAnimator* createFlingAnimator();
#endif
virtual WebKit::WebGestureCurve* createFlingAnimationCurve( virtual WebKit::WebGestureCurve* createFlingAnimationCurve(
int device_source, int device_source,
const WebKit::WebFloatPoint& velocity, 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