Bug 895904 - Hook up NativePanZoomController.abortAnimation(). r=kats

This commit is contained in:
Botond Ballo 2013-07-23 16:41:22 -04:00
parent 6f045b9402
commit f79359461b
5 changed files with 37 additions and 12 deletions

View File

@ -815,6 +815,7 @@ bool AsyncPanZoomController::DoFling(const TimeDuration& aDelta) {
}
void AsyncPanZoomController::CancelAnimation() {
MonitorAutoLock monitor(mMonitor);
mState = NOTHING;
}

View File

@ -259,6 +259,13 @@ public:
*/
void UpdateScrollOffset(CSSPoint aScrollOffset);
/**
* Cancels any currently running animation. Note that all this does is set the
* state of the AsyncPanZoomController back to NOTHING, but it is the
* animation's responsibility to check this before advancing.
*/
void CancelAnimation();
protected:
/**
* Helper method for touches beginning. Sets everything up for panning and any
@ -358,15 +365,6 @@ protected:
*/
void ScheduleComposite();
/**
* Cancels any currently running animation. Note that all this does is set the
* state of the AsyncPanZoomController back to NOTHING, but it is the
* animation's responsibility to check this before advancing.
*
* *** The monitor must be held while calling this.
*/
void CancelAnimation();
/**
* Gets the displacement of the current touch since it began. That is, it is
* the distance between the current position and the initial position of the

View File

@ -69,9 +69,7 @@ class NativePanZoomController implements PanZoomController, GeckoEventListener {
// no-op in APZC, I think
}
public void abortAnimation() {
// no-op in APZC, I think
}
public native void abortAnimation();
private native void init();
private native void handleTouchEvent(GeckoEvent event);

View File

@ -324,6 +324,25 @@ Java_org_mozilla_gecko_GeckoJavaSampler_getProfilerTime(JNIEnv * arg0, jclass ar
#ifdef JNI_STUBS
typedef void (*Java_org_mozilla_gecko_gfx_NativePanZoomController_abortAnimation_t)(JNIEnv *, jobject);
static Java_org_mozilla_gecko_gfx_NativePanZoomController_abortAnimation_t f_Java_org_mozilla_gecko_gfx_NativePanZoomController_abortAnimation;
extern "C" NS_EXPORT void JNICALL
Java_org_mozilla_gecko_gfx_NativePanZoomController_abortAnimation(JNIEnv * arg0, jobject arg1) {
if (!f_Java_org_mozilla_gecko_gfx_NativePanZoomController_abortAnimation) {
arg0->ThrowNew(arg0->FindClass("java/lang/UnsupportedOperationException"),
"JNI Function called before it was loaded");
return ;
}
f_Java_org_mozilla_gecko_gfx_NativePanZoomController_abortAnimation(arg0, arg1);
}
#endif
#ifdef JNI_BINDINGS
xul_dlsym("Java_org_mozilla_gecko_gfx_NativePanZoomController_abortAnimation", &f_Java_org_mozilla_gecko_gfx_NativePanZoomController_abortAnimation);
#endif
#ifdef JNI_STUBS
typedef void (*Java_org_mozilla_gecko_gfx_NativePanZoomController_init_t)(JNIEnv *, jobject);
static Java_org_mozilla_gecko_gfx_NativePanZoomController_init_t f_Java_org_mozilla_gecko_gfx_NativePanZoomController_init;
extern "C" NS_EXPORT void JNICALL

View File

@ -831,6 +831,15 @@ Java_org_mozilla_gecko_GeckoJavaSampler_getProfilerTime(JNIEnv *jenv, jclass jc)
return profiler_time();
}
NS_EXPORT void JNICALL
Java_org_mozilla_gecko_gfx_NativePanZoomController_abortAnimation(JNIEnv* env, jobject instance)
{
AsyncPanZoomController* controller = nsWindow::GetPanZoomController();
if (controller) {
controller->CancelAnimation();
}
}
NS_EXPORT void JNICALL
Java_org_mozilla_gecko_gfx_NativePanZoomController_init(JNIEnv* env, jobject instance)
{