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

Commit edfdd155 authored by Steve Block's avatar Steve Block
Browse files

Fix EventSender mouse events to correctly convert from screen coordinates

This is required for LayoutTest fast/dom/Node/mutation-blur.html

Change-Id: Ib82f897ab61ac3a8e8eacee8ec08f5242c43c736
parent aca659c2
Loading
Loading
Loading
Loading
+13 −12
Original line number Diff line number Diff line
@@ -142,8 +142,7 @@ public class EventSenderImpl {

    private List<TouchPoint> mTouchPoints;
    private int mTouchMetaState;
    private int mMouseX;
    private int mMouseY;
    private Point mMousePoint;

    private WebView mWebView;

@@ -185,15 +184,19 @@ public class EventSenderImpl {
                /** MOUSE */

                case MSG_MOUSE_DOWN:
                    if (mMousePoint != null) {
                        ts = SystemClock.uptimeMillis();
                    event = MotionEvent.obtain(ts, ts, MotionEvent.ACTION_DOWN, mMouseX, mMouseY, 0);
                        event = MotionEvent.obtain(ts, ts, MotionEvent.ACTION_DOWN, mMousePoint.x(), mMousePoint.y(), 0);
                        mWebView.onTouchEvent(event);
                    }
                    break;

                case MSG_MOUSE_UP:
                    if (mMousePoint != null) {
                        ts = SystemClock.uptimeMillis();
                    event = MotionEvent.obtain(ts, ts, MotionEvent.ACTION_UP, mMouseX, mMouseY, 0);
                        event = MotionEvent.obtain(ts, ts, MotionEvent.ACTION_UP, mMousePoint.x(), mMousePoint.y(), 0);
                        mWebView.onTouchEvent(event);
                    }
                    break;

                case MSG_MOUSE_CLICK:
@@ -202,8 +205,7 @@ public class EventSenderImpl {
                    break;

                case MSG_MOUSE_MOVE_TO:
                    mMouseX = msg.arg1;
                    mMouseY = msg.arg2;
                    mMousePoint = createViewPointFromContentCoordinates(msg.arg1, msg.arg2);
                    break;

                /** TOUCH */
@@ -342,8 +344,7 @@ public class EventSenderImpl {
        mWebView = webView;
        mTouchPoints = null;
        mTouchMetaState = 0;
        mMouseX = 0;
        mMouseY = 0;
        mMousePoint = null;
    }

    public void enableDOMUIEventLogging(int domNode) {