mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
libservo|compositor: Have scroll offset directionality match that of WebRender and the web (#37752)
Previously, our Servo-specific spatial tree scroll offsets were opposite to that of WebRender and also the web platform. This is due to the fact, likely, that `winit` wheel directionality is also flipped. This change has both the Servo spatial tree and the API take offsets that are consistent with the web. Any possible changes to the meaning of wheel directionality will be handled in a followup change. This is a breaking change to the Servo API. Testing: This change updates unit tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
d33d057763
commit
89bfa26f00
14 changed files with 54 additions and 132 deletions
|
@ -41,12 +41,8 @@ public class JNIServo {
|
|||
|
||||
public native void loadUri(String uri);
|
||||
|
||||
public native void scrollStart(int dx, int dy, int x, int y);
|
||||
|
||||
public native void scroll(int dx, int dy, int x, int y);
|
||||
|
||||
public native void scrollEnd(int dx, int dy, int x, int y);
|
||||
|
||||
public native void touchDown(float x, float y, int pointer_id);
|
||||
|
||||
public native void touchMove(float x, float y, int pointer_id);
|
||||
|
|
|
@ -107,18 +107,10 @@ public class Servo {
|
|||
mRunCallback.inGLThread(() -> mJNI.loadUri(uri));
|
||||
}
|
||||
|
||||
public void scrollStart(int dx, int dy, int x, int y) {
|
||||
mRunCallback.inGLThread(() -> mJNI.scrollStart(dx, dy, x, y));
|
||||
}
|
||||
|
||||
public void scroll(int dx, int dy, int x, int y) {
|
||||
mRunCallback.inGLThread(() -> mJNI.scroll(dx, dy, x, y));
|
||||
}
|
||||
|
||||
public void scrollEnd(int dx, int dy, int x, int y) {
|
||||
mRunCallback.inGLThread(() -> mJNI.scrollEnd(dx, dy, x, y));
|
||||
}
|
||||
|
||||
public void touchDown(float x, float y, int pointerId) {
|
||||
mRunCallback.inGLThread(() -> mJNI.touchDown(x, y, pointerId));
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ public class ServoView extends SurfaceView
|
|||
|
||||
if (mFlinging && mScroller.isFinished()) {
|
||||
mFlinging = false;
|
||||
mServo.scrollEnd(0, 0, mCurX, mCurY);
|
||||
mServo.scroll(0, 0, -mCurX, -mCurY);
|
||||
}
|
||||
|
||||
if (mFlinging) {
|
||||
|
@ -172,7 +172,7 @@ public class ServoView extends SurfaceView
|
|||
int x = Math.min(mCurX, this.getHeight());
|
||||
int y = Math.min(mCurY, this.getWidth());
|
||||
|
||||
mServo.scroll(dx, dy, x, y);
|
||||
mServo.scroll(-dx, -dy, x, y);
|
||||
}
|
||||
|
||||
if (zoomNecessary) {
|
||||
|
@ -229,18 +229,10 @@ public class ServoView extends SurfaceView
|
|||
}
|
||||
}
|
||||
|
||||
public void scrollStart(int dx, int dy, int x, int y) {
|
||||
mServo.scrollStart(dx, dy, x, y);
|
||||
}
|
||||
|
||||
public void scroll(int dx, int dy, int x, int y) {
|
||||
mServo.scroll(dx, dy, x, y);
|
||||
}
|
||||
|
||||
public void scrollEnd(int dx, int dy, int x, int y) {
|
||||
mServo.scrollEnd(dx, dy, x, y);
|
||||
}
|
||||
|
||||
public void click(float x, float y) {
|
||||
mServo.click(x, y);
|
||||
}
|
||||
|
@ -257,7 +249,7 @@ public class ServoView extends SurfaceView
|
|||
mCurY = velocityY < 0 ? mPageHeight : 0;
|
||||
mLastY = mCurY;
|
||||
mScroller.fling(mCurX, mCurY, (int) velocityX, (int) velocityY, 0, mPageWidth, 0, mPageHeight);
|
||||
mServo.scrollStart(0, 0, mCurX, mCurY);
|
||||
mServo.scroll(0, 0, mCurX, mCurY);
|
||||
startLooping();
|
||||
return true;
|
||||
}
|
||||
|
@ -309,7 +301,7 @@ public class ServoView extends SurfaceView
|
|||
}
|
||||
|
||||
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
|
||||
mServo.scroll((int) -distanceX, (int) -distanceY, (int) e2.getX(), (int) e2.getY());
|
||||
mServo.scroll((int) distanceX, (int) distanceY, (int) e2.getX(), (int) e2.getY());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue