summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-05-07 11:33:50 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-05-07 11:33:50 -0700
commit17a3b1ef1e8d47f9e6330193bda64609772b8626 (patch)
treebf57b982b6077919738346967bfe9168d7c011c2 /Source/WebKit/android
parent353e1be7cac5375c6698b13bc0d786b385aff9ad (diff)
parente5c9306b222e597f907697ab28a7936bfc61e487 (diff)
downloadexternal_webkit-17a3b1ef1e8d47f9e6330193bda64609772b8626.zip
external_webkit-17a3b1ef1e8d47f9e6330193bda64609772b8626.tar.gz
external_webkit-17a3b1ef1e8d47f9e6330193bda64609772b8626.tar.bz2
Merge "Disable prerenders while scrolling" into jb-dev
Diffstat (limited to 'Source/WebKit/android')
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp7
-rw-r--r--Source/WebKit/android/jni/WebViewCore.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index 1a1fc16..dddae43 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -171,6 +171,10 @@ FILE* gRenderTreeFile = 0;
#include "RenderLayerCompositor.h"
#endif
+// How many ms to wait for the scroll to "settle" before we will consider doing
+// prerenders
+#define PRERENDER_AFTER_SCROLL_DELAY 750
+
////////////////////////////////////////////////////////////////////////////////////////////////
namespace android {
@@ -737,6 +741,8 @@ void WebViewCore::paintContents(WebCore::GraphicsContext* gc, WebCore::IntRect&
SkCanvas* WebViewCore::createPrerenderCanvas(PrerenderedInval* prerendered)
{
+ if (currentTimeMS() - m_scrollSetTime < PRERENDER_AFTER_SCROLL_DELAY)
+ return 0;
if (prerendered->area.isEmpty())
return 0;
FloatRect scaleTemp(m_scrollOffsetX, m_scrollOffsetY, m_screenWidth, m_screenHeight);
@@ -1049,6 +1055,7 @@ void WebViewCore::setScrollOffset(bool sendScrollEvent, int dx, int dy)
if (m_scrollOffsetX != dx || m_scrollOffsetY != dy) {
m_scrollOffsetX = dx;
m_scrollOffsetY = dy;
+ m_scrollSetTime = currentTimeMS();
// The visible rect is located within our coordinate space so it
// contains the actual scroll position. Setting the location makes hit
// testing work correctly.
diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h
index 8dc1d07..043953b 100644
--- a/Source/WebKit/android/jni/WebViewCore.h
+++ b/Source/WebKit/android/jni/WebViewCore.h
@@ -760,6 +760,7 @@ namespace android {
int m_maxYScroll;
int m_scrollOffsetX; // webview.java's current scroll in X
int m_scrollOffsetY; // webview.java's current scroll in Y
+ double m_scrollSetTime; // when the scroll was last set
WebCore::IntPoint m_mousePos;
int m_screenWidth; // width of the visible rect in document coordinates
int m_screenHeight;// height of the visible rect in document coordinates