https://bugs.webkit.org/show_bug.cgi?id=78753
<rdar://problem/
10866171>
Reviewed by Sam Weinig.
Replace ScrollingCoordinator::frameViewScrollLayerDidChange with a new member function,
ScrollingCoordinator::frameViewRootLayerDidChange which is called whenever the root layer
of the frame view changes (which happens on back/forward navigation as well).
In this function, reset the scrolling tree state from the frame view.
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::scrollLayerForFrameView):
Add a helper function.
(WebCore::ScrollingCoordinator::frameViewRootLayerDidChange):
Reset the entire scrolling tree state.
(WebCore::ScrollingCoordinator::updateMainFrameScrollPositionAndScrollLayerPosition):
Call the newly added helper function.
* page/scrolling/ScrollingCoordinator.h:
(ScrollingCoordinator):
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
Remove frameViewScrollLayerDidChange.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::ensureRootLayer):
Remove call to ScrollingCoordinator::frameViewScrollLayerDidChange.
(WebCore::RenderLayerCompositor::attachRootLayer):
Call ScrollingCoordinator::frameViewRootLayerDidChange.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107848
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-15 Anders Carlsson <andersca@apple.com>
+
+ Scrolling coordinator should handle pages being restored from the page cache
+ https://bugs.webkit.org/show_bug.cgi?id=78753
+ <rdar://problem/10866171>
+
+ Reviewed by Sam Weinig.
+
+ Replace ScrollingCoordinator::frameViewScrollLayerDidChange with a new member function,
+ ScrollingCoordinator::frameViewRootLayerDidChange which is called whenever the root layer
+ of the frame view changes (which happens on back/forward navigation as well).
+
+ In this function, reset the scrolling tree state from the frame view.
+
+ * page/scrolling/ScrollingCoordinator.cpp:
+ (WebCore::scrollLayerForFrameView):
+ Add a helper function.
+
+ (WebCore::ScrollingCoordinator::frameViewRootLayerDidChange):
+ Reset the entire scrolling tree state.
+
+ (WebCore::ScrollingCoordinator::updateMainFrameScrollPositionAndScrollLayerPosition):
+ Call the newly added helper function.
+
+ * page/scrolling/ScrollingCoordinator.h:
+ (ScrollingCoordinator):
+ * page/scrolling/mac/ScrollingCoordinatorMac.mm:
+ Remove frameViewScrollLayerDidChange.
+
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::ensureRootLayer):
+ Remove call to ScrollingCoordinator::frameViewScrollLayerDidChange.
+
+ (WebCore::RenderLayerCompositor::attachRootLayer):
+ Call ScrollingCoordinator::frameViewRootLayerDidChange.
+
2012-02-15 Enrica Casucci <enrica@apple.com>
Refactor ClipboardMac class to use PlatformStrategies.
updateShouldUpdateScrollLayerPositionOnMainThread();
}
+static GraphicsLayer* scrollLayerForFrameView(FrameView* frameView)
+{
+ Frame* frame = frameView->frame();
+ if (!frame)
+ return 0;
+
+ RenderView* renderView = frame->contentRenderer();
+ if (!renderView)
+ return 0;
+
+ return renderView->compositor()->scrollLayer();
+}
+
+void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView)
+{
+ ASSERT(isMainThread());
+ ASSERT(m_page);
+
+ if (frameView->frame() != m_page->mainFrame())
+ return;
+
+ frameViewLayoutUpdated(frameView);
+ recomputeWheelEventHandlerCount();
+ updateShouldUpdateScrollLayerPositionOnMainThread();
+ m_scrollingTreeState->setScrollLayer(scrollLayerForFrameView(frameView));
+
+ scheduleTreeStateCommit();
+}
+
bool ScrollingCoordinator::requestScrollPositionUpdate(FrameView* frameView, const IntPoint& scrollPosition)
{
ASSERT(isMainThread());
void ScrollingCoordinator::updateMainFrameScrollPositionAndScrollLayerPosition(const IntPoint& scrollPosition)
{
FrameView* frameView = m_page->mainFrame()->view();
-
- RenderView* renderView = m_page->mainFrame()->contentRenderer();
- if (!renderView)
- return;
-
- GraphicsLayer* scrollLayer = renderView->compositor()->scrollLayer();
+ GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView);
if (!scrollLayer)
return;
// so it can make sure they stay fixed even when we scroll on the scrolling thread.
void frameViewHasFixedObjectsDidChange(FrameView*);
- // Should be called whenever the scroll layer for the given frame view changes.
- void frameViewScrollLayerDidChange(FrameView*, const GraphicsLayer*);
+ // Should be called whenever the root layer for the given frame view changes.
+ void frameViewRootLayerDidChange(FrameView*);
// Should be called whenever the horizontal scrollbar layer for the given frame view changes.
void frameViewHorizontalScrollbarLayerDidChange(FrameView*, GraphicsLayer* horizontalScrollbarLayer);
// FIXME: Implement.
}
-void ScrollingCoordinator::frameViewScrollLayerDidChange(FrameView* frameView, const GraphicsLayer* scrollLayer)
-{
- ASSERT(isMainThread());
- ASSERT(m_page);
-
- if (frameView->frame() != m_page->mainFrame())
- return;
-
- m_scrollingTreeState->setScrollLayer(scrollLayer);
- scheduleTreeStateCommit();
-}
-
} // namespace WebCore
#endif // ENABLE(THREADED_SCROLLING)
frameViewDidChangeSize();
frameViewDidScroll();
-
-#if ENABLE(THREADED_SCROLLING)
- if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
- scrollingCoordinator->frameViewScrollLayerDidChange(m_renderView->frameView(), m_scrollLayer.get());
-#endif
}
} else {
if (m_overflowControlsHostLayer) {
break;
}
}
-
+
+#if ENABLE(THREADED_SCROLLING)
+ if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+ scrollingCoordinator->frameViewRootLayerDidChange(m_renderView->frameView());
+#endif
+
m_rootLayerAttachment = attachment;
rootLayerAttachmentChanged();
}