Changeset 239576 in webkit


Ignore:
Timestamp:
Jan 2, 2019 1:22:07 PM (5 years ago)
Author:
Simon Fraser
Message:

Rename LayerScrollCoordinationRole to ScrollCoordinationRole and make an enum class
https://bugs.webkit.org/show_bug.cgi?id=193010

Reviewed by Zalan Bujtas.

Move the enum LayerScrollCoordinationRole from RenderLayer.h to RenderLayerCompositor.h,
and make it an enum class.

  • page/FrameView.cpp:

(WebCore::FrameView::scrollLayerID const):

  • rendering/RenderLayer.h:
  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::~RenderLayerBacking):
(WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
(WebCore::operator<<):

  • rendering/RenderLayerBacking.h:
  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus):
(WebCore::RenderLayerCompositor::removeFromScrollCoordinatedLayers):
(WebCore::scrollCoordinationRoleForNodeType):
(WebCore::RenderLayerCompositor::attachScrollingNode):
(WebCore::RenderLayerCompositor::detachScrollCoordinatedLayer):
(WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
(WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking):

  • rendering/RenderLayerCompositor.h:
Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r239575 r239576  
     12019-01-02  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Rename LayerScrollCoordinationRole to ScrollCoordinationRole and make an enum class
     4        https://bugs.webkit.org/show_bug.cgi?id=193010
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        Move the enum LayerScrollCoordinationRole from RenderLayer.h to RenderLayerCompositor.h,
     9        and make it an enum class.
     10
     11        * page/FrameView.cpp:
     12        (WebCore::FrameView::scrollLayerID const):
     13        * rendering/RenderLayer.h:
     14        * rendering/RenderLayerBacking.cpp:
     15        (WebCore::RenderLayerBacking::~RenderLayerBacking):
     16        (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
     17        (WebCore::operator<<):
     18        * rendering/RenderLayerBacking.h:
     19        * rendering/RenderLayerCompositor.cpp:
     20        (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus):
     21        (WebCore::RenderLayerCompositor::removeFromScrollCoordinatedLayers):
     22        (WebCore::scrollCoordinationRoleForNodeType):
     23        (WebCore::RenderLayerCompositor::attachScrollingNode):
     24        (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayer):
     25        (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
     26        (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking):
     27        * rendering/RenderLayerCompositor.h:
     28
    1292019-01-02  Simon Fraser  <simon.fraser@apple.com>
    230
  • trunk/Source/WebCore/page/FrameView.cpp

    r239512 r239576  
    906906        return 0;
    907907
    908     return backing->scrollingNodeIDForRole(Scrolling);
     908    return backing->scrollingNodeIDForRole(ScrollCoordinationRole::Scrolling);
    909909}
    910910
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r239427 r239576  
    108108};
    109109
    110 enum LayerScrollCoordinationRole {
    111     ViewportConstrained = 1 << 0,
    112     Scrolling           = 1 << 1
    113 };
    114 
    115110enum class RequestState {
    116111    Unknown,
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r239427 r239576  
    245245    updateMaskingLayer(false, false);
    246246    updateScrollingLayers(false);
    247     detachFromScrollingCoordinator({ Scrolling, ViewportConstrained });
     247    detachFromScrollingCoordinator({ ScrollCoordinationRole::Scrolling, ScrollCoordinationRole::ViewportConstrained });
    248248    destroyGraphicsLayers();
    249249}
     
    17731773}
    17741774
    1775 void RenderLayerBacking::detachFromScrollingCoordinator(OptionSet<LayerScrollCoordinationRole> roles)
     1775void RenderLayerBacking::detachFromScrollingCoordinator(OptionSet<ScrollCoordinationRole> roles)
    17761776{
    17771777    if (!m_scrollingNodeID && !m_viewportConstrainedNodeID)
     
    17821782        return;
    17831783
    1784     if ((roles & Scrolling) && m_scrollingNodeID) {
     1784    if ((roles.contains(ScrollCoordinationRole::Scrolling)) && m_scrollingNodeID) {
    17851785        LOG(Compositing, "Detaching Scrolling node %" PRIu64, m_scrollingNodeID);
    17861786        scrollingCoordinator->detachFromStateTree(m_scrollingNodeID);
     
    17881788    }
    17891789   
    1790     if ((roles & ViewportConstrained) && m_viewportConstrainedNodeID) {
     1790    if ((roles.contains(ScrollCoordinationRole::ViewportConstrained)) && m_viewportConstrainedNodeID) {
    17911791        LOG(Compositing, "Detaching ViewportConstrained node %" PRIu64, m_viewportConstrainedNodeID);
    17921792        scrollingCoordinator->detachFromStateTree(m_viewportConstrainedNodeID);
     
    30833083
    30843084    ts << " primary layer ID " << backing.graphicsLayer()->primaryLayerID();
    3085     if (auto nodeID = backing.scrollingNodeIDForRole(ViewportConstrained))
     3085    if (auto nodeID = backing.scrollingNodeIDForRole(ScrollCoordinationRole::ViewportConstrained))
    30863086        ts << " viewport constrained scrolling node " << nodeID;
    3087     if (auto nodeID = backing.scrollingNodeIDForRole(Scrolling))
     3087    if (auto nodeID = backing.scrollingNodeIDForRole(ScrollCoordinationRole::Scrolling))
    30883088        ts << " scrolling node " << nodeID;
    30893089    return ts;
  • trunk/Source/WebCore/rendering/RenderLayerBacking.h

    r238090 r239576  
    3131#include "GraphicsLayerClient.h"
    3232#include "RenderLayer.h"
     33#include "RenderLayerCompositor.h"
    3334#include "ScrollingCoordinator.h"
    3435
     
    105106    GraphicsLayer* scrollingContentsLayer() const { return m_scrollingContentsLayer.get(); }
    106107
    107     void detachFromScrollingCoordinator(OptionSet<LayerScrollCoordinationRole>);
    108    
    109     ScrollingNodeID scrollingNodeIDForRole(LayerScrollCoordinationRole role) const
     108    void detachFromScrollingCoordinator(OptionSet<ScrollCoordinationRole>);
     109   
     110    ScrollingNodeID scrollingNodeIDForRole(ScrollCoordinationRole role) const
    110111    {
    111112        switch (role) {
    112         case Scrolling:
     113        case ScrollCoordinationRole::Scrolling:
    113114            return m_scrollingNodeID;
    114         case ViewportConstrained:
     115        case ScrollCoordinationRole::ViewportConstrained:
    115116            return m_viewportConstrainedNodeID;
    116117        }
     
    118119    }
    119120   
    120     void setScrollingNodeIDForRole(ScrollingNodeID nodeID, LayerScrollCoordinationRole role)
     121    void setScrollingNodeIDForRole(ScrollingNodeID nodeID, ScrollCoordinationRole role)
    121122    {
    122123        switch (role) {
    123         case Scrolling:
     124        case ScrollCoordinationRole::Scrolling:
    124125            m_scrollingNodeID = nodeID;
    125126            break;
    126         case ViewportConstrained:
     127        case ScrollCoordinationRole::ViewportConstrained:
    127128            m_viewportConstrainedNodeID = nodeID;
    128129            setIsScrollCoordinatedWithViewportConstrainedRole(nodeID);
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r239548 r239576  
    36633663void RenderLayerCompositor::updateScrollCoordinatedStatus(RenderLayer& layer, OptionSet<ScrollingNodeChangeFlags> changes)
    36643664{
    3665     OptionSet<LayerScrollCoordinationRole> coordinationRoles;
     3665    OptionSet<ScrollCoordinationRole> coordinationRoles;
    36663666    if (isViewportConstrainedFixedOrStickyLayer(layer))
    3667         coordinationRoles.add(ViewportConstrained);
     3667        coordinationRoles.add(ScrollCoordinationRole::ViewportConstrained);
    36683668
    36693669    if (useCoordinatedScrollingForLayer(layer))
    3670         coordinationRoles.add(Scrolling);
     3670        coordinationRoles.add(ScrollCoordinationRole::Scrolling);
    36713671
    36723672    if (layer.isComposited())
    3673         layer.backing()->setIsScrollCoordinatedWithViewportConstrainedRole(coordinationRoles.contains(ViewportConstrained));
     3673        layer.backing()->setIsScrollCoordinatedWithViewportConstrainedRole(coordinationRoles.contains(ScrollCoordinationRole::ViewportConstrained));
    36743674
    36753675    if (coordinationRoles && canCoordinateScrollingForLayer(layer)) {
     
    36923692    m_scrollCoordinatedLayersNeedingUpdate.remove(&layer);
    36933693
    3694     detachScrollCoordinatedLayer(layer, { Scrolling, ViewportConstrained });
     3694    detachScrollCoordinatedLayer(layer, { ScrollCoordinationRole::Scrolling, ScrollCoordinationRole::ViewportConstrained });
    36953695}
    36963696
     
    38113811}
    38123812
    3813 static inline LayerScrollCoordinationRole scrollCoordinationRoleForNodeType(ScrollingNodeType nodeType)
     3813static inline ScrollCoordinationRole scrollCoordinationRoleForNodeType(ScrollingNodeType nodeType)
    38143814{
    38153815    switch (nodeType) {
     
    38173817    case ScrollingNodeType::Subframe:
    38183818    case ScrollingNodeType::Overflow:
    3819         return Scrolling;
     3819        return ScrollCoordinationRole::Scrolling;
    38203820    case ScrollingNodeType::Fixed:
    38213821    case ScrollingNodeType::Sticky:
    3822         return ViewportConstrained;
     3822        return ScrollCoordinationRole::ViewportConstrained;
    38233823    }
    38243824    ASSERT_NOT_REACHED();
    3825     return Scrolling;
     3825    return ScrollCoordinationRole::Scrolling;
    38263826}
    38273827
     
    38353835        return 0;
    38363836
    3837     LayerScrollCoordinationRole role = scrollCoordinationRoleForNodeType(nodeType);
     3837    ScrollCoordinationRole role = scrollCoordinationRoleForNodeType(nodeType);
    38383838    ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(role);
    38393839    if (!nodeID)
     
    38503850}
    38513851
    3852 void RenderLayerCompositor::detachScrollCoordinatedLayer(RenderLayer& layer, OptionSet<LayerScrollCoordinationRole> roles)
     3852void RenderLayerCompositor::detachScrollCoordinatedLayer(RenderLayer& layer, OptionSet<ScrollCoordinationRole> roles)
    38533853{
    38543854    auto* backing = layer.backing();
     
    38563856        return;
    38573857
    3858     if (roles & Scrolling) {
    3859         if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(Scrolling))
     3858    if (roles.contains(ScrollCoordinationRole::Scrolling)) {
     3859        if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(ScrollCoordinationRole::Scrolling))
    38603860            m_scrollingNodeToLayerMap.remove(nodeID);
    38613861    }
    38623862
    3863     if (roles & ViewportConstrained) {
    3864         if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(ViewportConstrained))
     3863    if (roles.contains(ScrollCoordinationRole::ViewportConstrained)) {
     3864        if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(ScrollCoordinationRole::ViewportConstrained))
    38653865            m_scrollingNodeToLayerMap.remove(nodeID);
    38663866    }
     
    38893889}
    38903890
    3891 void RenderLayerCompositor::updateScrollCoordinatedLayer(RenderLayer& layer, OptionSet<LayerScrollCoordinationRole> reasons, OptionSet<ScrollingNodeChangeFlags> changes)
     3891void RenderLayerCompositor::updateScrollCoordinatedLayer(RenderLayer& layer, OptionSet<ScrollCoordinationRole> roles, OptionSet<ScrollingNodeChangeFlags> changes)
    38923892{
    38933893    bool isRenderViewLayer = layer.isRenderViewLayer();
     
    39063906
    39073907        updateScrollCoordinationForThisFrame(parentDocumentHostingNodeID);
    3908         if (!(reasons & ViewportConstrained) && isRenderViewLayer)
     3908        if (!(roles.contains(ScrollCoordinationRole::ViewportConstrained)) && isRenderViewLayer)
    39093909            return;
    39103910    }
     
    39183918    // Always call this even if the backing is already attached because the parent may have changed.
    39193919    // If a node plays both roles, fixed/sticky is always the ancestor node of scrolling.
    3920     if (reasons & ViewportConstrained) {
     3920    if (roles.contains(ScrollCoordinationRole::ViewportConstrained)) {
    39213921        ScrollingNodeType nodeType = ScrollingNodeType::MainFrame;
    39223922        if (layer.renderer().isFixedPositioned())
     
    39533953        parentNodeID = nodeID;
    39543954    } else
    3955         detachScrollCoordinatedLayer(layer, ViewportConstrained);
     3955        detachScrollCoordinatedLayer(layer, ScrollCoordinationRole::ViewportConstrained);
    39563956       
    3957     if (reasons & Scrolling) {
     3957    if (roles.contains(ScrollCoordinationRole::Scrolling)) {
    39583958        if (isRenderViewLayer)
    39593959            updateScrollCoordinationForThisFrame(parentNodeID);
     
    39893989        }
    39903990    } else
    3991         detachScrollCoordinatedLayer(layer, Scrolling);
     3991        detachScrollCoordinatedLayer(layer, ScrollCoordinationRole::Scrolling);
    39923992}
    39933993
     
    40714071{
    40724072    if (auto* scrollingCoordinator = this->scrollingCoordinator()) {
    4073         backing.detachFromScrollingCoordinator(Scrolling);
     4073        backing.detachFromScrollingCoordinator(ScrollCoordinationRole::Scrolling);
    40744074
    40754075        // For Coordinated Graphics.
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.h

    r238354 r239576  
    8484};
    8585
     86enum class ScrollCoordinationRole {
     87    ViewportConstrained = 1 << 0,
     88    Scrolling           = 1 << 1
     89};
     90
    8691// RenderLayerCompositor manages the hierarchy of
    8792// composited RenderLayers. It determines which RenderLayers
     
    447452    void updateScrollCoordinationForThisFrame(ScrollingNodeID);
    448453    ScrollingNodeID attachScrollingNode(RenderLayer&, ScrollingNodeType, ScrollingNodeID parentNodeID);
    449     void updateScrollCoordinatedLayer(RenderLayer&, OptionSet<LayerScrollCoordinationRole>, OptionSet<ScrollingNodeChangeFlags>);
    450     void detachScrollCoordinatedLayer(RenderLayer&, OptionSet<LayerScrollCoordinationRole>);
     454    void updateScrollCoordinatedLayer(RenderLayer&, OptionSet<ScrollCoordinationRole>, OptionSet<ScrollingNodeChangeFlags>);
     455    void detachScrollCoordinatedLayer(RenderLayer&, OptionSet<ScrollCoordinationRole>);
    451456    void reattachSubframeScrollLayers();
    452457   
     
    467472    bool useCoordinatedScrollingForLayer(const RenderLayer&) const;
    468473
     474    // FIXME: make the coordinated/async terminology consistent.
    469475    bool isAsyncScrollableStickyLayer(const RenderLayer&, const RenderLayer** enclosingAcceleratedOverflowLayer = nullptr) const;
    470476    bool isViewportConstrainedFixedOrStickyLayer(const RenderLayer&) const;
Note: See TracChangeset for help on using the changeset viewer.