Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cfa734a3 authored by Patrick Scott's avatar Patrick Scott
Browse files

Scroll layers on touch events.

Send the LayerAndroid unique id and the current scroll rect during motion up
events and all touch events.

Bug: 3442108
Change-Id: I09a18ded7b7ce15984f61a329b2666f7cfadd0dc
parent 2fad6162
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -5531,6 +5531,8 @@ public class WebView extends AbsoluteLayout
                        ted.mPoints[0] = new Point(contentX, contentY);
                        ted.mMetaState = ev.getMetaState();
                        ted.mReprocess = mDeferTouchProcess;
                        ted.mNativeLayer = nativeScrollableLayer(
                                contentX, contentY, ted.mNativeLayerRect, null);
                        mWebViewCore.sendMessage(EventHub.TOUCH_EVENT, ted);
                        if (mDeferTouchProcess) {
                            // still needs to set them for compute deltaX/Y
@@ -5575,6 +5577,8 @@ public class WebView extends AbsoluteLayout
                    ted.mPoints[0] = new Point(contentX, contentY);
                    ted.mMetaState = ev.getMetaState();
                    ted.mReprocess = mDeferTouchProcess;
                    ted.mNativeLayer = mScrollingLayer;
                    ted.mNativeLayerRect.set(mScrollingLayerRect);
                    mWebViewCore.sendMessage(EventHub.TOUCH_EVENT, ted);
                    mLastSentTouchTime = eventTime;
                    if (mDeferTouchProcess) {
@@ -5754,6 +5758,8 @@ public class WebView extends AbsoluteLayout
                    ted.mPoints[0] = new Point(contentX, contentY);
                    ted.mMetaState = ev.getMetaState();
                    ted.mReprocess = mDeferTouchProcess;
                    ted.mNativeLayer = mScrollingLayer;
                    ted.mNativeLayerRect.set(mScrollingLayerRect);
                    mWebViewCore.sendMessage(EventHub.TOUCH_EVENT, ted);
                }
                mLastTouchUpTime = eventTime;
@@ -5773,6 +5779,9 @@ public class WebView extends AbsoluteLayout
                            ted.mPoints[0] = new Point(contentX, contentY);
                            ted.mMetaState = ev.getMetaState();
                            ted.mReprocess = mDeferTouchProcess;
                            ted.mNativeLayer = nativeScrollableLayer(
                                    contentX, contentY,
                                    ted.mNativeLayerRect, null);
                            mWebViewCore.sendMessage(EventHub.TOUCH_EVENT, ted);
                        } else if (mPreventDefault != PREVENT_DEFAULT_YES){
                            mZoomManager.handleDoubleTap(mLastTouchX, mLastTouchY);
@@ -6004,6 +6013,8 @@ public class WebView extends AbsoluteLayout
            ted.mPoints = new Point[1];
            ted.mPoints[0] = new Point(x, y);
            ted.mAction = MotionEvent.ACTION_CANCEL;
            ted.mNativeLayer = nativeScrollableLayer(
                    x, y, ted.mNativeLayerRect, null);
            mWebViewCore.sendMessage(EventHub.TOUCH_EVENT, ted);
            mPreventDefault = PREVENT_DEFAULT_IGNORE;
        }
@@ -7161,6 +7172,9 @@ public class WebView extends AbsoluteLayout
                        // simplicity for now, we don't set it.
                        ted.mMetaState = 0;
                        ted.mReprocess = mDeferTouchProcess;
                        ted.mNativeLayer = nativeScrollableLayer(
                                ted.mPoints[0].x, ted.mPoints[0].y,
                                ted.mNativeLayerRect, null);
                        mWebViewCore.sendMessage(EventHub.TOUCH_EVENT, ted);
                    } else if (mPreventDefault != PREVENT_DEFAULT_YES) {
                        mTouchMode = TOUCH_DONE_MODE;
@@ -8033,6 +8047,8 @@ public class WebView extends AbsoluteLayout
        touchUpData.mNode = node;
        touchUpData.mX = x;
        touchUpData.mY = y;
        touchUpData.mNativeLayer = nativeScrollableLayer(
                x, y, touchUpData.mNativeLayerRect, null);
        mWebViewCore.sendMessage(EventHub.TOUCH_UP, touchUpData);
    }

+13 −0
Original line number Diff line number Diff line
@@ -778,6 +778,8 @@ final class WebViewCore {
        int mNode;
        int mX;
        int mY;
        int mNativeLayer;
        Rect mNativeLayerRect = new Rect();
    }

    static class TouchHighlightData {
@@ -821,6 +823,8 @@ final class WebViewCore {
        int mMetaState;
        boolean mReprocess;
        MotionEvent mMotionEvent;
        int mNativeLayer;
        Rect mNativeLayerRect = new Rect();
    }

    static class GeolocationPermissionsData {
@@ -1304,6 +1308,10 @@ final class WebViewCore {

                        case TOUCH_UP:
                            TouchUpData touchUpData = (TouchUpData) msg.obj;
                            if (touchUpData.mNativeLayer != 0) {
                                nativeScrollLayer(touchUpData.mNativeLayer,
                                        touchUpData.mNativeLayerRect);
                            }
                            nativeTouchUp(touchUpData.mMoveGeneration,
                                    touchUpData.mFrame, touchUpData.mNode,
                                    touchUpData.mX, touchUpData.mY);
@@ -1318,6 +1326,10 @@ final class WebViewCore {
                                xArray[c] = ted.mPoints[c].x;
                                yArray[c] = ted.mPoints[c].y;
                            }
                            if (ted.mNativeLayer != 0) {
                                nativeScrollLayer(ted.mNativeLayer,
                                        ted.mNativeLayerRect);
                            }
                            Message.obtain(
                                    mWebView.mPrivateHandler,
                                    WebView.PREVENT_TOUCH_ID,
@@ -2702,4 +2714,5 @@ final class WebViewCore {
            int slop);

   private native void nativeAutoFillForm(int queryId);
   private native void nativeScrollLayer(int layer, Rect rect);
}