summaryrefslogtreecommitdiffstats
path: root/Source/WebCore
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2011-12-09 17:53:19 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-12-09 17:53:19 -0800
commitaaa0eaad49fc612572a56cc22017006cf4804880 (patch)
tree093c3ce5ebafe8cab531667accc76e75e0e29893 /Source/WebCore
parentd5d80ef0209b981f86c532ffc148cc4f38173e46 (diff)
parent346a3e8a4362562e79c622751aa11cd6941f6208 (diff)
downloadexternal_webkit-aaa0eaad49fc612572a56cc22017006cf4804880.zip
external_webkit-aaa0eaad49fc612572a56cc22017006cf4804880.tar.gz
external_webkit-aaa0eaad49fc612572a56cc22017006cf4804880.tar.bz2
Merge "Swap tiles when viewport changes slightly, and properly cap prepare bounds"
Diffstat (limited to 'Source/WebCore')
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.cpp8
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.h3
-rw-r--r--Source/WebCore/platform/graphics/android/TiledPage.cpp4
3 files changed, 11 insertions, 4 deletions
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
index cf49b9e..710ae25 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -87,6 +87,7 @@ GLWebViewState::GLWebViewState()
, m_frameworkInval(0, 0, 0, 0)
, m_frameworkLayersInval(0, 0, 0, 0)
, m_isScrolling(false)
+ , m_isViewportScrolling(false)
, m_goingDown(true)
, m_goingLeft(false)
, m_expandedTileBoundsX(0)
@@ -246,11 +247,16 @@ int GLWebViewState::baseContentHeight()
void GLWebViewState::setViewport(SkRect& viewport, float scale)
{
if ((m_viewport == viewport) &&
- (zoomManager()->futureScale() == scale))
+ (zoomManager()->futureScale() == scale)) {
+ m_isViewportScrolling = false;
return;
+ }
m_goingDown = m_viewport.fTop - viewport.fTop <= 0;
m_goingLeft = m_viewport.fLeft - viewport.fLeft >= 0;
+
+ // detect viewport scrolling from short programmatic scrolls/jumps
+ m_isViewportScrolling = m_viewport != viewport && SkRect::Intersects(m_viewport, viewport);
m_viewport = viewport;
XLOG("New VIEWPORT %.2f - %.2f %.2f - %.2f (w: %2.f h: %.2f scale: %.2f currentScale: %.2f futureScale: %.2f)",
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.h b/Source/WebCore/platform/graphics/android/GLWebViewState.h
index b4c6dff..d195597 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.h
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.h
@@ -202,7 +202,7 @@ public:
unsigned int currentPictureCounter() const { return m_currentPictureCounter; }
void setIsScrolling(bool isScrolling) { m_isScrolling = isScrolling; }
- bool isScrolling() { return m_isScrolling; }
+ bool isScrolling() { return m_isScrolling || m_isViewportScrolling; }
void drawBackground(Color& backgroundColor);
double setupDrawing(IntRect& viewRect, SkRect& visibleRect,
@@ -283,6 +283,7 @@ private:
GLExtras m_glExtras;
bool m_isScrolling;
+ bool m_isViewportScrolling;
bool m_goingDown;
bool m_goingLeft;
diff --git a/Source/WebCore/platform/graphics/android/TiledPage.cpp b/Source/WebCore/platform/graphics/android/TiledPage.cpp
index 31a0593..452a010 100644
--- a/Source/WebCore/platform/graphics/android/TiledPage.cpp
+++ b/Source/WebCore/platform/graphics/android/TiledPage.cpp
@@ -276,8 +276,8 @@ void TiledPage::prepare(bool goingDown, bool goingLeft, const SkIRect& tileBound
nbTilesHeight += firstTileY;
firstTileY = 0;
}
- nbTilesWidth = std::min(nbTilesWidth, maxX - firstTileX);
- nbTilesHeight = std::min(nbTilesHeight, maxY - firstTileY);
+ nbTilesWidth = std::min(nbTilesWidth, maxX - firstTileX + 1);
+ nbTilesHeight = std::min(nbTilesHeight, maxY - firstTileY + 1);
// check against corrupted scale values giving bad height/width (use float to avoid overflow)
float numTiles = static_cast<float>(nbTilesHeight) * static_cast<float>(nbTilesWidth);