summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android
diff options
context:
space:
mode:
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