Bug 721080 - Pages with touch event listeners that don't call preventDefault should not hold up panning. r=dougt

This commit is contained in:
Wes Johnston 2012-02-01 15:01:47 -08:00
parent e1e013efb8
commit 88926ea8a3
6 changed files with 20 additions and 17 deletions

View File

@ -1792,5 +1792,5 @@ public class GeckoAppShell
}
// This is only used in Native Fennec.
public static void preventPanning() { }
public static void setPreventPanning(final boolean aPreventPanning) { }
}

View File

@ -1121,11 +1121,11 @@ public class GeckoAppShell
});
}
public static void preventPanning() {
public static void setPreventPanning(final boolean aPreventPanning) {
getMainHandler().post(new Runnable() {
public void run() {
LayerController layerController = GeckoApp.mAppContext.getLayerController();
layerController.preventPanning(true);
layerController.preventPanning(aPreventPanning);
}
});
}

View File

@ -441,13 +441,15 @@ public class LayerController {
allowDefaultTimer.purge();
allowDefaultTimer = null;
}
allowDefaultActions = !aValue;
if (aValue) {
mView.clearEventQueue();
mPanZoomController.cancelTouch();
} else {
mView.processEventQueue();
if (aValue == allowDefaultActions) {
allowDefaultActions = !aValue;
if (aValue) {
mView.clearEventQueue();
mPanZoomController.cancelTouch();
} else {
mView.processEventQueue();
}
}
}

View File

@ -125,7 +125,7 @@ AndroidBridge::Init(JNIEnv *jEnv,
jGetDpi = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getDpi", "()I");
jSetFullScreen = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "setFullScreen", "(Z)V");
jShowInputMethodPicker = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "showInputMethodPicker", "()V");
jPreventPanning = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "preventPanning", "()V");
jSetPreventPanning = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "setPreventPanning", "(Z)V");
jHideProgressDialog = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "hideProgressDialog", "()V");
jPerformHapticFeedback = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "performHapticFeedback", "(Z)V");
jVibrate1 = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "vibrate", "(J)V");
@ -1806,13 +1806,13 @@ NS_IMETHODIMP nsAndroidBridge::SetDrawMetadataProvider(nsIAndroidDrawMetadataPro
}
void
AndroidBridge::PreventPanning() {
AndroidBridge::SetPreventPanning(bool aPreventPanning) {
ALOG_BRIDGE("AndroidBridge::PreventPanning");
JNIEnv *env = GetJNIEnv();
if (!env)
return;
env->CallStaticVoidMethod(mGeckoAppShellClass, jPreventPanning);
env->CallStaticVoidMethod(mGeckoAppShellClass, jSetPreventPanning, (jboolean)aPreventPanning);
}

View File

@ -230,7 +230,7 @@ public:
void ShowInputMethodPicker();
void PreventPanning();
void SetPreventPanning(bool aPreventPanning);
void HideProgressDialogOnce();
@ -439,7 +439,7 @@ protected:
jmethodID jGetDpi;
jmethodID jSetFullScreen;
jmethodID jShowInputMethodPicker;
jmethodID jPreventPanning;
jmethodID jSetPreventPanning;
jmethodID jHideProgressDialog;
jmethodID jPerformHapticFeedback;
jmethodID jVibrate1;

View File

@ -1579,8 +1579,9 @@ nsWindow::DispatchMultitouchEvent(nsTouchEvent &event, AndroidGeckoEvent *ae)
nsEventStatus status;
DispatchEvent(&event, status);
if (status == nsEventStatus_eConsumeNoDefault) {
AndroidBridge::Bridge()->PreventPanning();
bool preventPanning = (status == nsEventStatus_eConsumeNoDefault);
if (preventPanning || action == AndroidMotionEvent::ACTION_MOVE) {
AndroidBridge::Bridge()->SetPreventPanning(preventPanning);
return true;
}
return false;