Changeset 168655 in webkit


Ignore:
Timestamp:
May 12, 2014 4:21:51 PM (10 years ago)
Author:
Beth Dakin
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):

Location:
trunk/Source/WebCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r168651 r168655  
     12014-05-12  Beth Dakin  <bdakin@apple.com>
     2
     3        Content shadow layer needs to move in sync with the content layer
     4        https://bugs.webkit.org/show_bug.cgi?id=132841
     5        -and corresponding-
     6        <rdar://problem/16641115>
     7
     8        Reviewed by Simon Fraser.
     9
     10        Now that the root content layer moves a little bit (for y scroll positions between
     11        0 and topContentInset), the shadow layer needs to move along with it since the
     12        shadow layer should always have the same position as the root content layer.
     13
     14        Set the root state node’s shadow layer, and update the position whenever the root
     15        content layer’s position is updated.
     16        * page/scrolling/AsyncScrollingCoordinator.cpp:
     17        (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
     18        (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
     19
     20        Fetch the compositor’s layerForContentShadow().
     21        * page/scrolling/ScrollingCoordinator.cpp:
     22        (WebCore::ScrollingCoordinator::contentShadowLayerForFrameView):
     23        * page/scrolling/ScrollingCoordinator.h:
     24
     25        Hook up the contentShadowLayer in the state node.
     26        * page/scrolling/ScrollingStateScrollingNode.cpp:
     27        (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
     28        (WebCore::ScrollingStateScrollingNode::setContentShadowLayer):
     29
     30        Hook it up in the ScrollingTreeNode as well. Move the layer whenever the m
     31        _scrolledContentsLayer is moved.
     32        * page/scrolling/ScrollingStateScrollingNode.h:
     33        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.h:
     34        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
     35        (WebCore::ScrollingTreeScrollingNodeMac::updateBeforeChildren):
     36        (WebCore::ScrollingTreeScrollingNodeMac::setScrollLayerPosition):
     37
     38        The shadow layer needs an anchor point now that we are moving it around.
     39        * rendering/RenderLayerCompositor.cpp:
     40        (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
     41
    1422014-05-12  Dirk Schulze  <krit@webkit.org>
    243
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp

    r168602 r168655  
    136136    node->setCounterScrollingLayer(counterScrollingLayerForFrameView(frameView));
    137137    node->setInsetClipLayer(insetClipLayerForFrameView(frameView));
     138    node->setContentShadowLayer(contentShadowLayerForFrameView(frameView));
    138139    node->setHeaderLayer(headerLayerForFrameView(frameView));
    139140    node->setFooterLayer(footerLayerForFrameView(frameView));
     
    216217            GraphicsLayer* counterScrollingLayer = counterScrollingLayerForFrameView(frameView);
    217218            GraphicsLayer* insetClipLayer = insetClipLayerForFrameView(frameView);
     219            GraphicsLayer* contentShadowLayer = contentShadowLayerForFrameView(frameView);
    218220            GraphicsLayer* scrolledContentsLayer = rootContentLayerForFrameView(frameView);
    219221            GraphicsLayer* headerLayer = headerLayerForFrameView(frameView);
     
    235237                if (insetClipLayer)
    236238                    insetClipLayer->setPosition(positionForInsetClipLayer);
     239                if (contentShadowLayer)
     240                    contentShadowLayer->setPosition(positionForContentsLayer);
    237241                if (scrolledContentsLayer)
    238242                    scrolledContentsLayer->setPosition(positionForContentsLayer);
     
    247251                if (insetClipLayer)
    248252                    insetClipLayer->syncPosition(positionForInsetClipLayer);
     253                if (contentShadowLayer)
     254                    contentShadowLayer->syncPosition(positionForContentsLayer);
    249255                if (scrolledContentsLayer)
    250256                    scrolledContentsLayer->syncPosition(positionForContentsLayer);
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp

    r168602 r168655  
    256256}
    257257
     258GraphicsLayer* ScrollingCoordinator::contentShadowLayerForFrameView(FrameView* frameView)
     259{
     260    if (RenderView* renderView = frameView->frame().contentRenderer())
     261        return renderView->compositor().layerForContentShadow();
     262    return nullptr;
     263}
     264
    258265GraphicsLayer* ScrollingCoordinator::rootContentLayerForFrameView(FrameView* frameView)
    259266{
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h

    r168244 r168655  
    206206    GraphicsLayer* insetClipLayerForFrameView(FrameView*);
    207207    GraphicsLayer* rootContentLayerForFrameView(FrameView*);
     208    GraphicsLayer* contentShadowLayerForFrameView(FrameView*);
    208209    GraphicsLayer* headerLayerForFrameView(FrameView*);
    209210    GraphicsLayer* footerLayerForFrameView(FrameView*);
  • trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp

    r168244 r168655  
    8888        setInsetClipLayer(stateNode.insetClipLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
    8989
     90    if (hasChangedProperty(ContentShadowLayer))
     91        setContentShadowLayer(stateNode.contentShadowLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
     92
    9093    if (hasChangedProperty(HeaderLayer))
    9194        setHeaderLayer(stateNode.headerLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
     
    256259}
    257260
     261void ScrollingStateScrollingNode::setContentShadowLayer(const LayerRepresentation& layerRepresentation)
     262{
     263    if (layerRepresentation == m_contentShadowLayer)
     264        return;
     265   
     266    m_contentShadowLayer = layerRepresentation;
     267    setPropertyChanged(ContentShadowLayer);
     268}
     269
    258270void ScrollingStateScrollingNode::setHeaderLayer(const LayerRepresentation& layerRepresentation)
    259271{
  • trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h

    r168244 r168655  
    6464        CounterScrollingLayer,
    6565        InsetClipLayer,
     66        ContentShadowLayer,
    6667        HeaderHeight,
    6768        FooterHeight,
     
    131132    void setInsetClipLayer(const LayerRepresentation&);
    132133
     134    const LayerRepresentation& contentShadowLayer() const { return m_contentShadowLayer; }
     135    void setContentShadowLayer(const LayerRepresentation&);
     136
    133137    // The header and footer layers scroll vertically with the page, they should remain fixed when scrolling horizontally.
    134138    const LayerRepresentation& headerLayer() const { return m_headerLayer; }
     
    154158    LayerRepresentation m_counterScrollingLayer;
    155159    LayerRepresentation m_insetClipLayer;
     160    LayerRepresentation m_contentShadowLayer;
    156161    LayerRepresentation m_headerLayer;
    157162    LayerRepresentation m_footerLayer;
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h

    r168244 r168655  
    9191    RetainPtr<CALayer> m_counterScrollingLayer;
    9292    RetainPtr<CALayer> m_insetClipLayer;
     93    RetainPtr<CALayer> m_contentShadowLayer;
    9394    RetainPtr<CALayer> m_headerLayer;
    9495    RetainPtr<CALayer> m_footerLayer;
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm

    r168602 r168655  
    8888        m_insetClipLayer = scrollingStateNode.insetClipLayer();
    8989
     90    if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ContentShadowLayer))
     91        m_contentShadowLayer = scrollingStateNode.contentShadowLayer();
     92
    9093    if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::HeaderLayer))
    9194        m_headerLayer = scrollingStateNode.headerLayer();
     
    361364        m_scrolledContentsLayer.get().position = FloatPoint(m_scrolledContentsLayer.get().position.x,
    362365            FrameView::yPositionForRootContentLayer(position, topContentInset, headerHeight()));
     366        if (m_contentShadowLayer)
     367            m_contentShadowLayer.get().position = m_scrolledContentsLayer.get().position;
    363368    }
    364369
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r168643 r168655  
    31033103            m_contentShadowLayer->setSize(m_rootContentLayer->size());
    31043104            m_contentShadowLayer->setPosition(m_rootContentLayer->position());
     3105            m_contentShadowLayer->setAnchorPoint(FloatPoint3D());
    31053106            m_contentShadowLayer->setCustomAppearance(GraphicsLayer::ScrollingShadow);
    31063107
Note: See TracChangeset for help on using the changeset viewer.