diff options
author | Steve Block <steveblock@google.com> | 2010-11-11 18:56:11 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-11-11 20:06:42 +0000 |
commit | edfdd155273feaa14d3e1259627fe10f86e2b6ff (patch) | |
tree | 9d951be9f94027f37a994fb67204029688efdda0 /tests/DumpRenderTree2/src | |
parent | aca659c20748030c02d7ab31ff28f8293126092b (diff) | |
download | frameworks_base-edfdd155273feaa14d3e1259627fe10f86e2b6ff.zip frameworks_base-edfdd155273feaa14d3e1259627fe10f86e2b6ff.tar.gz frameworks_base-edfdd155273feaa14d3e1259627fe10f86e2b6ff.tar.bz2 |
Fix EventSender mouse events to correctly convert from screen coordinates
This is required for LayoutTest fast/dom/Node/mutation-blur.html
Change-Id: Ib82f897ab61ac3a8e8eacee8ec08f5242c43c736
Diffstat (limited to 'tests/DumpRenderTree2/src')
-rw-r--r-- | tests/DumpRenderTree2/src/com/android/dumprendertree2/EventSenderImpl.java | 25 |
1 files changed, 13 insertions, 12 deletions
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<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: - 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) { |