summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2012-03-01 17:58:10 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-03-01 17:58:10 -0800
commitf9aa763e9ad41bee64fbd834d1acf4a158e93a3e (patch)
tree8a916a7c54b10b76e79cd02b80f4a434b42747f9 /Source
parent1e0965438976cdf0f18c3594c0bc353c2cecfc6c (diff)
parent9a8423b643a8ce99e5642f2548600f9125382e89 (diff)
downloadexternal_webkit-f9aa763e9ad41bee64fbd834d1acf4a158e93a3e.zip
external_webkit-f9aa763e9ad41bee64fbd834d1acf4a158e93a3e.tar.gz
external_webkit-f9aa763e9ad41bee64fbd834d1acf4a158e93a3e.tar.bz2
Merge "Fix iframe, for reals!"
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/page/DOMWindow.cpp16
-rw-r--r--Source/WebCore/page/FrameView.cpp5
-rw-r--r--Source/WebCore/platform/ScrollView.cpp52
-rw-r--r--Source/WebCore/platform/ScrollView.h11
-rw-r--r--Source/WebCore/platform/android/ScrollViewAndroid.cpp28
-rw-r--r--Source/WebCore/platform/android/WidgetAndroid.cpp9
-rw-r--r--Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp21
-rw-r--r--Source/WebCore/platform/graphics/android/LayerAndroid.cpp1
-rw-r--r--Source/WebCore/platform/graphics/android/LayerAndroid.h4
-rw-r--r--Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.cpp27
-rw-r--r--Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp40
-rw-r--r--Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp6
-rw-r--r--Source/WebKit/android/jni/WebFrameView.cpp5
-rw-r--r--Source/WebKit/android/jni/WebFrameView.h2
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp26
15 files changed, 101 insertions, 152 deletions
diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp
index c7f162a..ee2206b 100644
--- a/Source/WebCore/page/DOMWindow.cpp
+++ b/Source/WebCore/page/DOMWindow.cpp
@@ -1095,11 +1095,7 @@ int DOMWindow::innerHeight() const
if (!view)
return 0;
-#if PLATFORM(ANDROID)
- return static_cast<int>(view->actualHeight() / m_frame->pageZoomFactor());
-#else
return static_cast<int>(view->height() / m_frame->pageZoomFactor());
-#endif
}
int DOMWindow::innerWidth() const
@@ -1111,11 +1107,7 @@ int DOMWindow::innerWidth() const
if (!view)
return 0;
-#if PLATFORM(ANDROID)
- return static_cast<int>(view->actualWidth() / m_frame->pageZoomFactor());
-#else
return static_cast<int>(view->width() / m_frame->pageZoomFactor());
-#endif
}
int DOMWindow::screenX() const
@@ -1153,11 +1145,7 @@ int DOMWindow::scrollX() const
m_frame->document()->updateLayoutIgnorePendingStylesheets();
-#if PLATFORM(ANDROID)
- return static_cast<int>(view->actualScrollX() / m_frame->pageZoomFactor());
-#else
return static_cast<int>(view->scrollX() / m_frame->pageZoomFactor());
-#endif
}
int DOMWindow::scrollY() const
@@ -1171,11 +1159,7 @@ int DOMWindow::scrollY() const
m_frame->document()->updateLayoutIgnorePendingStylesheets();
-#if PLATFORM(ANDROID)
- return static_cast<int>(view->actualScrollY() / m_frame->pageZoomFactor());
-#else
return static_cast<int>(view->scrollY() / m_frame->pageZoomFactor());
-#endif
}
bool DOMWindow::closed() const
diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp
index a79910b..f332074 100644
--- a/Source/WebCore/page/FrameView.cpp
+++ b/Source/WebCore/page/FrameView.cpp
@@ -1738,11 +1738,6 @@ void FrameView::scheduleRelayout()
if (!m_frame->document()->shouldScheduleLayout())
return;
-#ifdef ANDROID_FLATTEN_FRAMESET
- if (m_frame->ownerRenderer())
- m_frame->ownerRenderer()->setNeedsLayoutAndPrefWidthsRecalc();
-#endif
-
// When frame flattening is enabled, the contents of the frame affects layout of the parent frames.
// Also invalidate parent frame starting from the owner element of this frame.
if (m_frame->settings() && m_frame->settings()->frameFlatteningEnabled() && m_frame->ownerRenderer()) {
diff --git a/Source/WebCore/platform/ScrollView.cpp b/Source/WebCore/platform/ScrollView.cpp
index 58a1fbf..140c8e5 100644
--- a/Source/WebCore/platform/ScrollView.cpp
+++ b/Source/WebCore/platform/ScrollView.cpp
@@ -29,6 +29,10 @@
#include "AXObjectCache.h"
#if PLATFORM(ANDROID)
#include "FrameView.h"
+#include "GraphicsLayerAndroid.h"
+#include "RenderLayer.h"
+#include "RenderLayerBacking.h"
+#include "RenderView.h"
#endif
#include "GraphicsContext.h"
#include "GraphicsLayer.h"
@@ -304,34 +308,6 @@ void ScrollView::setContentsSize(const IntSize& newSize)
}
#if PLATFORM(ANDROID)
-int ScrollView::actualWidth() const
-{
- if (platformWidget())
- return platformActualWidth();
- return width();
-}
-
-int ScrollView::actualHeight() const
-{
- if (platformWidget())
- return platformActualHeight();
- return height();
-}
-
-int ScrollView::actualScrollX() const
-{
- if (platformWidget())
- return platformActualScrollX();
- return scrollX();
-}
-
-int ScrollView::actualScrollY() const
-{
- if (platformWidget())
- return platformActualScrollY();
- return scrollY();
-}
-
FrameView* ScrollView::frameView() {
if (this->isFrameView()) {
FrameView* frameView = reinterpret_cast<FrameView*>(this);
@@ -397,6 +373,26 @@ void ScrollView::scrollTo(const IntSize& newOffset)
return;
m_scrollOffset = newOffset;
+#if PLATFORM(ANDROID)
+ if (parent()) {
+ FrameView* frameView = this->frameView();
+ // IFrames are composited on a layer, we do not need to repaint them
+ // when scrolling
+ if (frameView) {
+ RenderView* renderer = frameView->frame()->contentRenderer();
+ if (renderer) {
+ RenderLayer* layer = renderer->layer();
+ if (layer->backing()) {
+ GraphicsLayerAndroid* backing = static_cast<GraphicsLayerAndroid*>(
+ layer->backing()->graphicsLayer());
+ backing->updateScrollOffset();
+ }
+ }
+ return;
+ }
+ }
+#endif
+
if (scrollbarsSuppressed())
return;
diff --git a/Source/WebCore/platform/ScrollView.h b/Source/WebCore/platform/ScrollView.h
index 3228870..e58d025 100644
--- a/Source/WebCore/platform/ScrollView.h
+++ b/Source/WebCore/platform/ScrollView.h
@@ -172,10 +172,6 @@ public:
virtual void setContentsSize(const IntSize&);
#if PLATFORM(ANDROID)
- int actualWidth() const;
- int actualHeight() const;
- int actualScrollX() const;
- int actualScrollY() const;
FrameView* frameView();
#endif
@@ -405,13 +401,6 @@ private:
void platformSetScrollOrigin(const IntPoint&, bool updatePositionAtAll, bool updatePositionSynchronously);
-#if PLATFORM(ANDROID)
- int platformActualWidth() const;
- int platformActualHeight() const;
- int platformActualScrollX() const;
- int platformActualScrollY() const;
-#endif
-
#if PLATFORM(MAC) && defined __OBJC__
public:
NSView* documentView() const;
diff --git a/Source/WebCore/platform/android/ScrollViewAndroid.cpp b/Source/WebCore/platform/android/ScrollViewAndroid.cpp
index 8df0c2f..ecaa2b5 100644
--- a/Source/WebCore/platform/android/ScrollViewAndroid.cpp
+++ b/Source/WebCore/platform/android/ScrollViewAndroid.cpp
@@ -68,34 +68,6 @@ IntSize ScrollView::platformContentsSize() const
return m_contentsSize;
}
-int ScrollView::platformActualWidth() const
-{
- if (parent())
- return width();
- return platformWidget()->visibleWidth();
-}
-
-int ScrollView::platformActualHeight() const
-{
- if (parent())
- return height();
- return platformWidget()->visibleHeight();
-}
-
-int ScrollView::platformActualScrollX() const
-{
- if (parent())
- return scrollX();
- return platformWidget()->visibleX();
-}
-
-int ScrollView::platformActualScrollY() const
-{
- if (parent())
- return scrollY();
- return platformWidget()->visibleY();
-}
-
void ScrollView::platformSetScrollPosition(const WebCore::IntPoint& pt)
{
PlatformBridge::setScrollPosition(this, m_scrollOrigin.x() + pt.x(),
diff --git a/Source/WebCore/platform/android/WidgetAndroid.cpp b/Source/WebCore/platform/android/WidgetAndroid.cpp
index 10326f9..0f7758d 100644
--- a/Source/WebCore/platform/android/WidgetAndroid.cpp
+++ b/Source/WebCore/platform/android/WidgetAndroid.cpp
@@ -49,9 +49,7 @@ Widget::~Widget()
IntRect Widget::frameRect() const
{
- if (!platformWidget())
- return m_frame;
- return platformWidget()->getBounds();
+ return m_frame;
}
void Widget::setFocus(bool focused)
@@ -95,11 +93,6 @@ void Widget::hide()
void Widget::setFrameRect(const IntRect& rect)
{
m_frame = rect;
- // platformWidget() is 0 when called from Scrollbar
- if (!platformWidget())
- return;
- platformWidget()->setLocation(rect.x(), rect.y());
- platformWidget()->setSize(rect.width(), rect.height());
}
void Widget::setIsSelected(bool isSelected)
diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
index bb17784..c50f6a6 100644
--- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
@@ -519,6 +519,7 @@ void GraphicsLayerAndroid::updateScrollingLayers()
m_contentLayer->removeChildren();
// Replace the content layer with a scrollable layer.
LayerAndroid* layer = new ScrollableLayerAndroid(*m_contentLayer);
+ layer->setIsIframe(true);
m_contentLayer->unref();
m_contentLayer = layer;
if (m_parent) {
@@ -559,11 +560,14 @@ void GraphicsLayerAndroid::updateScrollOffset() {
RenderLayer* layer = renderLayerFromClient(m_client);
if (!layer || !(m_foregroundLayer || m_contentLayer->contentIsScrollable()))
return;
- IntSize scroll = layer->scrolledContentOffset();
- if (m_foregroundLayer)
+ if (m_foregroundLayer) {
+ IntSize scroll = layer->scrolledContentOffset();
m_foregroundLayer->setScrollOffset(IntPoint(scroll.width(), scroll.height()));
- else if (m_contentLayer->contentIsScrollable())
- static_cast<ScrollableLayerAndroid*>(m_contentLayer)->scrollTo(scroll.width(), scroll.height());
+ } else if (m_contentLayer->contentIsScrollable()) {
+ IntPoint p(layer->renderer()->frame()->view()->scrollX(),
+ layer->renderer()->frame()->view()->scrollY());
+ static_cast<ScrollableLayerAndroid*>(m_contentLayer)->setIFrameScrollOffset(p);
+ }
askForSync();
}
@@ -640,14 +644,9 @@ 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.
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
@@ -658,9 +657,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)",
+ LOG("setScrollLimits(%.2f, %.2f, w: %d h: %d) layer %d, frame scroll position is %d, %d",
m_position.x(), m_position.y(), view->layoutWidth(), view->layoutHeight(),
- m_contentLayer->uniqueId(), view->scrollX(), view->scrollY(), view->actualScrollX(), view->actualScrollY());
+ m_contentLayer->uniqueId(), view->scrollX(), view->scrollY());
}
}
diff --git a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp
index 4e45846..e6a79ce 100644
--- a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp
@@ -120,6 +120,7 @@ LayerAndroid::LayerAndroid(const LayerAndroid& layer) : Layer(layer),
m_fixedRect = layer.m_fixedRect;
m_iframeOffset = layer.m_iframeOffset;
m_offset = layer.m_offset;
+ m_iframeScrollOffset = layer.m_iframeScrollOffset;
m_recordingPicture = layer.m_recordingPicture;
SkSafeRef(m_recordingPicture);
diff --git a/Source/WebCore/platform/graphics/android/LayerAndroid.h b/Source/WebCore/platform/graphics/android/LayerAndroid.h
index 2361e62..9dbe7fa 100644
--- a/Source/WebCore/platform/graphics/android/LayerAndroid.h
+++ b/Source/WebCore/platform/graphics/android/LayerAndroid.h
@@ -194,7 +194,9 @@ public:
}
const IntPoint& scrollOffset() const { return m_offset; }
+ const IntPoint& iframeScrollOffset() const { return m_iframeScrollOffset; }
void setScrollOffset(IntPoint offset) { m_offset = offset; }
+ void setIFrameScrollOffset(IntPoint offset) { m_iframeScrollOffset = offset; }
void setBackgroundColor(SkColor color);
void setMaskLayer(LayerAndroid*);
void setMasksToBounds(bool masksToBounds)
@@ -279,6 +281,7 @@ public:
RenderLayer* owningLayer() const { return m_owningLayer; }
void setIsIframe(bool isIframe) { m_isIframe = isIframe; }
+ bool isIFrame() const { return m_isIframe; }
float zValue() const { return m_zValue; }
// ViewStateSerializer friends
@@ -311,6 +314,7 @@ public:
protected:
virtual void onDraw(SkCanvas*, SkScalar opacity, android::DrawExtra* extra);
IntPoint m_offset;
+ IntPoint m_iframeScrollOffset;
TransformationMatrix m_drawTransform;
private:
diff --git a/Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.cpp
index 27a7df5..ab7f566 100644
--- a/Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.cpp
@@ -5,6 +5,11 @@
#if USE(ACCELERATED_COMPOSITING)
+#include <wtf/CurrentTime.h>
+#include <cutils/log.h>
+#include <wtf/text/CString.h>
+#define XLOGC(...) android_printLog(ANDROID_LOG_DEBUG, "ScrollableLayerAndroid", __VA_ARGS__)
+
namespace WebCore {
bool ScrollableLayerAndroid::scrollTo(int x, int y)
@@ -16,8 +21,15 @@ bool ScrollableLayerAndroid::scrollTo(int x, int y)
SkScalar newX = SkScalarPin(x, scrollBounds.x(), scrollBounds.width());
SkScalar newY = SkScalarPin(y, scrollBounds.y(), scrollBounds.height());
// Check for no change.
- if (newX == m_offset.x() && newY == m_offset.y())
- return false;
+ if (isIFrame()) {
+ if (newX == m_iframeScrollOffset.x() && newY == m_iframeScrollOffset.y())
+ return false;
+ newX = newX - m_iframeScrollOffset.x();
+ newY = newY - m_iframeScrollOffset.y();
+ } else {
+ if (newX == m_offset.x() && newY == m_offset.y())
+ return false;
+ }
setScrollOffset(IntPoint(newX, newY));
return true;
}
@@ -34,8 +46,17 @@ void ScrollableLayerAndroid::getScrollBounds(IntRect* out) const
void ScrollableLayerAndroid::getScrollRect(SkIRect* out) const
{
const SkPoint& pos = getPosition();
- out->fLeft = m_scrollLimits.fLeft - pos.fX + m_offset.x();
+ out->fLeft = m_scrollLimits.fLeft - pos.fX;
out->fTop = m_scrollLimits.fTop - pos.fY + m_offset.y();
+
+ if (isIFrame()) {
+ out->fLeft += m_iframeScrollOffset.x();
+ out->fTop += m_iframeScrollOffset.y();
+ } else {
+ out->fLeft += m_offset.x();
+ out->fTop += m_offset.y();
+ }
+
out->fRight = getSize().width() - m_scrollLimits.width();
out->fBottom = getSize().height() - m_scrollLimits.height();
}
diff --git a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
index c573b4e..d7c21e3 100644
--- a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
+++ b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
@@ -946,10 +946,10 @@ void FrameLoaderClientAndroid::transitionToCommittedForNewPage() {
// Save the old WebFrameView's bounds and apply them to the new WebFrameView
WebFrameView* oldWebFrameView = static_cast<WebFrameView*> (m_frame->view()->platformWidget());
- IntRect bounds = oldWebFrameView->getBounds();
- IntRect visBounds = oldWebFrameView->getVisibleBounds();
- IntRect windowBounds = oldWebFrameView->getWindowBounds();
- WebCore::FrameView* oldFrameView = oldWebFrameView->view();
+ IntRect bounds;
+ if (oldWebFrameView)
+ bounds = oldWebFrameView->getBounds();
+ WebCore::FrameView* oldFrameView = m_frame->view();
const float oldZoomFactor = oldFrameView->frame()->textZoomFactor();
m_frame->createView(bounds.size(), oldFrameView->baseBackgroundColor(), oldFrameView->isTransparent(),
oldFrameView->fixedLayoutSize(), oldFrameView->useFixedLayout());
@@ -957,21 +957,19 @@ void FrameLoaderClientAndroid::transitionToCommittedForNewPage() {
m_frame->setTextZoomFactor(oldZoomFactor);
}
- // Create a new WebFrameView for the new FrameView
- WebFrameView* newFrameView = new WebFrameView(m_frame->view(), webViewCore);
-
-#if ENABLE(ANDROID_OVERFLOW_SCROLL)
-#else
- webViewCore->clearContent();
-#endif
-
- newFrameView->setLocation(bounds.x(), bounds.y());
- newFrameView->setSize(bounds.width(), bounds.height());
- newFrameView->setVisibleSize(visBounds.width(), visBounds.height());
- newFrameView->setWindowBounds(windowBounds.x(), windowBounds.y(), windowBounds.width(), windowBounds.height());
- // newFrameView attaches itself to FrameView which Retains the reference, so
- // call Release for newFrameView
- Release(newFrameView);
+ if (oldWebFrameView) {
+ IntRect visBounds = oldWebFrameView->getVisibleBounds();
+ IntRect windowBounds = oldWebFrameView->getWindowBounds();
+ // Create a new WebFrameView for the new FrameView
+ WebFrameView* newFrameView = new WebFrameView(m_frame->view(), webViewCore);
+ newFrameView->setLocation(bounds.x(), bounds.y());
+ newFrameView->setSize(bounds.width(), bounds.height());
+ newFrameView->setVisibleSize(visBounds.width(), visBounds.height());
+ newFrameView->setWindowBounds(windowBounds.x(), windowBounds.y(), windowBounds.width(), windowBounds.height());
+ // newFrameView attaches itself to FrameView which Retains the reference, so
+ // call Release for newFrameView
+ Release(newFrameView);
+ }
// WebFrameView Retains webViewCore, so call Release for webViewCore
Release(webViewCore);
@@ -1007,10 +1005,6 @@ WTF::PassRefPtr<WebCore::Frame> FrameLoaderClientAndroid::createFrame(const KURL
newFrame->tree()->setName(name);
// Create a new FrameView and WebFrameView for the child frame to draw into.
RefPtr<FrameView> frameView = FrameView::create(newFrame);
- WebFrameView* webFrameView = new WebFrameView(frameView.get(),
- WebViewCore::getWebViewCore(parent->view()));
- // frameView Retains webFrameView, so call Release for webFrameView
- Release(webFrameView);
// Attach the frameView to the newFrame.
newFrame->setView(frameView);
newFrame->init();
diff --git a/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp
index e536701..000cd5a 100644
--- a/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp
+++ b/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp
@@ -181,12 +181,6 @@ void PlatformBridge::setScrollPosition(ScrollView* scrollView, int x, int y) {
y = std::max(0, std::min(frameView->contentsHeight(), y));
if ((x != visibleContentRect.x()) || (y != visibleContentRect.y()))
webViewCore->scrollTo(x, y);
- } else {
- RenderView* renderer = frameView->frame()->contentRenderer();
- if (renderer) {
- RenderLayer* layer = renderer->layer();
- layer->scrollToOffset(x, y);
- }
}
}
diff --git a/Source/WebKit/android/jni/WebFrameView.cpp b/Source/WebKit/android/jni/WebFrameView.cpp
index 8e5eac4..a9b90cb 100644
--- a/Source/WebKit/android/jni/WebFrameView.cpp
+++ b/Source/WebKit/android/jni/WebFrameView.cpp
@@ -96,9 +96,4 @@ void WebFrameView::draw(WebCore::GraphicsContext* ctx, const WebCore::IntRect& r
}
}
-void WebFrameView::setView(WebCore::FrameView* frameView) {
- mFrameView = frameView;
- mFrameView->setPlatformWidget(this);
-}
-
} // namespace android
diff --git a/Source/WebKit/android/jni/WebFrameView.h b/Source/WebKit/android/jni/WebFrameView.h
index 117b603..ac81afe 100644
--- a/Source/WebKit/android/jni/WebFrameView.h
+++ b/Source/WebKit/android/jni/WebFrameView.h
@@ -47,8 +47,6 @@ namespace android {
return mWebViewCore;
}
- void setView(WebCore::FrameView* frameView);
-
WebCore::FrameView* view() const {
return mFrameView;
}
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index 1351d8f..443f2ca 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -536,18 +536,27 @@ WebViewCore::~WebViewCore()
WebViewCore* WebViewCore::getWebViewCore(const WebCore::FrameView* view)
{
- return getWebViewCore(static_cast<const WebCore::ScrollView*>(view));
+ if (!view)
+ return 0;
+ Frame* frame = view->frame();
+ while (Frame* parent = frame->tree()->parent())
+ frame = parent;
+ WebFrameView* webFrameView = 0;
+ if (frame && frame->view())
+ webFrameView = static_cast<WebFrameView*>(frame->view()->platformWidget());
+ if (!webFrameView)
+ return 0;
+ return webFrameView->webViewCore();
}
WebViewCore* WebViewCore::getWebViewCore(const WebCore::ScrollView* view)
{
if (!view)
return 0;
-
- WebFrameView* webFrameView = static_cast<WebFrameView*>(view->platformWidget());
- if (!webFrameView)
+ FrameView* frameView = static_cast<FrameView*>(view->root());
+ if (!frameView)
return 0;
- return webFrameView->webViewCore();
+ return getWebViewCore(frameView);
}
static bool layoutIfNeededRecursive(WebCore::Frame* f)
@@ -3997,7 +4006,12 @@ void WebViewCore::scrollRenderLayer(int layer, const SkRect& rect)
if (!owner)
return;
- owner->scrollToOffset(rect.fLeft, rect.fTop);
+ if (owner->isRootLayer()) {
+ FrameView* view = owner->renderer()->frame()->view();
+ IntPoint pt(rect.fLeft, rect.fTop);
+ view->setScrollPosition(pt);
+ } else
+ owner->scrollToOffset(rect.fLeft, rect.fTop);
#endif
}