mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1230674 - part 1, Add Overscroll API to NativePanZoomController r=snorp
This commit is contained in:
parent
b90d863836
commit
3f96948842
@ -9,6 +9,7 @@ import org.mozilla.gecko.GeckoEvent;
|
||||
import org.mozilla.gecko.GeckoThread;
|
||||
import org.mozilla.gecko.annotation.WrapForJNI;
|
||||
import org.mozilla.gecko.mozglue.JNIObject;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
@ -21,6 +22,7 @@ class NativePanZoomController extends JNIObject implements PanZoomController {
|
||||
private final PanZoomTarget mTarget;
|
||||
private final LayerView mView;
|
||||
private boolean mDestroyed;
|
||||
private Overscroll mOverscroll;
|
||||
|
||||
@WrapForJNI
|
||||
private native boolean handleMotionEvent(
|
||||
@ -168,7 +170,8 @@ class NativePanZoomController extends JNIObject implements PanZoomController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOverscrollHandler(final Overscroll listener) {
|
||||
public void setOverscrollHandler(final Overscroll handler) {
|
||||
mOverscroll = handler;
|
||||
}
|
||||
|
||||
@WrapForJNI(stubName = "SetIsLongpressEnabled")
|
||||
@ -180,4 +183,41 @@ class NativePanZoomController extends JNIObject implements PanZoomController {
|
||||
nativeSetIsLongpressEnabled(isLongpressEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
@WrapForJNI(allowMultithread = true)
|
||||
private void updateOverscrollVelocity(final float x, final float y) {
|
||||
if (mOverscroll != null) {
|
||||
if (ThreadUtils.isOnUiThread() == true) {
|
||||
mOverscroll.setVelocity(x * 1000.0f, Overscroll.Axis.X);
|
||||
mOverscroll.setVelocity(y * 1000.0f, Overscroll.Axis.Y);
|
||||
} else {
|
||||
ThreadUtils.postToUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Multiply the velocity by 1000 to match what was done in JPZ.
|
||||
mOverscroll.setVelocity(x * 1000.0f, Overscroll.Axis.X);
|
||||
mOverscroll.setVelocity(y * 1000.0f, Overscroll.Axis.Y);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@WrapForJNI(allowMultithread = true)
|
||||
private void updateOverscrollOffset(final float x, final float y) {
|
||||
if (mOverscroll != null) {
|
||||
if (ThreadUtils.isOnUiThread() == true) {
|
||||
mOverscroll.setDistance(x, Overscroll.Axis.X);
|
||||
mOverscroll.setDistance(y, Overscroll.Axis.Y);
|
||||
} else {
|
||||
ThreadUtils.postToUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mOverscroll.setDistance(x, Overscroll.Axis.X);
|
||||
mOverscroll.setDistance(y, Overscroll.Axis.Y);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1470,6 +1470,22 @@ auto NativePanZoomController::RequestContentRepaintWrapper(float a0, float a1, f
|
||||
return mozilla::jni::Method<RequestContentRepaintWrapper_t>::Call(this, nullptr, a0, a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
constexpr char NativePanZoomController::UpdateOverscrollOffset_t::name[];
|
||||
constexpr char NativePanZoomController::UpdateOverscrollOffset_t::signature[];
|
||||
|
||||
auto NativePanZoomController::UpdateOverscrollOffset(float a0, float a1) const -> void
|
||||
{
|
||||
return mozilla::jni::Method<UpdateOverscrollOffset_t>::Call(this, nullptr, a0, a1);
|
||||
}
|
||||
|
||||
constexpr char NativePanZoomController::UpdateOverscrollVelocity_t::name[];
|
||||
constexpr char NativePanZoomController::UpdateOverscrollVelocity_t::signature[];
|
||||
|
||||
auto NativePanZoomController::UpdateOverscrollVelocity(float a0, float a1) const -> void
|
||||
{
|
||||
return mozilla::jni::Method<UpdateOverscrollVelocity_t>::Call(this, nullptr, a0, a1);
|
||||
}
|
||||
|
||||
constexpr char ProgressiveUpdateData::name[];
|
||||
|
||||
constexpr char ProgressiveUpdateData::New_t::name[];
|
||||
|
@ -4092,6 +4092,44 @@ public:
|
||||
|
||||
auto RequestContentRepaintWrapper(float, float, float, float, float) const -> void;
|
||||
|
||||
public:
|
||||
struct UpdateOverscrollOffset_t {
|
||||
typedef NativePanZoomController Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
float,
|
||||
float> Args;
|
||||
static constexpr char name[] = "updateOverscrollOffset";
|
||||
static constexpr char signature[] =
|
||||
"(FF)V";
|
||||
static const bool isStatic = false;
|
||||
static const bool isMultithreaded = true;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
auto UpdateOverscrollOffset(float, float) const -> void;
|
||||
|
||||
public:
|
||||
struct UpdateOverscrollVelocity_t {
|
||||
typedef NativePanZoomController Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
float,
|
||||
float> Args;
|
||||
static constexpr char name[] = "updateOverscrollVelocity";
|
||||
static constexpr char signature[] =
|
||||
"(FF)V";
|
||||
static const bool isStatic = false;
|
||||
static const bool isMultithreaded = true;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
auto UpdateOverscrollVelocity(float, float) const -> void;
|
||||
|
||||
public:
|
||||
template<class Impl> class Natives;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user