diff options
author | Cary Clark <cary@android.com> | 2009-07-29 14:38:23 -0400 |
---|---|---|
committer | Cary Clark <cary@android.com> | 2009-07-31 13:15:23 -0400 |
commit | fa768f11d82c34980cce020f442329299efb08ca (patch) | |
tree | 775331596b3c453e37ff85d70411cafa628defe0 /WebKit/android/jni | |
parent | 686f7d9aacbb54b81e6f8c51b1a07103ca90f703 (diff) | |
download | external_webkit-fa768f11d82c34980cce020f442329299efb08ca.zip external_webkit-fa768f11d82c34980cce020f442329299efb08ca.tar.gz external_webkit-fa768f11d82c34980cce020f442329299efb08ca.tar.bz2 |
rebuild the nav cache on mouse clicks during page load
While the page is loading, the nav cache is not rebuilt.
Double-click zooms out the web page by using the nav cache to
find the left edge of the column -- but fails to work during
page load. This change rebuilds the nav cache (if the page is
loading) each time a mouse click is sent to webkit.
This doesn't fix the bug where the first double click doesn't
align the column correctly, but helps with subsequent clicks.
Also, pass scale information to getBlockLeftEdge so it can
restrict its search to the area that will be zoomed to. Default
to the point clicked if no alignment info can be found.
Diffstat (limited to 'WebKit/android/jni')
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 23 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.h | 1 |
2 files changed, 22 insertions, 2 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index da19aba..726f724 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -362,13 +362,19 @@ WebCore::Node* WebViewCore::currentFocus() void WebViewCore::recordPicture(SkPicture* picture) { // if there is no document yet, just return - if (!m_mainFrame->document()) + if (!m_mainFrame->document()) { + DBG_NAV_LOG("no document"); return; + } // Call layout to ensure that the contentWidth and contentHeight are correct - if (!layoutIfNeededRecursive(m_mainFrame)) + if (!layoutIfNeededRecursive(m_mainFrame)) { + DBG_NAV_LOG("layout failed"); return; + } // draw into the picture's recording canvas WebCore::FrameView* view = m_mainFrame->view(); + DBG_NAV_LOGD("view=(w=%d,h=%d)", view->contentsWidth(), + view->contentsHeight()); SkAutoPictureRecord arp(picture, view->contentsWidth(), view->contentsHeight(), PICT_RECORD_FLAGS); SkAutoMemoryUsageProbe mup(__FUNCTION__); @@ -1141,6 +1147,12 @@ void WebViewCore::updateFrameCache() gFrameCacheMutex.unlock(); } +void WebViewCore::updateFrameCacheIfLoading() +{ + if (!m_check_domtree_version) + updateFrameCache(); +} + /////////////////////////////////////////////////////////////////////////////// void WebViewCore::addPlugin(PluginWidgetAndroid* w) @@ -2116,6 +2128,11 @@ static jstring WebCoreStringToJString(JNIEnv *env, WebCore::String string) return ret; } +static void UpdateFrameCacheIfLoading(JNIEnv *env, jobject obj) +{ + GET_NATIVE_VIEW(env, obj)->updateFrameCacheIfLoading(); +} + static void SetSize(JNIEnv *env, jobject obj, jint width, jint height, jint screenWidth, jfloat scale, jint realScreenWidth, jint screenHeight) { @@ -2715,6 +2732,8 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { { "nativeFreeMemory", "()V", (void*) FreeMemory }, { "nativeSetJsFlags", "(Ljava/lang/String;)V", (void*) SetJsFlags }, { "nativeUpdatePluginState", "(III)V", (void*) UpdatePluginState }, + { "nativeUpdateFrameCacheIfLoading", "()V", + (void*) UpdateFrameCacheIfLoading }, }; int register_webviewcore(JNIEnv* env) diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index 64f4857..a2737c8 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -371,6 +371,7 @@ namespace android { float scale() const { return m_scale; } float screenWidthScale() const { return m_screenWidthScale; } WebCore::Frame* mainFrame() const { return m_mainFrame; } + void updateFrameCacheIfLoading(); // utility to split slow parts of the picture set void splitContent(); |