Title: [168655] trunk/Source/WebCore
Revision
168655
Author
bda...@apple.com
Date
2014-05-12 16:21:51 -0700 (Mon, 12 May 2014)

Log Message

Content shadow layer needs to move in sync with the content layer
https://bugs.webkit.org/show_bug.cgi?id=132841
-and corresponding-
<rdar://problem/16641115>

Reviewed by Simon Fraser.

Now that the root content layer moves a little bit (for y scroll positions between 
0 and topContentInset), the shadow layer needs to move along with it since the 
shadow layer should always have the same position as the root content layer.

Set the root state node’s shadow layer, and update the position whenever the root 
content layer’s position is updated.
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
(WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):

Fetch the compositor’s layerForContentShadow().
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::contentShadowLayerForFrameView):
* page/scrolling/ScrollingCoordinator.h:

Hook up the contentShadowLayer in the state node.
* page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
(WebCore::ScrollingStateScrollingNode::setContentShadowLayer):

Hook it up in the ScrollingTreeNode as well. Move the layer whenever the m
_scrolledContentsLayer is moved.
* page/scrolling/ScrollingStateScrollingNode.h:
* page/scrolling/mac/ScrollingTreeScrollingNodeMac.h:
* page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
(WebCore::ScrollingTreeScrollingNodeMac::updateBeforeChildren):
(WebCore::ScrollingTreeScrollingNodeMac::setScrollLayerPosition):

The shadow layer needs an anchor point now that we are moving it around.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateOverflowControlsLayers):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (168654 => 168655)


--- trunk/Source/WebCore/ChangeLog	2014-05-12 23:17:46 UTC (rev 168654)
+++ trunk/Source/WebCore/ChangeLog	2014-05-12 23:21:51 UTC (rev 168655)
@@ -1,3 +1,44 @@
+2014-05-12  Beth Dakin  <bda...@apple.com>
+
+        Content shadow layer needs to move in sync with the content layer
+        https://bugs.webkit.org/show_bug.cgi?id=132841
+        -and corresponding-
+        <rdar://problem/16641115>
+
+        Reviewed by Simon Fraser.
+
+        Now that the root content layer moves a little bit (for y scroll positions between 
+        0 and topContentInset), the shadow layer needs to move along with it since the 
+        shadow layer should always have the same position as the root content layer.
+
+        Set the root state node’s shadow layer, and update the position whenever the root 
+        content layer’s position is updated.
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
+        (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
+
+        Fetch the compositor’s layerForContentShadow().
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::contentShadowLayerForFrameView):
+        * page/scrolling/ScrollingCoordinator.h:
+
+        Hook up the contentShadowLayer in the state node.
+        * page/scrolling/ScrollingStateScrollingNode.cpp:
+        (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
+        (WebCore::ScrollingStateScrollingNode::setContentShadowLayer):
+
+        Hook it up in the ScrollingTreeNode as well. Move the layer whenever the m
+        _scrolledContentsLayer is moved.
+        * page/scrolling/ScrollingStateScrollingNode.h:
+        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.h:
+        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeScrollingNodeMac::updateBeforeChildren):
+        (WebCore::ScrollingTreeScrollingNodeMac::setScrollLayerPosition):
+
+        The shadow layer needs an anchor point now that we are moving it around.
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
+
 2014-05-12  Dirk Schulze  <k...@webkit.org>
 
         <svg> with opacity and compositing double-applies its opacity

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (168654 => 168655)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2014-05-12 23:17:46 UTC (rev 168654)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2014-05-12 23:21:51 UTC (rev 168655)
@@ -135,6 +135,7 @@
     node->setLayer(scrollLayerForFrameView(frameView));
     node->setCounterScrollingLayer(counterScrollingLayerForFrameView(frameView));
     node->setInsetClipLayer(insetClipLayerForFrameView(frameView));
+    node->setContentShadowLayer(contentShadowLayerForFrameView(frameView));
     node->setHeaderLayer(headerLayerForFrameView(frameView));
     node->setFooterLayer(footerLayerForFrameView(frameView));
     node->setScrollBehaviorForFixedElements(frameView->scrollBehaviorForFixedElements());
