summaryrefslogtreecommitdiffstats
path: root/WebKit/android/jni/WebViewCore.cpp
diff options
context:
space:
mode:
authorCary Clark <cary@android.com>2009-12-11 12:50:10 -0500
committerCary Clark <cary@android.com>2009-12-15 11:37:47 -0500
commitd4924af12855cd19162ba1442a6055664c98ca32 (patch)
treef5e2fcd6c7877b79aca9963126d734a5d6dff1a4 /WebKit/android/jni/WebViewCore.cpp
parent334e51bc2ff9bf7fc55fa67dc8a6d9257501a32e (diff)
downloadexternal_webkit-d4924af12855cd19162ba1442a6055664c98ca32.zip
external_webkit-d4924af12855cd19162ba1442a6055664c98ca32.tar.gz
external_webkit-d4924af12855cd19162ba1442a6055664c98ca32.tar.bz2
check to see if nav cache is up to date on tap
- WebKit/android/jni/WebViewCore.cpp - WebKit/android/jni/WebViewCore.h Add validNodeAndBounds() to determine if the clicked cached node is good. First check to see if the pointer to the frame and node still exist in the DOM. If they do, see if the hit test bounds they point to is the same as when the cache was recorded. - WebKit/android/nav/CacheBuilder.cpp - WebKit/android/nav/CachedNode.h Record the original absolute bounds for later comparison. - WebKit/android/nav/CacheBuilder.h Make getAreaRect() public so it can be called by validation. - WebKit/android/nav/WebView.cpp Enhance motionUp() with additional validation: use pointInNavCache() to see if there's a cached node; wait for message from webkit to see if bounds is unchanged; then use motionUp() to pass the original or altered click. This is a two-part change with frameworks/base. Fixes http://b/2249425
Diffstat (limited to 'WebKit/android/jni/WebViewCore.cpp')
-rw-r--r--WebKit/android/jni/WebViewCore.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 4bff8a7..e62b362 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -2632,6 +2632,21 @@ void WebViewCore::destroySurface(jobject childView)
checkException(env);
}
+bool WebViewCore::validNodeAndBounds(Frame* frame, Node* node,
+ const IntRect& originalAbsoluteBounds)
+{
+ bool valid = CacheBuilder::validNode(m_mainFrame, frame, node);
+ if (!valid)
+ return false;
+ RenderObject* renderer = node->renderer();
+ if (!renderer)
+ return false;
+ IntRect absBounds = node->hasTagName(HTMLNames::areaTag)
+ ? CacheBuilder::getAreaRect(static_cast<HTMLAreaElement*>(node))
+ : renderer->absoluteBoundingBoxRect();
+ return absBounds == originalAbsoluteBounds;
+}
+
//----------------------------------------------------------------------
// Native JNI methods
//----------------------------------------------------------------------
@@ -3219,6 +3234,22 @@ static void FullScreenPluginHidden(JNIEnv* env, jobject obj, jint npp)
plugin->exitFullScreen(false);
}
+static WebCore::IntRect jrect_to_webrect(JNIEnv* env, jobject obj)
+{
+ int L, T, R, B;
+ GraphicsJNI::get_jrect(env, obj, &L, &T, &R, &B);
+ return WebCore::IntRect(L, T, R - L, B - T);
+}
+
+static bool ValidNodeAndBounds(JNIEnv *env, jobject obj, int frame, int node,
+ jobject rect)
+{
+ IntRect nativeRect = jrect_to_webrect(env, rect);
+ return GET_NATIVE_VIEW(env, obj)->validNodeAndBounds(
+ reinterpret_cast<Frame*>(frame),
+ reinterpret_cast<Node*>(node), nativeRect);
+}
+
// ----------------------------------------------------------------------------
/*
@@ -3315,6 +3346,8 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = {
(void*) ProvideVisitedHistory },
{ "nativeFullScreenPluginHidden", "(I)V",
(void*) FullScreenPluginHidden },
+ { "nativeValidNodeAndBounds", "(IILandroid/graphics/Rect;)Z",
+ (void*) ValidNodeAndBounds },
};
int register_webviewcore(JNIEnv* env)