summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/WebCore/platform/ScrollView.cpp11
-rw-r--r--Source/WebCore/platform/ScrollView.h5
-rw-r--r--Source/WebCore/platform/android/ScrollViewAndroid.cpp2
-rw-r--r--Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp19
-rw-r--r--Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.cpp1
-rw-r--r--Source/WebCore/rendering/RenderLayer.cpp22
-rw-r--r--Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp12
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp3
8 files changed, 64 insertions, 11 deletions
diff --git a/Source/WebCore/platform/ScrollView.cpp b/Source/WebCore/platform/ScrollView.cpp
index e79f049..58a1fbf 100644
--- a/Source/WebCore/platform/ScrollView.cpp
+++ b/Source/WebCore/platform/ScrollView.cpp
@@ -27,6 +27,9 @@
#include "ScrollView.h"
#include "AXObjectCache.h"
+#if PLATFORM(ANDROID)
+#include "FrameView.h"
+#endif
#include "GraphicsContext.h"
#include "GraphicsLayer.h"
#include "HostWindow.h"
@@ -328,6 +331,14 @@ int ScrollView::actualScrollY() const
return platformActualScrollY();
return scrollY();
}
+
+FrameView* ScrollView::frameView() {
+ if (this->isFrameView()) {
+ FrameView* frameView = reinterpret_cast<FrameView*>(this);
+ return frameView;
+ }
+ return 0;
+}
#endif
IntPoint ScrollView::maximumScrollPosition() const
diff --git a/Source/WebCore/platform/ScrollView.h b/Source/WebCore/platform/ScrollView.h
index 558aee2..3228870 100644
--- a/Source/WebCore/platform/ScrollView.h
+++ b/Source/WebCore/platform/ScrollView.h
@@ -53,6 +53,10 @@ namespace WebCore {
class HostWindow;
class Scrollbar;
+#if PLATFORM(ANDROID)
+class FrameView;
+#endif
+
class ScrollView : public Widget, public ScrollableArea {
public:
~ScrollView();
@@ -172,6 +176,7 @@ public:
int actualHeight() const;
int actualScrollX() const;
int actualScrollY() const;
+ FrameView* frameView();
#endif
// Functions for querying the current scrolled position (both as a point, a size, or as individual X and Y values).
diff --git a/Source/WebCore/platform/android/ScrollViewAndroid.cpp b/Source/WebCore/platform/android/ScrollViewAndroid.cpp
index f29e998..8df0c2f 100644
--- a/Source/WebCore/platform/android/ScrollViewAndroid.cpp
+++ b/Source/WebCore/platform/android/ScrollViewAndroid.cpp
@@ -98,8 +98,6 @@ int ScrollView::platformActualScrollY() const
void ScrollView::platformSetScrollPosition(const WebCore::IntPoint& pt)
{
- if (parent()) // don't attempt to scroll subframes; they're fully visible
- return;
PlatformBridge::setScrollPosition(this, m_scrollOrigin.x() + pt.x(),
m_scrollOrigin.y() + pt.y());
}
diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
index 779eb36..bb17784 100644
--- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
@@ -557,10 +557,13 @@ void GraphicsLayerAndroid::updateScrollingLayers()
void GraphicsLayerAndroid::updateScrollOffset() {
RenderLayer* layer = renderLayerFromClient(m_client);
- if (!layer || !m_foregroundLayer)
+ if (!layer || !(m_foregroundLayer || m_contentLayer->contentIsScrollable()))
return;
IntSize scroll = layer->scrolledContentOffset();
- m_foregroundLayer->setScrollOffset(IntPoint(scroll.width(), scroll.height()));
+ if (m_foregroundLayer)
+ m_foregroundLayer->setScrollOffset(IntPoint(scroll.width(), scroll.height()));
+ else if (m_contentLayer->contentIsScrollable())
+ static_cast<ScrollableLayerAndroid*>(m_contentLayer)->scrollTo(scroll.width(), scroll.height());
askForSync();
}
@@ -637,10 +640,17 @@ bool GraphicsLayerAndroid::repaint()
m_foregroundLayer->markAsDirty(region);
m_foregroundLayer->needsRepaint();
} else {
+ // Paint at 0,0.
+ IntSize scroll = layer->scrolledContentOffset();
+ layer->scrollToOffset(0, 0);
// If there is no contents clip, we can draw everything into one
// picture.
- if (!paintContext(m_contentLayer->recordContext(), layerBounds))
+ bool painting = paintContext(m_contentLayer->recordContext(), layerBounds);
+ // Move back to the scroll offset
+ layer->scrollToOffset(scroll.width(), scroll.height());
+ if (!painting)
return false;
+ // We painted new content
m_contentLayer->checkForPictureOptimizations();
// Check for a scrollable iframe and report the scrolling
// limits based on the view size.
@@ -648,6 +658,9 @@ bool GraphicsLayerAndroid::repaint()
FrameView* view = layer->renderer()->frame()->view();
static_cast<ScrollableLayerAndroid*>(m_contentLayer)->setScrollLimits(
m_position.x(), m_position.y(), view->layoutWidth(), view->layoutHeight());
+ LOG("setScrollLimits(%.2f, %.2f, w: %d h: %d) layer %d, frame scroll position is %d, %d (%d, %d)",
+ m_position.x(), m_position.y(), view->layoutWidth(), view->layoutHeight(),
+ m_contentLayer->uniqueId(), view->scrollX(), view->scrollY(), view->actualScrollX(), view->actualScrollY());
}
}
diff --git a/Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.cpp
index 55692be..27a7df5 100644
--- a/Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.cpp
@@ -29,7 +29,6 @@ void ScrollableLayerAndroid::getScrollBounds(IntRect* out) const
out->setY(m_scrollLimits.fTop - pos.fY);
out->setWidth(getSize().width() - m_scrollLimits.width());
out->setHeight(getSize().height() - m_scrollLimits.height());
-
}
void ScrollableLayerAndroid::getScrollRect(SkIRect* out) const
diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp
index 0932224..66aab18 100644
--- a/Source/WebCore/rendering/RenderLayer.cpp
+++ b/Source/WebCore/rendering/RenderLayer.cpp
@@ -1390,11 +1390,27 @@ void RenderLayer::scrollTo(int x, int y)
view->updateWidgetPositions();
}
+#if PLATFORM(ANDROID)
+ GraphicsLayerAndroid* backingLayer = 0;
+ bool scrollableContent = false;
+#endif
+
#if USE(ACCELERATED_COMPOSITING)
if (compositor()->inCompositingMode()) {
// Our stacking context is guaranteed to contain all of our descendants that may need
// repositioning, so update compositing layers from there.
+#if ENABLE(ANDROID_OVERFLOW_SCROLL)
+ if (view && backing() && backing()->graphicsLayer()) {
+ backingLayer = static_cast<GraphicsLayerAndroid*>(backing()->graphicsLayer());
+ scrollableContent = backingLayer->contentLayer()
+ && backingLayer->contentLayer()->contentIsScrollable();
+ }
+ // If we have a scrollable content, no need to do this
+ RenderLayer* compositingAncestor = enclosingCompositingLayer();
+ if (!scrollableContent && compositingAncestor) {
+#else
if (RenderLayer* compositingAncestor = stackingContext()->enclosingCompositingLayer()) {
+#endif
if (compositor()->compositingConsultsOverlap())
compositor()->updateCompositingLayers(CompositingUpdateOnScroll, compositingAncestor);
else {
@@ -1423,10 +1439,10 @@ void RenderLayer::scrollTo(int x, int y)
#if ENABLE(ANDROID_OVERFLOW_SCROLL)
// On android, scrollable areas are put on composited layers, so we
// do not need to repaint simply because we are scrolling
- if (view && !hasOverflowScroll())
+ if (view && !(hasOverflowScroll() || scrollableContent))
renderer()->repaintUsingContainer(repaintContainer, rectForRepaint);
- if (view && hasOverflowScroll() && backing() && backing()->graphicsLayer())
- static_cast<GraphicsLayerAndroid*>(backing()->graphicsLayer())->updateScrollOffset();
+ if (backingLayer && (hasOverflowScroll() || scrollableContent))
+ backingLayer->updateScrollOffset();
#else
if (view)
renderer()->repaintUsingContainer(repaintContainer, rectForRepaint);
diff --git a/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp
index 0a4d828..b684a1a 100644
--- a/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp
+++ b/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp
@@ -35,6 +35,8 @@
#include "KeyGeneratorClient.h"
#include "MemoryUsage.h"
#include "PluginView.h"
+#include "RenderLayer.h"
+#include "RenderView.h"
#include "Settings.h"
#include "WebCookieJar.h"
#include "WebRequestContext.h"
@@ -171,6 +173,16 @@ void PlatformBridge::setScrollPosition(ScrollView* scrollView, int x, int y) {
android::WebViewCore *webViewCore = android::WebViewCore::getWebViewCore(scrollView);
if (webViewCore->mainFrame()->view() == scrollView)
webViewCore->scrollTo(x, y);
+ else {
+ FrameView* frameView = scrollView->frameView();
+ if (frameView) {
+ RenderView* renderer = frameView->frame()->contentRenderer();
+ if (renderer) {
+ RenderLayer* layer = renderer->layer();
+ layer->scrollToOffset(x, y);
+ }
+ }
+ }
}
int PlatformBridge::lowMemoryUsageMB()
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index 31e8506..b9a21de 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -4161,8 +4161,7 @@ void WebViewCore::scrollRenderLayer(int layer, const SkRect& rect)
if (!owner)
return;
- if (owner->stackingContext())
- owner->scrollToOffset(rect.fLeft, rect.fTop);
+ owner->scrollToOffset(rect.fLeft, rect.fTop);
#endif
}