@@ -215,6 +216,7 @@
         if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) {
             GraphicsLayer* counterScrollingLayer = counterScrollingLayerForFrameView(frameView);
             GraphicsLayer* insetClipLayer = insetClipLayerForFrameView(frameView);
+            GraphicsLayer* contentShadowLayer = contentShadowLayerForFrameView(frameView);
             GraphicsLayer* scrolledContentsLayer = rootContentLayerForFrameView(frameView);
             GraphicsLayer* headerLayer = headerLayerForFrameView(frameView);
             GraphicsLayer* footerLayer = footerLayerForFrameView(frameView);
@@ -234,6 +236,8 @@
                     counterScrollingLayer->setPosition(toLayoutPoint(scrollOffsetForFixed));
                 if (insetClipLayer)
                     insetClipLayer->setPosition(positionForInsetClipLayer);
+                if (contentShadowLayer)
+                    contentShadowLayer->setPosition(positionForContentsLayer);
                 if (scrolledContentsLayer)
                     scrolledContentsLayer->setPosition(positionForContentsLayer);
                 if (headerLayer)
@@ -246,6 +250,8 @@
                     counterScrollingLayer->syncPosition(toLayoutPoint(scrollOffsetForFixed));
                 if (insetClipLayer)
                     insetClipLayer->syncPosition(positionForInsetClipLayer);
+                if (contentShadowLayer)
+                    contentShadowLayer->syncPosition(positionForContentsLayer);
                 if (scrolledContentsLayer)
                     scrolledContentsLayer->syncPosition(positionForContentsLayer);
                 if (headerLayer)

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (168654 => 168655)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2014-05-12 23:17:46 UTC (rev 168654)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2014-05-12 23:21:51 UTC (rev 168655)
@@ -255,6 +255,13 @@
     return nullptr;
 }
 
