From edfdd155273feaa14d3e1259627fe10f86e2b6ff Mon Sep 17 00:00:00 2001 From: Steve Block Date: Thu, 11 Nov 2010 18:56:11 +0000 Subject: Fix EventSender mouse events to correctly convert from screen coordinates This is required for LayoutTest fast/dom/Node/mutation-blur.html Change-Id: Ib82f897ab61ac3a8e8eacee8ec08f5242c43c736 --- .../android/dumprendertree2/EventSenderImpl.java | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/EventSenderImpl.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/EventSenderImpl.java index 842bf2b..d425734 100644 --- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/EventSenderImpl.java +++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/EventSenderImpl.java @@ -142,8 +142,7 @@ public class EventSenderImpl { private List 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: - ts = SystemClock.uptimeMillis(); - event = MotionEvent.obtain(ts, ts, MotionEvent.ACTION_DOWN, mMouseX, mMouseY, 0); - mWebView.onTouchEvent(event); + if (mMousePoint != null) { + ts = SystemClock.uptimeMillis(); + event = MotionEvent.obtain(ts, ts, MotionEvent.ACTION_DOWN, mMousePoint.x(), mMousePoint.y(), 0); + mWebView.onTouchEvent(event); + } break; case MSG_MOUSE_UP: - ts = SystemClock.uptimeMillis(); - event = MotionEvent.obtain(ts, ts, MotionEvent.ACTION_UP, mMouseX, mMouseY, 0); - mWebView.onTouchEvent(event); + if (mMousePoint != null) { + ts = SystemClock.uptimeMillis(); + 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) { -- cgit v1.1