From e84a0db030ac95deb74e59864ff65516a243d3b8 Mon Sep 17 00:00:00 2001 From: Cary Clark Date: Wed, 17 Mar 2010 15:58:20 -0400 Subject: [PATCH] simplify utility to hit-test focused plugin After about 4 taps, this starts to return that the tap was in the plugin. Before that, the plugin doesn't have focus. Derek may want to verify that everything is working as it should -- maybe it just takes that long for webkit to take focus. companion fix in external/webkit Change-Id: I80ffba6c55876b0af9c305c539a10e8e8ed7cb3c http://b/2521087 --- core/java/android/webkit/WebView.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 39b87fee49f21..418dc9c9cdac8 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -4521,9 +4521,14 @@ public class WebView extends AbsoluteLayout } private boolean hitFocusedPlugin(int contentX, int contentY) { + if (DebugFlags.WEB_VIEW) { + Log.v(LOGTAG, "nativeFocusIsPlugin()=" + nativeFocusIsPlugin()); + Rect r = nativeFocusNodeBounds(); + Log.v(LOGTAG, "nativeFocusNodeBounds()=(" + r.left + ", " + r.top + + ", " + r.right + ", " + r.bottom + ")"); + } return nativeFocusIsPlugin() - && nativePointInNavCache(contentX, contentY, mNavSlop) - && nativeCacheHitNodePointer() == nativeFocusNodePointer(); + && nativeFocusNodeBounds().contains(contentX, contentY); } private boolean shouldForwardTouchEvent() { @@ -7169,6 +7174,7 @@ public class WebView extends AbsoluteLayout */ private native int nativeFocusCandidateType(); private native boolean nativeFocusIsPlugin(); + private native Rect nativeFocusNodeBounds(); /* package */ native int nativeFocusNodePointer(); private native Rect nativeGetCursorRingBounds(); private native String nativeGetSelection();