diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 4a8a10c16594e..9c19ced912354 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -1750,8 +1750,9 @@ public class WebView extends AbsoluteLayout } // Rect.equals() checks for null input. if (!rect.equals(mLastVisibleRectSent)) { + Point pos = new Point(rect.left, rect.top); mWebViewCore.sendMessage(EventHub.SET_SCROLL_OFFSET, - rect.left, rect.top); + nativeMoveGeneration(), 0, pos); mLastVisibleRectSent = rect; } Rect globalRect = new Rect(); @@ -2915,10 +2916,9 @@ public class WebView extends AbsoluteLayout WebViewCore.CursorData result = new WebViewCore.CursorData(); result.mMoveGeneration = nativeMoveGeneration(); result.mFrame = nativeCursorFramePointer(); - result.mNode = nativeCursorNodePointer(); - Rect bounds = nativeCursorNodeBounds(); - result.mX = bounds.centerX(); - result.mY = bounds.centerY(); + Point position = nativeCursorPosition(); + result.mX = position.x; + result.mY = position.y; return result; } @@ -5244,6 +5244,7 @@ public class WebView extends AbsoluteLayout private native boolean nativeCursorIntersects(Rect visibleRect); private native boolean nativeCursorIsAnchor(); private native boolean nativeCursorIsTextInput(); + private native Point nativeCursorPosition(); private native String nativeCursorText(); /** * Returns true if the native cursor node says it wants to handle key events diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index 4d0c4bbcc5356..53936249c9024 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -379,12 +379,10 @@ final class WebViewCore { private native void nativeSaveDocumentState(int frame); - private native void nativeMoveMouse(int framePtr, int nodePtr, int x, - int y); + private native void nativeMoveMouse(int framePtr, int x, int y); private native void nativeMoveMouseIfLatest(int moveGeneration, - int framePtr, int nodePtr, int x, int y, - boolean ignoreNullFocus); + int framePtr, int x, int y); private native String nativeRetrieveHref(int framePtr, int nodePtr); @@ -524,16 +522,13 @@ final class WebViewCore { CursorData() {} CursorData(int frame, int node, int x, int y) { mFrame = frame; - mNode = node; mX = x; mY = y; } int mMoveGeneration; int mFrame; - int mNode; int mX; int mY; - boolean mIgnoreNullFocus; } static class JSInterfaceData { @@ -725,7 +720,7 @@ final class WebViewCore { public void handleMessage(Message msg) { if (DebugFlags.WEB_VIEW_CORE) { Log.v(LOGTAG, msg.what < LOAD_URL || msg.what - > SET_INACTIVE ? Integer.toString(msg.what) + > FREE_MEMORY ? Integer.toString(msg.what) : HandlerDebugString[msg.what - LOAD_URL]); } switch (msg.what) { @@ -819,7 +814,8 @@ final class WebViewCore { case SET_SCROLL_OFFSET: // note: these are in document coordinates // (inv-zoom) - nativeSetScrollOffset(msg.arg1, msg.arg2); + Point pt = (Point) msg.obj; + nativeSetScrollOffset(msg.arg1, pt.x, pt.y); break; case SET_GLOBAL_BOUNDS: @@ -973,16 +969,14 @@ final class WebViewCore { case SET_MOVE_MOUSE: CursorData cursorData = (CursorData) msg.obj; nativeMoveMouse(cursorData.mFrame, - cursorData.mNode, cursorData.mX, - cursorData.mY); + cursorData.mX, cursorData.mY); break; case SET_MOVE_MOUSE_IF_LATEST: CursorData cData = (CursorData) msg.obj; nativeMoveMouseIfLatest(cData.mMoveGeneration, - cData.mFrame, cData.mNode, - cData.mX, cData.mY, - cData.mIgnoreNullFocus); + cData.mFrame, + cData.mX, cData.mY); break; case REQUEST_CURSOR_HREF: { @@ -1728,7 +1722,7 @@ final class WebViewCore { } // these must be in document space (i.e. not scaled/zoomed). - private native void nativeSetScrollOffset(int dx, int dy); + private native void nativeSetScrollOffset(int gen, int dx, int dy); private native void nativeSetGlobalBounds(int x, int y, int w, int h);