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

Commit bfbb089c authored by Huahui Wu's avatar Huahui Wu Committed by Android (Google) Code Review
Browse files

Merge "b/3133123 Pass touch point ids to WebKit." into honeycomb

parents 402438bb e838a427
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1550,6 +1550,7 @@ public final class MotionEvent extends InputEvent implements Parcelable {
    @Override
    public String toString() {
        return "MotionEvent{" + Integer.toHexString(System.identityHashCode(this))
            + " pointerId=" + getPointerId(0)
            + " action=" + actionToString(mAction)
            + " x=" + getX()
            + " y=" + getY()
@@ -1567,6 +1568,8 @@ public final class MotionEvent extends InputEvent implements Parcelable {
            + " edgeFlags=0x" + Integer.toHexString(mEdgeFlags)
            + " device=" + mDeviceId
            + " source=0x" + Integer.toHexString(mSource)
            + (getPointerCount() > 1 ?
                " pointerId2=" + getPointerId(1) + " x2=" + getX(2) + " y2=" + getY(2) : "")
            + "}";
    }

+14 −0
Original line number Diff line number Diff line
@@ -5471,6 +5471,8 @@ public class WebView extends AbsoluteLayout
                    if (shouldForwardTouchEvent()) {
                        TouchEventData ted = new TouchEventData();
                        ted.mAction = action;
                        ted.mIds = new int[1];
                        ted.mIds[0] = ev.getPointerId(0);
                        ted.mPoints = new Point[1];
                        ted.mPoints[0] = new Point(contentX, contentY);
                        ted.mMetaState = ev.getMetaState();
@@ -5513,6 +5515,8 @@ public class WebView extends AbsoluteLayout
                        || eventTime - mLastSentTouchTime > mCurrentTouchInterval)) {
                    TouchEventData ted = new TouchEventData();
                    ted.mAction = action;
                    ted.mIds = new int[1];
                    ted.mIds[0] = ev.getPointerId(0);
                    ted.mPoints = new Point[1];
                    ted.mPoints[0] = new Point(contentX, contentY);
                    ted.mMetaState = ev.getMetaState();
@@ -5682,6 +5686,8 @@ public class WebView extends AbsoluteLayout
                // pass the touch events from UI thread to WebCore thread
                if (shouldForwardTouchEvent()) {
                    TouchEventData ted = new TouchEventData();
                    ted.mIds = new int[1];
                    ted.mIds[0] = ev.getPointerId(0);
                    ted.mAction = action;
                    ted.mPoints = new Point[1];
                    ted.mPoints[0] = new Point(contentX, contentY);
@@ -5699,6 +5705,8 @@ public class WebView extends AbsoluteLayout
                        mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS);
                        if (inFullScreenMode() || mDeferTouchProcess) {
                            TouchEventData ted = new TouchEventData();
                            ted.mIds = new int[1];
                            ted.mIds[0] = ev.getPointerId(0);
                            ted.mAction = WebViewCore.ACTION_DOUBLETAP;
                            ted.mPoints = new Point[1];
                            ted.mPoints[0] = new Point(contentX, contentY);
@@ -5832,8 +5840,10 @@ public class WebView extends AbsoluteLayout
        TouchEventData ted = new TouchEventData();
        ted.mAction = ev.getAction() & MotionEvent.ACTION_MASK;
        final int count = ev.getPointerCount();
        ted.mIds = new int[count];
        ted.mPoints = new Point[count];
        for (int c = 0; c < count; c++) {
            ted.mIds[c] = ev.getPointerId(c);
            int x = viewToContentX((int) ev.getX(c) + mScrollX);
            int y = viewToContentY((int) ev.getY(c) + mScrollY);
            ted.mPoints[c] = new Point(x, y);
@@ -5927,6 +5937,8 @@ public class WebView extends AbsoluteLayout
                mWebViewCore.removeMessages(EventHub.TOUCH_EVENT);
            }
            TouchEventData ted = new TouchEventData();
            ted.mIds = new int[1];
            ted.mIds[0] = 0;
            ted.mPoints = new Point[1];
            ted.mPoints[0] = new Point(x, y);
            ted.mAction = MotionEvent.ACTION_CANCEL;
@@ -7054,6 +7066,8 @@ public class WebView extends AbsoluteLayout
                    if (inFullScreenMode() || mDeferTouchProcess) {
                        TouchEventData ted = new TouchEventData();
                        ted.mAction = WebViewCore.ACTION_LONGPRESS;
                        ted.mIds = new int[1];
                        ted.mIds[0] = 0;
                        ted.mPoints = new Point[1];
                        ted.mPoints[0] = new Point(viewToContentX((int) mLastTouchX + mScrollX),
                                                   viewToContentY((int) mLastTouchY + mScrollY));
+5 −4
Original line number Diff line number Diff line
@@ -562,8 +562,8 @@ final class WebViewCore {
    private native void nativeTouchUp(int touchGeneration,
            int framePtr, int nodePtr, int x, int y);

    private native boolean nativeHandleTouchEvent(int action, int[] x, int[] y,
            int count, int metaState);
    private native boolean nativeHandleTouchEvent(int action, int[] idArray,
            int[] xArray, int[] yArray, int count, int metaState);

    private native void nativeUpdateFrameCache();

@@ -828,6 +828,7 @@ final class WebViewCore {

    static class TouchEventData {
        int mAction;
        int[] mIds;  // Ids of the touch points
        Point[] mPoints;
        int mMetaState;
        boolean mReprocess;
@@ -1336,8 +1337,8 @@ final class WebViewCore {
                                    mWebView.mPrivateHandler,
                                    WebView.PREVENT_TOUCH_ID,
                                    ted.mAction,
                                    nativeHandleTouchEvent(ted.mAction, xArray,
                                            yArray, count, ted.mMetaState) ? 1 : 0,
                                    nativeHandleTouchEvent(ted.mAction, ted.mIds,
                                        xArray, yArray, count, ted.mMetaState) ? 1 : 0,
                                    ted.mReprocess ? ted : null).sendToTarget();
                            break;
                        }