Pass key modifier state to webcore for touch events and update DRT so it can simulate them.

Change-Id: Ic5aa8cb0376f6a3eecaa6340d57f28fa97f016bd
This commit is contained in:
Ben Murdoch
2010-02-02 18:20:11 +00:00
parent c0784c749b
commit 8a032a3b29
5 changed files with 46 additions and 9 deletions

View File

@@ -4436,6 +4436,7 @@ public class WebView extends AbsoluteLayout
ted.mX = viewToContentX((int) x + mScrollX);
ted.mY = viewToContentY((int) y + mScrollY);
ted.mEventTime = eventTime;
ted.mMetaState = ev.getMetaState();
mWebViewCore.sendMessage(EventHub.TOUCH_EVENT, ted);
mLastSentTouchTime = eventTime;
}
@@ -4699,6 +4700,7 @@ public class WebView extends AbsoluteLayout
ted.mX = viewToContentX((int) x + mScrollX);
ted.mY = viewToContentY((int) y + mScrollY);
ted.mEventTime = eventTime;
ted.mMetaState = ev.getMetaState();
mWebViewCore.sendMessage(EventHub.TOUCH_EVENT, ted);
} else if (mFullScreenHolder == null) {
doDoubleTap();
@@ -5735,6 +5737,11 @@ public class WebView extends AbsoluteLayout
ted.mX = viewToContentX((int) mLastTouchX + mScrollX);
ted.mY = viewToContentY((int) mLastTouchY + mScrollY);
ted.mEventTime = SystemClock.uptimeMillis();
// metaState for long press is tricky. Should it be the state
// when the press started or when the press was released? Or
// some intermediary key state? For simplicity for now, we
// don't set it.
ted.mMetaState = 0;
mWebViewCore.sendMessage(EventHub.TOUCH_EVENT, ted);
} else if (mPreventDrag == PREVENT_DRAG_NO) {
mTouchMode = TOUCH_DONE_MODE;

View File

@@ -515,7 +515,7 @@ final class WebViewCore {
private native void nativeTouchUp(int touchGeneration,
int framePtr, int nodePtr, int x, int y);
private native int nativeHandleTouchEvent(int action, int x, int y, long time);
private native int nativeHandleTouchEvent(int action, int x, int y, long time, int metaState);
private native void nativeUpdateFrameCache();
@@ -735,6 +735,7 @@ final class WebViewCore {
int mX;
int mY;
long mEventTime;
int mMetaState;
}
static class GeolocationPermissionsData {
@@ -1198,7 +1199,7 @@ final class WebViewCore {
mWebView.mPrivateHandler,
WebView.PREVENT_TOUCH_ID, ted.mAction,
nativeHandleTouchEvent(ted.mAction, ted.mX,
ted.mY, ted.mEventTime)).sendToTarget();
ted.mY, ted.mEventTime, ted.mMetaState)).sendToTarget();
break;
}