Diff
Modified: trunk/Source/WebCore/ChangeLog (150042 => 150043)
--- trunk/Source/WebCore/ChangeLog 2013-05-13 23:11:08 UTC (rev 150042)
+++ trunk/Source/WebCore/ChangeLog 2013-05-13 23:16:01 UTC (rev 150043)
@@ -1,3 +1,74 @@
+2013-05-13 Beth Dakin <[email protected]>
+
+ Headers and footers should be pinned to the left edge of the window when scrolling
+ horizontally
+ https://bugs.webkit.org/show_bug.cgi?id=116061
+ -and corresponding-
+ <rdar://problem/13599215>
+
+ Reviewed by Simon Fraser.
+
+ The scrolling thread will need to know about the header and footer layers in order
+ the implement this custom scrolling behavior.
+
+ These getters will fetch the header or footer layer from the FrameView as
+ appropriate.
+ * page/scrolling/ScrollingCoordinator.cpp:
+ (WebCore::ScrollingCoordinator::headerLayerForFrameView):
+ (WebCore::ScrollingCoordinator::footerLayerForFrameView):
+ * page/scrolling/ScrollingCoordinator.h:
+
+ When we’re scrolling on the main thread, adjust the position of the header and
+ footer layers here.
+ (WebCore::ScrollingCoordinator::updateMainFrameScrollPosition):
+
+ ScrollingStateScrollingNode now stores GraphicsLayers and PlatformLayers for the
+ header and footer, just like it already does for the counterScrollingLayer.
+ * page/scrolling/ScrollingStateScrollingNode.cpp:
+ (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
+ * page/scrolling/ScrollingStateScrollingNode.h:
+ (ScrollingStateScrollingNode):
+ (WebCore::ScrollingStateScrollingNode::headerLayer):
+ (WebCore::ScrollingStateScrollingNode::footerLayer):
+
+ Setters for the new layers.
+ * page/scrolling/mac/ScrollingCoordinatorMac.h:
+ (ScrollingCoordinatorMac):
+ * page/scrolling/mac/ScrollingCoordinatorMac.mm:
+ (WebCore::ScrollingCoordinatorMac::frameViewRootLayerDidChange):
+ (WebCore::ScrollingCoordinatorMac::setHeaderLayerForNode):
+ (WebCore::ScrollingCoordinatorMac::setFooterLayerForNode):
+
+ These setters and getters mirror the existing one for counterScrollingLayer.
+ * page/scrolling/mac/ScrollingStateScrollingNodeMac.mm:
+ (WebCore::ScrollingStateScrollingNode::headerPlatformLayer):
+ (WebCore::ScrollingStateScrollingNode::setHeaderLayer):
+ (WebCore::ScrollingStateScrollingNode::footerPlatformLayer):
+ (WebCore::ScrollingStateScrollingNode::setFooterLayer):
+
+ And the ScrollingTree will store CALayers for the header and footer.
+ * page/scrolling/mac/ScrollingTreeScrollingNodeMac.h:
+ (ScrollingTreeScrollingNodeMac):
+ * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
+ (WebCore::ScrollingTreeScrollingNodeMac::updateBeforeChildren):
+
+ This is where the magic happens when we are scrolling on the scrolling thread.
+ Adjust the horizontal position the behave like a fixed object, but keep the
+ vertical position what it was when layer was created.
+ (WebCore::ScrollingTreeScrollingNodeMac::setScrollLayerPosition):
+
+ RenderLayerCompositor must now provide getters for the header and footer.
+ * rendering/RenderLayerCompositor.h:
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::headerLayer):
+ (WebCore::RenderLayerCompositor::footerLayer):
+
+ Set the anchor point for when we adjust the position later on. Also call
+ frameViewRootLayerDidChange() to get the new layers picked up and sent to the
+ scrolling tree.
+ (WebCore::RenderLayerCompositor::updateLayerForHeader):
+ (WebCore::RenderLayerCompositor::updateLayerForFooter):
+
2013-05-12 Timothy Hatcher <[email protected]>
Add support for updating the Web Inspector toolbar height.
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (150042 => 150043)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp 2013-05-13 23:11:08 UTC (rev 150042)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp 2013-05-13 23:16:01 UTC (rev 150043)
@@ -307,6 +307,41 @@
#endif
}
+GraphicsLayer* ScrollingCoordinator::headerLayerForFrameView(FrameView* frameView)
+{
+#if USE(ACCELERATED_COMPOSITING) && ENABLE(RUBBER_BANDING)
+ Frame* frame = frameView->frame();
+ if (!frame)
+ return 0;
+
+ RenderView* renderView = frame->contentRenderer();
+ if (!renderView)
+ return 0;
+
+ return renderView->compositor()->headerLayer();
+#else
+ UNUSED_PARAM(frameView);
+ return 0;
+#endif
+}
+
+GraphicsLayer* ScrollingCoordinator::footerLayerForFrameView(FrameView* frameView)
+{
+#if USE(ACCELERATED_COMPOSITING) && ENABLE(RUBBER_BANDING)
+ Frame* frame = frameView->frame();
+ if (!frame)
+ return 0;
+
+ RenderView* renderView = frame->contentRenderer();
+ if (!renderView)
+ return 0;
+ return renderView->compositor()->footerLayer();
+#else
+ UNUSED_PARAM(frameView);
+ return 0;
+#endif
+}
+
GraphicsLayer* ScrollingCoordinator::counterScrollingLayerForFrameView(FrameView* frameView)
{
#if USE(ACCELERATED_COMPOSITING)
@@ -387,14 +422,26 @@
#if USE(ACCELERATED_COMPOSITING)
if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) {
GraphicsLayer* counterScrollingLayer = counterScrollingLayerForFrameView(frameView);
+ GraphicsLayer* headerLayer = headerLayerForFrameView(frameView);
+ GraphicsLayer* footerLayer = footerLayerForFrameView(frameView);
+ IntSize scrollOffsetForFixed = frameView->scrollOffsetForFixedPosition();
+
if (programmaticScroll || scrollingLayerPositionAction == SetScrollingLayerPosition) {
scrollLayer->setPosition(-frameView->scrollPosition());
if (counterScrollingLayer)
- counterScrollingLayer->setPosition(IntPoint(frameView->scrollOffsetForFixedPosition()));
+ counterScrollingLayer->setPosition(IntPoint(scrollOffsetForFixed));
+ if (headerLayer)
+ headerLayer->setPosition(FloatPoint(scrollOffsetForFixed.width(), 0));
+ if (footerLayer)
+ footerLayer->setPosition(FloatPoint(scrollOffsetForFixed.width(), frameView->totalContentsSize().height() - frameView->footerHeight()));
} else {
scrollLayer->syncPosition(-frameView->scrollPosition());
if (counterScrollingLayer)
- counterScrollingLayer->syncPosition(IntPoint(frameView->scrollOffsetForFixedPosition()));
+ counterScrollingLayer->syncPosition(IntPoint(scrollOffsetForFixed));
+ if (headerLayer)
+ headerLayer->syncPosition(FloatPoint(scrollOffsetForFixed.width(), 0));
+ if (footerLayer)
+ footerLayer->syncPosition(FloatPoint(scrollOffsetForFixed.width(), frameView->totalContentsSize().height() - frameView->footerHeight()));
LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect();
syncChildPositions(viewportRect);
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (150042 => 150043)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2013-05-13 23:11:08 UTC (rev 150042)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2013-05-13 23:16:01 UTC (rev 150043)
@@ -177,6 +177,8 @@
unsigned computeCurrentWheelEventHandlerCount();
GraphicsLayer* scrollLayerForFrameView(FrameView*);
GraphicsLayer* counterScrollingLayerForFrameView(FrameView*);
+ GraphicsLayer* headerLayerForFrameView(FrameView*);
+ GraphicsLayer* footerLayerForFrameView(FrameView*);
Page* m_page;
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp (150042 => 150043)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp 2013-05-13 23:11:08 UTC (rev 150042)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp 2013-05-13 23:16:01 UTC (rev 150043)
@@ -42,6 +42,8 @@
ScrollingStateScrollingNode::ScrollingStateScrollingNode(ScrollingStateTree* stateTree, ScrollingNodeID nodeID)
: ScrollingStateNode(stateTree, nodeID)
, m_counterScrollingLayer(0)
+ , m_headerLayer(0)
+ , m_footerLayer(0)
, m_frameScaleFactor(1)
, m_wheelEventHandlerCount(0)
, m_shouldUpdateScrollLayerPositionOnMainThread(0)
@@ -78,6 +80,8 @@
, m_footerHeight(stateNode.footerHeight())
{
setCounterScrollingLayer(stateNode.counterScrollingLayer());
+ setHeaderLayer(stateNode.headerLayer());
+ setFooterLayer(stateNode.footerLayer());
}
ScrollingStateScrollingNode::~ScrollingStateScrollingNode()
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h (150042 => 150043)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h 2013-05-13 23:11:08 UTC (rev 150042)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h 2013-05-13 23:16:01 UTC (rev 150043)
@@ -62,7 +62,9 @@
RequestedScrollPosition,
CounterScrollingLayer,
HeaderHeight,
- FooterHeight
+ FooterHeight,
+ HeaderLayer,
+ FooterLayer
};
virtual bool isScrollingNode() OVERRIDE { return true; }
@@ -120,6 +122,16 @@
void setCounterScrollingLayer(GraphicsLayer*);
PlatformLayer* counterScrollingPlatformLayer() const;
+ // The header and footer layers scroll vertically with the page, they should remain fixed when scrolling horizontally.
+ GraphicsLayer* headerLayer() const { return m_headerLayer; }
+ void setHeaderLayer(GraphicsLayer*);
+ PlatformLayer* headerPlatformLayer() const;
+
+ // The header and footer layers scroll vertically with the page, they should remain fixed when scrolling horizontally.
+ GraphicsLayer* footerLayer() const { return m_footerLayer; }
+ void setFooterLayer(GraphicsLayer*);
+ PlatformLayer* footerPlatformLayer() const;
+
bool requestedScrollPositionRepresentsProgrammaticScroll() const { return m_requestedScrollPositionRepresentsProgrammaticScroll; }
virtual void dumpProperties(TextStream&, int indent) const OVERRIDE;
@@ -129,8 +141,12 @@
ScrollingStateScrollingNode(const ScrollingStateScrollingNode&);
GraphicsLayer* m_counterScrollingLayer;
+ GraphicsLayer* m_headerLayer;
+ GraphicsLayer* m_footerLayer;
#if PLATFORM(MAC)
RetainPtr<PlatformLayer> m_counterScrollingPlatformLayer;
+ RetainPtr<PlatformLayer> m_headerPlatformLayer;
+ RetainPtr<PlatformLayer> m_footerPlatformLayer;
#endif
IntRect m_viewportRect;
Modified: trunk/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateScrollingNodeCoordinatedGraphics.cpp (150042 => 150043)
--- trunk/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateScrollingNodeCoordinatedGraphics.cpp 2013-05-13 23:11:08 UTC (rev 150042)
+++ trunk/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateScrollingNodeCoordinatedGraphics.cpp 2013-05-13 23:16:01 UTC (rev 150043)
@@ -43,6 +43,28 @@
ASSERT_NOT_REACHED(); // ScrollingStateTree in coord graphics is used only to handle constrained elements.
}
+PlatformLayer* ScrollingStateScrollingNode::headerPlatformLayer() const
+{
+ ASSERT_NOT_REACHED(); // ScrollingStateTree in coord graphics is used only to handle constrained elements.
+ return 0;
+}
+
+void ScrollingStateScrollingNode::setHeaderLayer(GraphicsLayer*)
+{
+ ASSERT_NOT_REACHED(); // ScrollingStateTree in coord graphics is used only to handle constrained elements.
+}
+
+PlatformLayer* ScrollingStateScrollingNode::footerPlatformLayer() const
+{
+ ASSERT_NOT_REACHED(); // ScrollingStateTree in coord graphics is used only to handle constrained elements.
+ return 0;
+}
+
+void ScrollingStateScrollingNode::setFooterLayer(GraphicsLayer*)
+{
+ ASSERT_NOT_REACHED(); // ScrollingStateTree in coord graphics is used only to handle constrained elements.
+}
+
} // namespace WebCore
#endif // USE(COORDINATED_GRAPHICS)
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h (150042 => 150043)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h 2013-05-13 23:11:08 UTC (rev 150042)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h 2013-05-13 23:16:01 UTC (rev 150043)
@@ -122,6 +122,8 @@
void setScrollParametersForNode(const ScrollParameters&, ScrollingStateScrollingNode*);
void setScrollLayerForNode(GraphicsLayer*, ScrollingStateNode*);
void setCounterScrollingLayerForNode(GraphicsLayer*, ScrollingStateScrollingNode*);
+ void setHeaderLayerForNode(GraphicsLayer*, ScrollingStateScrollingNode*);
+ void setFooterLayerForNode(GraphicsLayer*, ScrollingStateScrollingNode*);
void setNonFastScrollableRegionForNode(const Region&, ScrollingStateScrollingNode*);
void setWheelEventHandlerCountForNode(unsigned, ScrollingStateScrollingNode*);
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm (150042 => 150043)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm 2013-05-13 23:11:08 UTC (rev 150042)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm 2013-05-13 23:16:01 UTC (rev 150043)
@@ -190,6 +190,8 @@
ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree->stateNodeForID(frameView->scrollLayerID()));
setScrollLayerForNode(scrollLayerForFrameView(frameView), node);
setCounterScrollingLayerForNode(counterScrollingLayerForFrameView(frameView), node);
+ setHeaderLayerForNode(headerLayerForFrameView(frameView), node);
+ setFooterLayerForNode(footerLayerForFrameView(frameView), node);
}
void ScrollingCoordinatorMac::scrollableAreaScrollbarLayerDidChange(ScrollableArea* scrollableArea, ScrollbarOrientation)
@@ -274,6 +276,24 @@
scheduleTreeStateCommit();
}
+void ScrollingCoordinatorMac::setHeaderLayerForNode(GraphicsLayer* headerLayer, ScrollingStateScrollingNode* node)
+{
+ // Headers and footers are only supported on the root node.
+ ASSERT(node == m_scrollingStateTree->rootStateNode());
+
+ node->setHeaderLayer(headerLayer);
+ scheduleTreeStateCommit();
+}
+
+void ScrollingCoordinatorMac::setFooterLayerForNode(GraphicsLayer* footerLayer, ScrollingStateScrollingNode* node)
+{
+ // Headers and footers are only supported on the root node.
+ ASSERT(node == m_scrollingStateTree->rootStateNode());
+
+ node->setFooterLayer(footerLayer);
+ scheduleTreeStateCommit();
+}
+
void ScrollingCoordinatorMac::setNonFastScrollableRegionForNode(const Region& region, ScrollingStateScrollingNode* node)
{
node->setNonFastScrollableRegion(region);
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingStateScrollingNodeMac.mm (150042 => 150043)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingStateScrollingNodeMac.mm 2013-05-13 23:11:08 UTC (rev 150042)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingStateScrollingNodeMac.mm 2013-05-13 23:16:01 UTC (rev 150043)
@@ -52,6 +52,44 @@
m_scrollingStateTree->setHasChangedProperties(true);
}
+PlatformLayer* ScrollingStateScrollingNode::headerPlatformLayer() const
+{
+ return m_headerPlatformLayer.get();
+}
+
+void ScrollingStateScrollingNode::setHeaderLayer(GraphicsLayer* graphicsLayer)
+{
+ PlatformLayer* platformHeaderLayer = graphicsLayer ? graphicsLayer->platformLayer() : nil;
+ if (m_headerPlatformLayer == platformHeaderLayer)
+ return;
+
+ m_headerPlatformLayer = platformHeaderLayer;
+ m_headerLayer = graphicsLayer;
+
+ setPropertyChanged(HeaderLayer);
+ if (m_scrollingStateTree)
+ m_scrollingStateTree->setHasChangedProperties(true);
+}
+
+PlatformLayer* ScrollingStateScrollingNode::footerPlatformLayer() const
+{
+ return m_footerPlatformLayer.get();
+}
+
+void ScrollingStateScrollingNode::setFooterLayer(GraphicsLayer* graphicsLayer)
+{
+ PlatformLayer* platformFooterLayer = graphicsLayer ? graphicsLayer->platformLayer() : nil;
+ if (m_footerPlatformLayer == platformFooterLayer)
+ return;
+
+ m_footerPlatformLayer = platformFooterLayer;
+ m_footerLayer = graphicsLayer;
+
+ setPropertyChanged(FooterLayer);
+ if (m_scrollingStateTree)
+ m_scrollingStateTree->setHasChangedProperties(true);
+}
+
} // namespace WebCore
#endif // ENABLE(THREADED_SCROLLING)
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h (150042 => 150043)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h 2013-05-13 23:11:08 UTC (rev 150042)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h 2013-05-13 23:16:01 UTC (rev 150043)
@@ -82,6 +82,8 @@
RetainPtr<CALayer> m_scrollLayer;
RetainPtr<CALayer> m_counterScrollingLayer;
+ RetainPtr<CALayer> m_headerLayer;
+ RetainPtr<CALayer> m_footerLayer;
IntPoint m_probableMainThreadScrollPosition;
bool m_lastScrollHadUnfilledPixels;
};
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm (150042 => 150043)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm 2013-05-13 23:11:08 UTC (rev 150042)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm 2013-05-13 23:16:01 UTC (rev 150043)
@@ -77,6 +77,12 @@
if (scrollingStateNode->hasChangedProperty(ScrollingStateScrollingNode::CounterScrollingLayer))
m_counterScrollingLayer = scrollingStateNode->counterScrollingPlatformLayer();
+ if (scrollingStateNode->hasChangedProperty(ScrollingStateScrollingNode::HeaderLayer))
+ m_headerLayer = scrollingStateNode->headerPlatformLayer();
+
+ if (scrollingStateNode->hasChangedProperty(ScrollingStateScrollingNode::FooterLayer))
+ m_footerLayer = scrollingStateNode->footerPlatformLayer();
+
if (scrollingStateNode->hasChangedProperty(ScrollingStateScrollingNode::ShouldUpdateScrollLayerPositionOnMainThread)) {
unsigned mainThreadScrollingReasons = this->shouldUpdateScrollLayerPositionOnMainThread();
@@ -309,6 +315,12 @@
if (m_counterScrollingLayer)
m_counterScrollingLayer.get().position = FloatPoint(scrollOffsetForFixedChildren);
+ if (m_headerLayer)
+ m_headerLayer.get().position = FloatPoint(scrollOffsetForFixedChildren.width(), 0);
+
+ if (m_footerLayer)
+ m_footerLayer.get().position = FloatPoint(scrollOffsetForFixedChildren.width(), totalContentsSize().height() - footerHeight());
+
if (!m_children)
return;
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (150042 => 150043)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2013-05-13 23:11:08 UTC (rev 150042)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2013-05-13 23:16:01 UTC (rev 150043)
@@ -1582,6 +1582,18 @@
return m_scrollLayer.get();
}
+#if ENABLE(RUBBER_BANDING)
+GraphicsLayer* RenderLayerCompositor::headerLayer() const
+{
+ return m_layerForHeader.get();
+}
+
+GraphicsLayer* RenderLayerCompositor::footerLayer() const
+{
+ return m_layerForFooter.get();
+}
+#endif
+
TiledBacking* RenderLayerCompositor::pageTiledBacking() const
{
RenderLayerBacking* renderViewBacking = m_renderView->layer()->backing();
@@ -2541,8 +2553,13 @@
m_renderView->frameView()->addPaintPendingMilestones(DidFirstFlushForHeaderLayer);
}
- m_layerForHeader->setPosition(FloatPoint(0, 0));
+ m_layerForHeader->setPosition(FloatPoint());
+ m_layerForHeader->setAnchorPoint(FloatPoint3D());
m_layerForHeader->setSize(FloatSize(m_renderView->frameView()->visibleWidth(), m_renderView->frameView()->headerHeight()));
+
+ if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+ scrollingCoordinator->frameViewRootLayerDidChange(m_renderView->frameView());
+
return m_layerForHeader.get();
}
@@ -2568,7 +2585,12 @@
}
m_layerForFooter->setPosition(FloatPoint(0, m_rootContentLayer->size().height() + m_renderView->frameView()->headerHeight()));
+ m_layerForFooter->setAnchorPoint(FloatPoint3D());
m_layerForFooter->setSize(FloatSize(m_renderView->frameView()->visibleWidth(), m_renderView->frameView()->footerHeight()));
+
+ if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+ scrollingCoordinator->frameViewRootLayerDidChange(m_renderView->frameView());
+
return m_layerForFooter.get();
}
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (150042 => 150043)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2013-05-13 23:11:08 UTC (rev 150042)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2013-05-13 23:16:01 UTC (rev 150043)
@@ -185,6 +185,11 @@
GraphicsLayer* rootGraphicsLayer() const;
GraphicsLayer* scrollLayer() const;
+#if ENABLE(RUBBER_BANDING)
+ GraphicsLayer* headerLayer() const;
+ GraphicsLayer* footerLayer() const;
+#endif
+
enum RootLayerAttachment {
RootLayerUnattached,
RootLayerAttachedViaChromeClient,