Changeset 219137 in webkit


Ignore:
Timestamp:
Jul 5, 2017 10:56:11 AM (7 years ago)
Author:
fred.wang@free.fr
Message:

Move ScrolledContentsLayer property to ScrollingStateScrollingNode
https://bugs.webkit.org/show_bug.cgi?id=174134

Patch by Frederic Wang <fwang@igalia.com> on 2017-07-05
Reviewed by Simon Fraser.

Source/WebCore:

ScrollingStateFrameScrollingNode and ScrollingStateOverflowScrollingNode both use a
ScrolledContentsLayer property for the same purpose. This commit moves that property into
their parent class ScrollingStateScrollingNode, so that more code is shared between the two
classes. This will also help the refactoring in bug 174130.

No new tests, only dumped tree may change a bit.

  • page/scrolling/ScrollingStateFrameScrollingNode.cpp: Remove scrolled contents layer.

(WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
(WebCore::ScrollingStateFrameScrollingNode::dumpProperties):
(WebCore::ScrollingStateFrameScrollingNode::setScrolledContentsLayer): Deleted.

  • page/scrolling/ScrollingStateFrameScrollingNode.h: Ditto.
  • page/scrolling/ScrollingStateOverflowScrollingNode.cpp: Ditto.

(WebCore::ScrollingStateOverflowScrollingNode::ScrollingStateOverflowScrollingNode):
(WebCore::ScrollingStateOverflowScrollingNode::dumpProperties):
(WebCore::ScrollingStateOverflowScrollingNode::setScrolledContentsLayer): Deleted.

  • page/scrolling/ScrollingStateOverflowScrollingNode.h: Ditto.

(): Deleted.
(WebCore::ScrollingStateOverflowScrollingNode::scrolledContentsLayer): Deleted.

  • page/scrolling/ScrollingStateScrollingNode.cpp: Add scrolled contents layer.

(WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
(WebCore::ScrollingStateScrollingNode::setScrolledContentsLayer):
(WebCore::ScrollingStateScrollingNode::dumpProperties): Use the label from the overflow class
which is different from the frame class. The dumping order may change a bit too.

  • page/scrolling/ScrollingStateScrollingNode.h: Add ScrolledContentsLayer to the enum and

scrolled contents layer.
(WebCore::ScrollingStateScrollingNode::scrolledContentsLayer):

  • page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:

(WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren): Adjust enum value
to use ScrollingStateScrollingNode::ScrolledContentsLayer.

Source/WebKit2:

  • Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:

(ArgumentCoder<ScrollingStateScrollingNode>::encode): Add encoding for scrolled contents
layer.
(ArgumentCoder<ScrollingStateFrameScrollingNode>::encode): Remove encoding for scrolled
contents layer.
(ArgumentCoder<ScrollingStateOverflowScrollingNode>::encode): Ditto.
(ArgumentCoder<ScrollingStateScrollingNode>::decode): Add decoding for scrolled contents
layer.
(ArgumentCoder<ScrollingStateFrameScrollingNode>::decode): Remove decoding for scrolled
contents layer.
(ArgumentCoder<ScrollingStateOverflowScrollingNode>::decode): Ditto.
(WebKit::dump): Move dumping of scrolled contents layer from overflow/frame nodes to
scrolling node.

  • UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:

(WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): Adjust enum value to use
ScrollingStateScrollingNode::ScrolledContentsLayer.

  • UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:

(WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateBeforeChildren): Ditto.

  • UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:

(WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): Ditto.

Location:
trunk/Source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r219130 r219137  
     12017-07-05  Frederic Wang  <fwang@igalia.com>
     2
     3        Move ScrolledContentsLayer property to ScrollingStateScrollingNode
     4        https://bugs.webkit.org/show_bug.cgi?id=174134
     5
     6        Reviewed by Simon Fraser.
     7
     8        ScrollingStateFrameScrollingNode and ScrollingStateOverflowScrollingNode both use a
     9        ScrolledContentsLayer property for the same purpose. This commit moves that property into
     10        their parent class ScrollingStateScrollingNode, so that more code is shared between the two
     11        classes. This will also help the refactoring in bug 174130.
     12
     13        No new tests, only dumped tree may change a bit.
     14
     15        * page/scrolling/ScrollingStateFrameScrollingNode.cpp: Remove scrolled contents layer.
     16        (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
     17        (WebCore::ScrollingStateFrameScrollingNode::dumpProperties):
     18        (WebCore::ScrollingStateFrameScrollingNode::setScrolledContentsLayer): Deleted.
     19        * page/scrolling/ScrollingStateFrameScrollingNode.h: Ditto.
     20        * page/scrolling/ScrollingStateOverflowScrollingNode.cpp: Ditto.
     21        (WebCore::ScrollingStateOverflowScrollingNode::ScrollingStateOverflowScrollingNode):
     22        (WebCore::ScrollingStateOverflowScrollingNode::dumpProperties):
     23        (WebCore::ScrollingStateOverflowScrollingNode::setScrolledContentsLayer): Deleted.
     24        * page/scrolling/ScrollingStateOverflowScrollingNode.h: Ditto.
     25        (): Deleted.
     26        (WebCore::ScrollingStateOverflowScrollingNode::scrolledContentsLayer): Deleted.
     27        * page/scrolling/ScrollingStateScrollingNode.cpp: Add scrolled contents layer.
     28        (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
     29        (WebCore::ScrollingStateScrollingNode::setScrolledContentsLayer):
     30        (WebCore::ScrollingStateScrollingNode::dumpProperties): Use the label from the overflow class
     31        which is different from the frame class. The dumping order may change a bit too.
     32        * page/scrolling/ScrollingStateScrollingNode.h: Add ScrolledContentsLayer to the enum and
     33        scrolled contents layer.
     34        (WebCore::ScrollingStateScrollingNode::scrolledContentsLayer):
     35        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
     36        (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren): Adjust enum value
     37        to use ScrollingStateScrollingNode::ScrolledContentsLayer.
     38
    1392017-07-05  Emilio Cobos Álvarez  <ecobos@igalia.com>
    240
  • trunk/Source/WebCore/page/scrolling/ScrollingStateFrameScrollingNode.cpp

    r216511 r219137  
    6565    , m_visualViewportEnabled(stateNode.visualViewportEnabled())
    6666{
    67     if (hasChangedProperty(ScrolledContentsLayer))
    68         setScrolledContentsLayer(stateNode.scrolledContentsLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
    69 
    7067    if (hasChangedProperty(CounterScrollingLayer))
    7168        setCounterScrollingLayer(stateNode.counterScrollingLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
     
    182179    m_topContentInset = topContentInset;
    183180    setPropertyChanged(TopContentInset);
    184 }
    185 
    186 void ScrollingStateFrameScrollingNode::setScrolledContentsLayer(const LayerRepresentation& layerRepresentation)
    187 {
    188     if (layerRepresentation == m_scrolledContentsLayer)
    189         return;
    190    
    191     m_scrolledContentsLayer = layerRepresentation;
    192     setPropertyChanged(ScrolledContentsLayer);
    193181}
    194182
     
    272260        ts.dumpProperty("counter scrolling layer ID", m_counterScrollingLayer.layerID());
    273261        ts.dumpProperty("inset clip layer ID", m_insetClipLayer.layerID());
    274         ts.dumpProperty("scrolled contents layer ID", m_scrolledContentsLayer.layerID());
    275262        ts.dumpProperty("content shadow layer ID", m_contentShadowLayer.layerID());
    276263        ts.dumpProperty("header layer ID", m_headerLayer.layerID());
  • trunk/Source/WebCore/page/scrolling/ScrollingStateFrameScrollingNode.h

    r216478 r219137  
    9898    WEBCORE_EXPORT void setTopContentInset(float);
    9999
    100     const LayerRepresentation& scrolledContentsLayer() const { return m_scrolledContentsLayer; }
    101     WEBCORE_EXPORT void setScrolledContentsLayer(const LayerRepresentation&);
    102 
    103100    // This is a layer moved in the opposite direction to scrolling, for example for background-attachment:fixed
    104101    const LayerRepresentation& counterScrollingLayer() const { return m_counterScrollingLayer; }
     
    143140    LayerRepresentation m_counterScrollingLayer;
    144141    LayerRepresentation m_insetClipLayer;
    145     LayerRepresentation m_scrolledContentsLayer;
    146142    LayerRepresentation m_contentShadowLayer;
    147143    LayerRepresentation m_headerLayer;
  • trunk/Source/WebCore/page/scrolling/ScrollingStateOverflowScrollingNode.cpp

    r216478 r219137  
    4747    : ScrollingStateScrollingNode(stateNode, adoptiveTree)
    4848{
    49     if (hasChangedProperty(ScrolledContentsLayer))
    50         setScrolledContentsLayer(stateNode.scrolledContentsLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
    5149}
    5250
     
    6058}
    6159   
    62 void ScrollingStateOverflowScrollingNode::setScrolledContentsLayer(const LayerRepresentation& layerRepresentation)
    63 {
    64     if (layerRepresentation == m_scrolledContentsLayer)
    65         return;
    66    
    67     m_scrolledContentsLayer = layerRepresentation;
    68     setPropertyChanged(ScrolledContentsLayer);
    69 }
    70 
    7160void ScrollingStateOverflowScrollingNode::dumpProperties(TextStream& ts, ScrollingStateTreeAsTextBehavior behavior) const
    7261{
     
    7463   
    7564    ScrollingStateScrollingNode::dumpProperties(ts, behavior);
    76    
    77     if ((behavior & ScrollingStateTreeAsTextBehaviorIncludeLayerIDs) && m_scrolledContentsLayer.layerID())
    78         ts.dumpProperty("scrolled contents layer", m_scrolledContentsLayer.layerID());
    7965}
    8066
  • trunk/Source/WebCore/page/scrolling/ScrollingStateOverflowScrollingNode.h

    r216478 r219137  
    4040    virtual ~ScrollingStateOverflowScrollingNode();
    4141
    42     enum ChangedProperty {
    43         ScrolledContentsLayer = NumScrollingStateNodeBits
    44     };
    45 
    46     // This is a layer with the contents that move.
    47     const LayerRepresentation& scrolledContentsLayer() const { return m_scrolledContentsLayer; }
    48     WEBCORE_EXPORT void setScrolledContentsLayer(const LayerRepresentation&);
    49    
    5042    void dumpProperties(TextStream&, ScrollingStateTreeAsTextBehavior) const override;
    5143
     
    5345    ScrollingStateOverflowScrollingNode(ScrollingStateTree&, ScrollingNodeID);
    5446    ScrollingStateOverflowScrollingNode(const ScrollingStateOverflowScrollingNode&, ScrollingStateTree&);
    55    
    56     LayerRepresentation m_scrolledContentsLayer;   
    5747};
    5848
  • trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp

    r216511 r219137  
    5454    , m_expectsWheelEventTestTrigger(stateNode.expectsWheelEventTestTrigger())
    5555{
     56    if (hasChangedProperty(ScrolledContentsLayer))
     57        setScrolledContentsLayer(stateNode.scrolledContentsLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
    5658}
    5759
     
    186188}
    187189
     190void ScrollingStateScrollingNode::setScrolledContentsLayer(const LayerRepresentation& layerRepresentation)
     191{
     192    if (layerRepresentation == m_scrolledContentsLayer)
     193        return;
     194
     195    m_scrolledContentsLayer = layerRepresentation;
     196    setPropertyChanged(ScrolledContentsLayer);
     197}
     198
    188199void ScrollingStateScrollingNode::dumpProperties(TextStream& ts, ScrollingStateTreeAsTextBehavior behavior) const
    189200{
     
    244255    if (m_expectsWheelEventTestTrigger)
    245256        ts.dumpProperty("expects wheel event test trigger", m_expectsWheelEventTestTrigger);
     257
     258    if ((behavior & ScrollingStateTreeAsTextBehaviorIncludeLayerIDs) && m_scrolledContentsLayer.layerID())
     259        ts.dumpProperty("scrolled contents layer", m_scrolledContentsLayer.layerID());
    246260}
    247261
  • trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h

    r217610 r219137  
    5656#endif
    5757        ExpectsWheelEventTestTrigger,
     58        ScrolledContentsLayer,
    5859        NumScrollingStateNodeBits // This must remain at the last position.
    5960    };
     
    104105    WEBCORE_EXPORT void setExpectsWheelEventTestTrigger(bool);
    105106
     107    // This is a layer with the contents that move.
     108    const LayerRepresentation& scrolledContentsLayer() const { return m_scrolledContentsLayer; }
     109    WEBCORE_EXPORT void setScrolledContentsLayer(const LayerRepresentation&);
     110
    106111protected:
    107112    ScrollingStateScrollingNode(ScrollingStateTree&, ScrollingNodeType, ScrollingNodeID);
     
    123128#endif
    124129    ScrollableAreaParameters m_scrollableAreaParameters;
     130    LayerRepresentation m_scrolledContentsLayer;
    125131    bool m_requestedScrollPositionRepresentsProgrammaticScroll { false };
    126132    bool m_expectsWheelEventTestTrigger { false };
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm

    r217737 r219137  
    107107        m_scrollLayer = scrollingStateNode.layer();
    108108
    109     if (scrollingStateNode.hasChangedProperty(ScrollingStateFrameScrollingNode::ScrolledContentsLayer))
     109    if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer))
    110110        m_scrolledContentsLayer = scrollingStateNode.scrolledContentsLayer();
    111111
  • trunk/Source/WebKit2/ChangeLog

    r219136 r219137  
     12017-07-05  Frederic Wang  <fwang@igalia.com>
     2
     3        Move ScrolledContentsLayer property to ScrollingStateScrollingNode
     4        https://bugs.webkit.org/show_bug.cgi?id=174134
     5
     6        Reviewed by Simon Fraser.
     7
     8        * Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
     9        (ArgumentCoder<ScrollingStateScrollingNode>::encode): Add encoding for scrolled contents
     10        layer.
     11        (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode): Remove encoding for scrolled
     12        contents layer.
     13        (ArgumentCoder<ScrollingStateOverflowScrollingNode>::encode): Ditto.
     14        (ArgumentCoder<ScrollingStateScrollingNode>::decode): Add decoding for scrolled contents
     15        layer.
     16        (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode): Remove decoding for scrolled
     17        contents layer.
     18        (ArgumentCoder<ScrollingStateOverflowScrollingNode>::decode): Ditto.
     19        (WebKit::dump): Move dumping of scrolled contents layer from overflow/frame nodes to
     20        scrolling node.
     21        * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
     22        (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): Adjust enum value to use
     23        ScrollingStateScrollingNode::ScrolledContentsLayer.
     24        * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
     25        (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateBeforeChildren): Ditto.
     26        * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
     27        (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): Ditto.
     28
    1292017-07-05  Ada Chan  <adachan@apple.com>
    230
  • trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp

    r210560 r219137  
    136136    SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::RequestedScrollPosition, requestedScrollPosition)
    137137    SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::RequestedScrollPosition, requestedScrollPositionRepresentsProgrammaticScroll)
     138
     139    if (node.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer))
     140        encoder << static_cast<GraphicsLayer::PlatformLayerID>(node.scrolledContentsLayer());
    138141}
    139142
     
    155158    SCROLLING_NODE_ENCODE(ScrollingStateFrameScrollingNode::MaxLayoutViewportOrigin, maxLayoutViewportOrigin)
    156159
    157     if (node.hasChangedProperty(ScrollingStateFrameScrollingNode::ScrolledContentsLayer))
    158         encoder << static_cast<GraphicsLayer::PlatformLayerID>(node.scrolledContentsLayer());
    159 
    160160    if (node.hasChangedProperty(ScrollingStateFrameScrollingNode::CounterScrollingLayer))
    161161        encoder << static_cast<GraphicsLayer::PlatformLayerID>(node.counterScrollingLayer());
     
    171171{
    172172    encoder << static_cast<const ScrollingStateScrollingNode&>(node);
    173    
    174     if (node.hasChangedProperty(ScrollingStateOverflowScrollingNode::ScrolledContentsLayer))
    175         encoder << static_cast<GraphicsLayer::PlatformLayerID>(node.scrolledContentsLayer());
    176173}
    177174
     
    224221    }
    225222
     223    if (node.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer)) {
     224        GraphicsLayer::PlatformLayerID layerID;
     225        if (!decoder.decode(layerID))
     226            return false;
     227        node.setScrolledContentsLayer(layerID);
     228    }
     229
    226230    return true;
    227231}
     
    246250    SCROLLING_NODE_DECODE(ScrollingStateFrameScrollingNode::MaxLayoutViewportOrigin, FloatPoint, setMaxLayoutViewportOrigin)
    247251
    248     if (node.hasChangedProperty(ScrollingStateFrameScrollingNode::ScrolledContentsLayer)) {
    249         GraphicsLayer::PlatformLayerID layerID;
    250         if (!decoder.decode(layerID))
    251             return false;
    252         node.setScrolledContentsLayer(layerID);
    253     }
    254 
    255252    if (node.hasChangedProperty(ScrollingStateFrameScrollingNode::CounterScrollingLayer)) {
    256253        GraphicsLayer::PlatformLayerID layerID;
     
    281278    if (!decoder.decode(static_cast<ScrollingStateScrollingNode&>(node)))
    282279        return false;
    283 
    284     if (node.hasChangedProperty(ScrollingStateOverflowScrollingNode::ScrolledContentsLayer)) {
    285         GraphicsLayer::PlatformLayerID layerID;
    286         if (!decoder.decode(layerID))
    287             return false;
    288         node.setScrolledContentsLayer(layerID);
    289     }
    290280
    291281    return true;
     
    484474        ts.dumpProperty("requested-scroll-position-is-programatic", node.requestedScrollPositionRepresentsProgrammaticScroll());
    485475    }
     476
     477    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer))
     478        ts.dumpProperty("scrolled-contents-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.scrolledContentsLayer()));
    486479}
    487480   
     
    531524        ts.dumpProperty("frame-scale-factor", node.frameScaleFactor());
    532525
    533     if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateFrameScrollingNode::ScrolledContentsLayer))
    534         ts.dumpProperty("scrolled-contents-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.scrolledContentsLayer()));
    535 
    536526    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateFrameScrollingNode::InsetClipLayer))
    537527        ts.dumpProperty("clip-inset-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.insetClipLayer()));
     
    550540{
    551541    dump(ts, static_cast<const ScrollingStateScrollingNode&>(node), changedPropertiesOnly);
    552    
    553     if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateOverflowScrollingNode::ScrolledContentsLayer))
    554         ts.dumpProperty("scrolled-contents-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.scrolledContentsLayer()));
    555542}
    556543
  • trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp

    r208985 r219137  
    107107            ScrollingStateFrameScrollingNode& scrollingStateNode = downcast<ScrollingStateFrameScrollingNode>(*currNode);
    108108           
    109             if (scrollingStateNode.hasChangedProperty(ScrollingStateFrameScrollingNode::ScrolledContentsLayer))
     109            if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer))
    110110                scrollingStateNode.setScrolledContentsLayer(layerTreeHost.getLayer(scrollingStateNode.scrolledContentsLayer()));
    111111
     
    130130            ScrollingStateOverflowScrollingNode& scrollingStateNode = downcast<ScrollingStateOverflowScrollingNode>(*currNode);
    131131
    132             if (scrollingStateNode.hasChangedProperty(ScrollingStateOverflowScrollingNode::ScrolledContentsLayer))
     132            if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer))
    133133                scrollingStateNode.setScrolledContentsLayer(layerTreeHost.getLayer(scrollingStateNode.scrolledContentsLayer()));
    134134            break;
  • trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm

    r210560 r219137  
    173173        m_scrollLayer = scrollingStateNode.layer();
    174174
    175     if (scrollingStateNode.hasChangedProperty(ScrollingStateOverflowScrollingNode::ScrolledContentsLayer))
     175    if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer))
    176176        m_scrolledContentsLayer = scrollingStateNode.scrolledContentsLayer();
    177177}
  • trunk/Source/WebKit2/UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm

    r216352 r219137  
    6464                scrollingStateNode.setLayer(layerRepresentationFromLayerOrView(layerTreeHost.getLayer(scrollingStateNode.layer())));
    6565           
    66             if (scrollingStateNode.hasChangedProperty(ScrollingStateOverflowScrollingNode::ScrolledContentsLayer))
     66            if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer))
    6767                scrollingStateNode.setScrolledContentsLayer(layerRepresentationFromLayerOrView(layerTreeHost.getLayer(scrollingStateNode.scrolledContentsLayer())));
    6868            break;
Note: See TracChangeset for help on using the changeset viewer.