mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 721080 - Pages with touch event listeners that don't call preventDefault should not hold up panning. r=dougt
This commit is contained in:
parent
f59e6258a1
commit
16c435842a
@ -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) { }
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user