summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2011-12-09 11:36:44 -0800
committerChris Craik <ccraik@google.com>2011-12-09 13:54:56 -0800
commit346a3e8a4362562e79c622751aa11cd6941f6208 (patch)
tree770f5fcc068f96534b7d829126d9a848b09103a7 /Source/WebCore/platform/graphics/android
parent46ded0d896cca693053fe2459c1930de95b65cd9 (diff)
downloadexternal_webkit-346a3e8a4362562e79c622751aa11cd6941f6208.zip
external_webkit-346a3e8a4362562e79c622751aa11cd6941f6208.tar.gz
external_webkit-346a3e8a4362562e79c622751aa11cd6941f6208.tar.bz2
Swap tiles when viewport changes slightly, and properly cap prepare bounds
bug:5738336 Viewport changes that overlap previous viewports will result in fast scrolling mode being activated. Change-Id: I356df0054caff19519fcf8543f96726e78918922
Diffstat (limited to 'Source/WebCore/platform/graphics/android')
-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);