summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-05-04 11:08:55 -0700
committerJohn Reck <jreck@google.com>2012-05-06 15:55:00 -0700
commite5c9306b222e597f907697ab28a7936bfc61e487 (patch)
treeea2a15d5a709640a9fc4386a055c2eef35a714c8 /Source/WebKit/android
parente712b54e831d077c789984b8206f64d81dbceaa2 (diff)
downloadexternal_webkit-e5c9306b222e597f907697ab28a7936bfc61e487.zip
external_webkit-e5c9306b222e597f907697ab28a7936bfc61e487.tar.gz
external_webkit-e5c9306b222e597f907697ab28a7936bfc61e487.tar.bz2
Disable prerenders while scrolling
Bug: 6445656 Change-Id: I3d9e2cece4b3ec86deb00e98ae98f281525dab48
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