Loading core/java/android/webkit/WebView.java +12 −1 Original line number Diff line number Diff line Loading @@ -342,6 +342,7 @@ public class WebView extends AbsoluteLayout * choice. Maybe make this in the buildspec later. */ private static final int TOUCH_SENT_INTERVAL = 50; private int mCurrentTouchInterval = TOUCH_SENT_INTERVAL; /** * Helper class to get velocity for fling Loading Loading @@ -4343,7 +4344,7 @@ public class WebView extends AbsoluteLayout // pass the touch events from UI thread to WebCore thread if (mForwardTouchEvents && (action != MotionEvent.ACTION_MOVE || eventTime - mLastSentTouchTime > TOUCH_SENT_INTERVAL)) { || eventTime - mLastSentTouchTime > mCurrentTouchInterval)) { WebViewCore.TouchEventData ted = new WebViewCore.TouchEventData(); ted.mAction = action; ted.mX = viewToContentX((int) x + mScrollX); Loading Loading @@ -6633,6 +6634,16 @@ public class WebView extends AbsoluteLayout mWebViewCore.drawContentPicture(canvas, 0, false, false); } /** * Set the time to wait between passing touches to WebCore. See also the * TOUCH_SENT_INTERVAL member for further discussion. * * @hide This is only used by the DRT test application. */ public void setTouchInterval(int interval) { mCurrentTouchInterval = interval; } /** * Update our cache with updatedText. * @param updatedText The new text to put in our cache. Loading tests/DumpRenderTree/src/com/android/dumprendertree/CallbackProxy.java +96 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.dumprendertree; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.webkit.MockGeolocation; Loading @@ -37,6 +38,15 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon private static final int EVENT_MOUSE_DOWN = 7; private static final int EVENT_MOUSE_MOVE = 8; private static final int EVENT_MOUSE_UP = 9; private static final int EVENT_TOUCH_START = 10; private static final int EVENT_TOUCH_MOVE = 11; private static final int EVENT_TOUCH_END = 12; private static final int EVENT_TOUCH_CANCEL = 13; private static final int EVENT_ADD_TOUCH_POINT = 14; private static final int EVENT_UPDATE_TOUCH_POINT = 15; private static final int EVENT_RELEASE_TOUCH_POINT = 16; private static final int EVENT_CLEAR_TOUCH_POINTS = 17; private static final int EVENT_CANCEL_TOUCH_POINT = 18; private static final int LAYOUT_CLEAR_LIST = 20; private static final int LAYOUT_DISPLAY = 21; Loading Loading @@ -107,6 +117,46 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon mEventSender.mouseUp(); break; case EVENT_TOUCH_START: mEventSender.touchStart(); break; case EVENT_TOUCH_MOVE: mEventSender.touchMove(); break; case EVENT_TOUCH_END: mEventSender.touchEnd(); break; case EVENT_TOUCH_CANCEL: mEventSender.touchCancel(); break; case EVENT_ADD_TOUCH_POINT: mEventSender.addTouchPoint(msg.arg1, msg.arg2); break; case EVENT_UPDATE_TOUCH_POINT: Bundle args = (Bundle) msg.obj; int x = args.getInt("x"); int y = args.getInt("y"); int id = args.getInt("id"); mEventSender.updateTouchPoint(id, x, y); break; case EVENT_RELEASE_TOUCH_POINT: mEventSender.releaseTouchPoint(msg.arg1); break; case EVENT_CLEAR_TOUCH_POINTS: mEventSender.clearTouchPoints(); break; case EVENT_CANCEL_TOUCH_POINT: mEventSender.cancelTouchPoint(msg.arg1); break; case LAYOUT_CLEAR_LIST: mLayoutTestController.clearBackForwardList(); break; Loading Loading @@ -253,6 +303,51 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon obtainMessage(EVENT_MOUSE_UP).sendToTarget(); } public void touchStart() { obtainMessage(EVENT_TOUCH_START).sendToTarget(); } public void addTouchPoint(int x, int y) { obtainMessage(EVENT_ADD_TOUCH_POINT, x, y).sendToTarget(); } public void updateTouchPoint(int id, int x, int y) { Bundle map = new Bundle(); map.putInt("x", x); map.putInt("y", y); map.putInt("id", id); obtainMessage(EVENT_UPDATE_TOUCH_POINT, map).sendToTarget(); } public void setTouchModifier(String modifier, boolean enabled) { // TODO(benm): Android doesn't support key modifiers on touch events yet. } public void touchMove() { obtainMessage(EVENT_TOUCH_MOVE).sendToTarget(); } public void releaseTouchPoint(int id) { obtainMessage(EVENT_RELEASE_TOUCH_POINT, id, 0).sendToTarget(); } public void touchEnd() { obtainMessage(EVENT_TOUCH_END).sendToTarget(); } public void touchCancel() { obtainMessage(EVENT_TOUCH_CANCEL).sendToTarget(); } public void clearTouchPoints() { obtainMessage(EVENT_CLEAR_TOUCH_POINTS).sendToTarget(); } public void cancelTouchPoint(int id) { obtainMessage(EVENT_CANCEL_TOUCH_POINT, id, 0).sendToTarget(); } // LayoutTestController Methods public void clearBackForwardList() { Loading tests/DumpRenderTree/src/com/android/dumprendertree/EventSender.java +10 −0 Original line number Diff line number Diff line Loading @@ -26,4 +26,14 @@ public interface EventSender { public void keyDown (String character); public void enableDOMUIEventLogging(int DOMNode); public void fireKeyboardEventsToElement(int DOMNode); public void touchStart(); public void touchMove(); public void touchEnd(); public void touchCancel(); public void addTouchPoint(int x, int y); public void updateTouchPoint(int id, int x, int y); public void setTouchModifier(String modifier, boolean enabled); public void releaseTouchPoint(int id); public void clearTouchPoints(); public void cancelTouchPoint(int id); } tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java +2 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,8 @@ public class FileFilter { // tests expect "LayoutTests" in their output. "storage/domstorage/localstorage/iframe-events.html", "storage/domstorage/sessionstorage/iframe-events.html", // We do not support multi touch events. "fast/events/touch/basic-multi-touch-events.html", // below tests (failed or crashes) are filtered out temporarily due to prioritizing "editing/selection/move-left-right.html", }; Loading tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java +7 −0 Original line number Diff line number Diff line Loading @@ -705,6 +705,7 @@ public class TestShellActivity extends Activity implements LayoutTestController mDumpDatabaseCallbacks = false; mCanOpenWindows = false; mEventSender.resetMouse(); mEventSender.clearTouchPoints(); mPageFinished = false; mOneHundredPercentComplete = false; mDumpWebKitData = false; Loading Loading @@ -769,6 +770,12 @@ public class TestShellActivity extends Activity implements LayoutTestController webview.setWebChromeClient(mChromeClient); webview.setWebViewClient(mViewClient); // Setting a touch interval of -1 effectively disables the optimisation in WebView // that stops repeated touch events flooding WebCore. The Event Sender only sends a // single event rather than a stream of events (like what would generally happen in // a real use of touch events in a WebView) and so if the WebView drops the event, // the test will fail as the test expects one callback for every touch it synthesizes. webview.setTouchInterval(-1); } private WebView mWebView; Loading Loading
core/java/android/webkit/WebView.java +12 −1 Original line number Diff line number Diff line Loading @@ -342,6 +342,7 @@ public class WebView extends AbsoluteLayout * choice. Maybe make this in the buildspec later. */ private static final int TOUCH_SENT_INTERVAL = 50; private int mCurrentTouchInterval = TOUCH_SENT_INTERVAL; /** * Helper class to get velocity for fling Loading Loading @@ -4343,7 +4344,7 @@ public class WebView extends AbsoluteLayout // pass the touch events from UI thread to WebCore thread if (mForwardTouchEvents && (action != MotionEvent.ACTION_MOVE || eventTime - mLastSentTouchTime > TOUCH_SENT_INTERVAL)) { || eventTime - mLastSentTouchTime > mCurrentTouchInterval)) { WebViewCore.TouchEventData ted = new WebViewCore.TouchEventData(); ted.mAction = action; ted.mX = viewToContentX((int) x + mScrollX); Loading Loading @@ -6633,6 +6634,16 @@ public class WebView extends AbsoluteLayout mWebViewCore.drawContentPicture(canvas, 0, false, false); } /** * Set the time to wait between passing touches to WebCore. See also the * TOUCH_SENT_INTERVAL member for further discussion. * * @hide This is only used by the DRT test application. */ public void setTouchInterval(int interval) { mCurrentTouchInterval = interval; } /** * Update our cache with updatedText. * @param updatedText The new text to put in our cache. Loading
tests/DumpRenderTree/src/com/android/dumprendertree/CallbackProxy.java +96 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.dumprendertree; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.webkit.MockGeolocation; Loading @@ -37,6 +38,15 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon private static final int EVENT_MOUSE_DOWN = 7; private static final int EVENT_MOUSE_MOVE = 8; private static final int EVENT_MOUSE_UP = 9; private static final int EVENT_TOUCH_START = 10; private static final int EVENT_TOUCH_MOVE = 11; private static final int EVENT_TOUCH_END = 12; private static final int EVENT_TOUCH_CANCEL = 13; private static final int EVENT_ADD_TOUCH_POINT = 14; private static final int EVENT_UPDATE_TOUCH_POINT = 15; private static final int EVENT_RELEASE_TOUCH_POINT = 16; private static final int EVENT_CLEAR_TOUCH_POINTS = 17; private static final int EVENT_CANCEL_TOUCH_POINT = 18; private static final int LAYOUT_CLEAR_LIST = 20; private static final int LAYOUT_DISPLAY = 21; Loading Loading @@ -107,6 +117,46 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon mEventSender.mouseUp(); break; case EVENT_TOUCH_START: mEventSender.touchStart(); break; case EVENT_TOUCH_MOVE: mEventSender.touchMove(); break; case EVENT_TOUCH_END: mEventSender.touchEnd(); break; case EVENT_TOUCH_CANCEL: mEventSender.touchCancel(); break; case EVENT_ADD_TOUCH_POINT: mEventSender.addTouchPoint(msg.arg1, msg.arg2); break; case EVENT_UPDATE_TOUCH_POINT: Bundle args = (Bundle) msg.obj; int x = args.getInt("x"); int y = args.getInt("y"); int id = args.getInt("id"); mEventSender.updateTouchPoint(id, x, y); break; case EVENT_RELEASE_TOUCH_POINT: mEventSender.releaseTouchPoint(msg.arg1); break; case EVENT_CLEAR_TOUCH_POINTS: mEventSender.clearTouchPoints(); break; case EVENT_CANCEL_TOUCH_POINT: mEventSender.cancelTouchPoint(msg.arg1); break; case LAYOUT_CLEAR_LIST: mLayoutTestController.clearBackForwardList(); break; Loading Loading @@ -253,6 +303,51 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon obtainMessage(EVENT_MOUSE_UP).sendToTarget(); } public void touchStart() { obtainMessage(EVENT_TOUCH_START).sendToTarget(); } public void addTouchPoint(int x, int y) { obtainMessage(EVENT_ADD_TOUCH_POINT, x, y).sendToTarget(); } public void updateTouchPoint(int id, int x, int y) { Bundle map = new Bundle(); map.putInt("x", x); map.putInt("y", y); map.putInt("id", id); obtainMessage(EVENT_UPDATE_TOUCH_POINT, map).sendToTarget(); } public void setTouchModifier(String modifier, boolean enabled) { // TODO(benm): Android doesn't support key modifiers on touch events yet. } public void touchMove() { obtainMessage(EVENT_TOUCH_MOVE).sendToTarget(); } public void releaseTouchPoint(int id) { obtainMessage(EVENT_RELEASE_TOUCH_POINT, id, 0).sendToTarget(); } public void touchEnd() { obtainMessage(EVENT_TOUCH_END).sendToTarget(); } public void touchCancel() { obtainMessage(EVENT_TOUCH_CANCEL).sendToTarget(); } public void clearTouchPoints() { obtainMessage(EVENT_CLEAR_TOUCH_POINTS).sendToTarget(); } public void cancelTouchPoint(int id) { obtainMessage(EVENT_CANCEL_TOUCH_POINT, id, 0).sendToTarget(); } // LayoutTestController Methods public void clearBackForwardList() { Loading
tests/DumpRenderTree/src/com/android/dumprendertree/EventSender.java +10 −0 Original line number Diff line number Diff line Loading @@ -26,4 +26,14 @@ public interface EventSender { public void keyDown (String character); public void enableDOMUIEventLogging(int DOMNode); public void fireKeyboardEventsToElement(int DOMNode); public void touchStart(); public void touchMove(); public void touchEnd(); public void touchCancel(); public void addTouchPoint(int x, int y); public void updateTouchPoint(int id, int x, int y); public void setTouchModifier(String modifier, boolean enabled); public void releaseTouchPoint(int id); public void clearTouchPoints(); public void cancelTouchPoint(int id); }
tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java +2 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,8 @@ public class FileFilter { // tests expect "LayoutTests" in their output. "storage/domstorage/localstorage/iframe-events.html", "storage/domstorage/sessionstorage/iframe-events.html", // We do not support multi touch events. "fast/events/touch/basic-multi-touch-events.html", // below tests (failed or crashes) are filtered out temporarily due to prioritizing "editing/selection/move-left-right.html", }; Loading
tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java +7 −0 Original line number Diff line number Diff line Loading @@ -705,6 +705,7 @@ public class TestShellActivity extends Activity implements LayoutTestController mDumpDatabaseCallbacks = false; mCanOpenWindows = false; mEventSender.resetMouse(); mEventSender.clearTouchPoints(); mPageFinished = false; mOneHundredPercentComplete = false; mDumpWebKitData = false; Loading Loading @@ -769,6 +770,12 @@ public class TestShellActivity extends Activity implements LayoutTestController webview.setWebChromeClient(mChromeClient); webview.setWebViewClient(mViewClient); // Setting a touch interval of -1 effectively disables the optimisation in WebView // that stops repeated touch events flooding WebCore. The Event Sender only sends a // single event rather than a stream of events (like what would generally happen in // a real use of touch events in a WebView) and so if the WebView drops the event, // the test will fail as the test expects one callback for every touch it synthesizes. webview.setTouchInterval(-1); } private WebView mWebView; Loading