Merge "Scroll layers on touch events."

This commit is contained in:
Patrick Scott
2011-02-22 11:06:02 -08:00
committed by Android (Google) Code Review
2 changed files with 29 additions and 0 deletions

View File

@@ -5531,6 +5531,8 @@ public class WebView extends AbsoluteLayout
ted.mPoints[0] = new Point(contentX, contentY);
ted.mMetaState = ev.getMetaState();
ted.mReprocess = mDeferTouchProcess;
ted.mNativeLayer = nativeScrollableLayer(
contentX, contentY, ted.mNativeLayerRect, null);
mWebViewCore.sendMessage(EventHub.TOUCH_EVENT, ted);
if (mDeferTouchProcess) {
// still needs to set them for compute deltaX/Y
@@ -5575,6 +5577,8 @@ public class WebView extends AbsoluteLayout
ted.mPoints[0] = new Point(contentX, contentY);
ted.mMetaState = ev.getMetaState();
ted.mReprocess = mDeferTouchProcess;
ted.mNativeLayer = mScrollingLayer;
ted.mNativeLayerRect.set(mScrollingLayerRect);
mWebViewCore.sendMessage(EventHub.TOUCH_EVENT, ted);
mLastSentTouchTime = eventTime;
if (mDeferTouchProcess) {
@@ -5754,6 +5758,8 @@ public class WebView extends AbsoluteLayout
ted.mPoints[0] = new Point(contentX, contentY);
ted.mMetaState = ev.getMetaState();
ted.mReprocess = mDeferTouchProcess;
ted.mNativeLayer = mScrollingLayer;
ted.mNativeLayerRect.set(mScrollingLayerRect);
mWebViewCore.sendMessage(EventHub.TOUCH_EVENT, ted);
}
mLastTouchUpTime = eventTime;
@@ -5773,6 +5779,9 @@ public class WebView extends AbsoluteLayout
ted.mPoints[0] = new Point(contentX, contentY);
ted.mMetaState = ev.getMetaState();
ted.mReprocess = mDeferTouchProcess;
ted.mNativeLayer = nativeScrollableLayer(
contentX, contentY,
ted.mNativeLayerRect, null);
mWebViewCore.sendMessage(EventHub.TOUCH_EVENT, ted);
} else if (mPreventDefault != PREVENT_DEFAULT_YES){
mZoomManager.handleDoubleTap(mLastTouchX, mLastTouchY);
@@ -6004,6 +6013,8 @@ public class WebView extends AbsoluteLayout
ted.mPoints = new Point[1];
ted.mPoints[0] = new Point(x, y);
ted.mAction = MotionEvent.ACTION_CANCEL;
ted.mNativeLayer = nativeScrollableLayer(
x, y, ted.mNativeLayerRect, null);
mWebViewCore.sendMessage(EventHub.TOUCH_EVENT, ted);
mPreventDefault = PREVENT_DEFAULT_IGNORE;
}
@@ -7166,6 +7177,9 @@ public class WebView extends AbsoluteLayout
// simplicity for now, we don't set it.
ted.mMetaState = 0;
ted.mReprocess = mDeferTouchProcess;
ted.mNativeLayer = nativeScrollableLayer(
ted.mPoints[0].x, ted.mPoints[0].y,
ted.mNativeLayerRect, null);
mWebViewCore.sendMessage(EventHub.TOUCH_EVENT, ted);
} else if (mPreventDefault != PREVENT_DEFAULT_YES) {
mTouchMode = TOUCH_DONE_MODE;
@@ -8038,6 +8052,8 @@ public class WebView extends AbsoluteLayout
touchUpData.mNode = node;
touchUpData.mX = x;
touchUpData.mY = y;
touchUpData.mNativeLayer = nativeScrollableLayer(
x, y, touchUpData.mNativeLayerRect, null);
mWebViewCore.sendMessage(EventHub.TOUCH_UP, touchUpData);
}

View File

@@ -778,6 +778,8 @@ final class WebViewCore {
int mNode;
int mX;
int mY;
int mNativeLayer;
Rect mNativeLayerRect = new Rect();
}
static class TouchHighlightData {
@@ -821,6 +823,8 @@ final class WebViewCore {
int mMetaState;
boolean mReprocess;
MotionEvent mMotionEvent;
int mNativeLayer;
Rect mNativeLayerRect = new Rect();
}
static class GeolocationPermissionsData {
@@ -1304,6 +1308,10 @@ final class WebViewCore {
case TOUCH_UP:
TouchUpData touchUpData = (TouchUpData) msg.obj;
if (touchUpData.mNativeLayer != 0) {
nativeScrollLayer(touchUpData.mNativeLayer,
touchUpData.mNativeLayerRect);
}
nativeTouchUp(touchUpData.mMoveGeneration,
touchUpData.mFrame, touchUpData.mNode,
touchUpData.mX, touchUpData.mY);
@@ -1318,6 +1326,10 @@ final class WebViewCore {
xArray[c] = ted.mPoints[c].x;
yArray[c] = ted.mPoints[c].y;
}
if (ted.mNativeLayer != 0) {
nativeScrollLayer(ted.mNativeLayer,
ted.mNativeLayerRect);
}
Message.obtain(
mWebView.mPrivateHandler,
WebView.PREVENT_TOUCH_ID,
@@ -2702,4 +2714,5 @@ final class WebViewCore {
int slop);
private native void nativeAutoFillForm(int queryId);
private native void nativeScrollLayer(int layer, Rect rect);
}