+GraphicsLayer* ScrollingCoordinator::contentShadowLayerForFrameView(FrameView* frameView)
+{
+    if (RenderView* renderView = frameView->frame().contentRenderer())
+        return renderView->compositor().layerForContentShadow();
+    return nullptr;
+}
+
 GraphicsLayer* ScrollingCoordinator::rootContentLayerForFrameView(FrameView* frameView)
 {
     if (RenderView* renderView = frameView->frame().contentRenderer())

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (168654 => 168655)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2014-05-12 23:17:46 UTC (rev 168654)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2014-05-12 23:21:51 UTC (rev 168655)
@@ -205,6 +205,7 @@
     GraphicsLayer* counterScrollingLayerForFrameView(FrameView*);
     GraphicsLayer* insetClipLayerForFrameView(FrameView*);
     GraphicsLayer* rootContentLayerForFrameView(FrameView*);
+    GraphicsLayer* contentShadowLayerForFrameView(FrameView*);
     GraphicsLayer* headerLayerForFrameView(FrameView*);
     GraphicsLayer* footerLayerForFrameView(FrameView*);
 

Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp (168654 => 168655)


--- trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp	2014-05-12 23:17:46 UTC (rev 168654)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp	2014-05-12 23:21:51 UTC (rev 168655)
@@ -87,6 +87,9 @@
     if (hasChangedProperty(InsetClipLayer))
         setInsetClipLayer(stateNode.insetClipLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
 
+    if (hasChangedProperty(ContentShadowLayer))
+        setContentShadowLayer(stateNode.contentShadowLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
+
     if (hasChangedProperty(HeaderLayer))
         setHeaderLayer(stateNode.headerLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
 
@@ -255,6 +258,15 @@
     setPropertyChanged(InsetClipLayer);
 }
 
+void ScrollingStateScrollingNode::setContentShadowLayer(const LayerRepresentation& layerRepresentation)
+{
+    if (layerRepresentation == m_contentShadowLayer)
+        return;
+    
+    m_contentShadowLayer = layerRepresentation;
+    setPropertyChanged(ContentShadowLayer);
+}
+
 void ScrollingStateScrollingNode::setHeaderLayer(const LayerRepresentation& layerRepresentation)
 {
     if (layerRepresentation == m_headerLayer)

Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h (168654 => 168655)


--- trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h	2014-05-12 23:17:46 UTC (rev 168654)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h	2014-05-12 23:21:51 UTC (rev 168655)
@@ -63,6 +63,7 @@
         ScrolledContentsLayer,
         CounterScrollingLayer,
         InsetClipLayer,
+        ContentShadowLayer,
         HeaderHeight,
         FooterHeight,
         HeaderLayer,
@@ -130,6 +131,9 @@
     const LayerRepresentation& insetClipLayer() const { return m_insetClipLayer; }
     void setInsetClipLayer(const LayerRepresentation&);
 
+    const LayerRepresentation& contentShadowLayer() const { return m_contentShadowLayer; }
+    void setContentShadowLayer(const LayerRepresentation&);
+
     // The header and footer layers scroll vertically with the page, they should remain fixed when scrolling horizontally.
     const LayerRepresentation& headerLayer() const { return m_headerLayer; }
     void setHeaderLayer(const LayerRepresentation&);
@@ -153,6 +157,7 @@
     LayerRepresentation m_scrolledContentsLayer;
     LayerRepresentation m_counterScrollingLayer;
     LayerRepresentation m_insetClipLayer;
+    LayerRepresentation m_contentShadowLayer;
     LayerRepresentation m_headerLayer;
     LayerRepresentation m_footerLayer;
 

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h (168654 => 168655)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h	2014-05-12 23:17:46 UTC (rev 168654)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h	2014-05-12 23:21:51 UTC (rev 168655)
@@ -90,6 +90,7 @@
     RetainPtr<CALayer> m_scrolledContentsLayer;
     RetainPtr<CALayer> m_counterScrollingLayer;
     RetainPtr<CALayer> m_insetClipLayer;
+    RetainPtr<CALayer> m_contentShadowLayer;
     RetainPtr<CALayer> m_headerLayer;
     RetainPtr<CALayer> m_footerLayer;
     RetainPtr<ScrollbarPainter> m_verticalScrollbarPainter;

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm (168654 => 168655)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm	2014-05-12 23:17:46 UTC (rev 168654)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm	2014-05-12 23:21:51 UTC (rev 168655)
@@ -87,6 +87,9 @@
     if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::InsetClipLayer))
         m_insetClipLayer = scrollingStateNode.insetClipLayer();
 
+    if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ContentShadowLayer))
+        m_contentShadowLayer = scrollingStateNode.contentShadowLayer();
+
     if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::HeaderLayer))
         m_headerLayer = scrollingStateNode.headerLayer();
 
@@ -360,6 +363,8 @@
         m_insetClipLayer.get().position = FloatPoint(0, FrameView::yPositionForInsetClipLayer(position, topContentInset));
         m_scrolledContentsLayer.get().position = FloatPoint(m_scrolledContentsLayer.get().position.x,
             FrameView::yPositionForRootContentLayer(position, topContentInset, headerHeight()));
+        if (m_contentShadowLayer)
+            m_contentShadowLayer.get().position = m_scrolledContentsLayer.get().position;
     }
 
     if (m_headerLayer || m_footerLayer) {

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (168654 => 168655)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2014-05-12 23:17:46 UTC (rev 168654)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2014-05-12 23:21:51 UTC (rev 168655)
@@ -3102,6 +3102,7 @@
 #endif
             m_contentShadowLayer->setSize(m_rootContentLayer->size());
             m_contentShadowLayer->setPosition(m_rootContentLayer->position());
+            m_contentShadowLayer->setAnchorPoint(FloatPoint3D());
             m_contentShadowLayer->setCustomAppearance(GraphicsLayer::ScrollingShadow);
 
             m_scrollLayer->addChildBelow(m_contentShadowLayer.get(), m_rootContentLayer.get());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to