Title: [239576] trunk/Source/WebCore
Revision
239576
Author
simon.fra...@apple.com
Date
2019-01-02 13:22:07 -0800 (Wed, 02 Jan 2019)

Log 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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (239575 => 239576)


--- trunk/Source/WebCore/ChangeLog	2019-01-02 21:09:13 UTC (rev 239575)
+++ trunk/Source/WebCore/ChangeLog	2019-01-02 21:22:07 UTC (rev 239576)
@@ -1,5 +1,33 @@
 2019-01-02  Simon Fraser  <simon.fra...@apple.com>
 
+        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:
+
+2019-01-02  Simon Fraser  <simon.fra...@apple.com>
+
         Don't spin up a CalcParser if the current token is not a function token
         https://bugs.webkit.org/show_bug.cgi?id=193067
 

Modified: trunk/Source/WebCore/page/FrameView.cpp (239575 => 239576)


--- trunk/Source/WebCore/page/FrameView.cpp	2019-01-02 21:09:13 UTC (rev 239575)
+++ trunk/Source/WebCore/page/FrameView.cpp	2019-01-02 21:22:07 UTC (rev 239576)
@@ -905,7 +905,7 @@
     if (!backing)
         return 0;
 
-    return backing->scrollingNodeIDForRole(Scrolling);
+    return backing->scrollingNodeIDForRole(ScrollCoordinationRole::Scrolling);
 }
 
 ScrollableArea* FrameView::scrollableAreaForScrollLayerID(uint64_t nodeID) const

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (239575 => 239576)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2019-01-02 21:09:13 UTC (rev 239575)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2019-01-02 21:22:07 UTC (rev 239576)
@@ -107,11 +107,6 @@
     IgnoreRootOffsetForFragments
 };
 
-enum LayerScrollCoordinationRole {
-    ViewportConstrained = 1 << 0,
-    Scrolling           = 1 << 1
-};
-
 enum class RequestState {
     Unknown,
     DontCare,

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (239575 => 239576)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2019-01-02 21:09:13 UTC (rev 239575)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2019-01-02 21:22:07 UTC (rev 239576)
@@ -244,7 +244,7 @@
     updateBackgroundLayer(false);
     updateMaskingLayer(false, false);
     updateScrollingLayers(false);
-    detachFromScrollingCoordinator({ Scrolling, ViewportConstrained });
+    detachFromScrollingCoordinator({ ScrollCoordinationRole::Scrolling, ScrollCoordinationRole::ViewportConstrained });
     destroyGraphicsLayers();
 }
 
@@ -1772,7 +1772,7 @@
     return true;
 }
 
-void RenderLayerBacking::detachFromScrollingCoordinator(OptionSet<LayerScrollCoordinationRole> roles)
+void RenderLayerBacking::detachFromScrollingCoordinator(OptionSet<ScrollCoordinationRole> roles)
 {
     if (!m_scrollingNodeID && !m_viewportConstrainedNodeID)
         return;
@@ -1781,13 +1781,13 @@
     if (!scrollingCoordinator)
         return;
 
-    if ((roles & Scrolling) && m_scrollingNodeID) {
+    if ((roles.contains(ScrollCoordinationRole::Scrolling)) && m_scrollingNodeID) {
         LOG(Compositing, "Detaching Scrolling node %" PRIu64, m_scrollingNodeID);
         scrollingCoordinator->detachFromStateTree(m_scrollingNodeID);
         m_scrollingNodeID = 0;
     }
     
-    if ((roles & ViewportConstrained) && m_viewportConstrainedNodeID) {
+    if ((roles.contains(ScrollCoordinationRole::ViewportConstrained)) && m_viewportConstrainedNodeID) {
         LOG(Compositing, "Detaching ViewportConstrained node %" PRIu64, m_viewportConstrainedNodeID);
         scrollingCoordinator->detachFromStateTree(m_viewportConstrainedNodeID);
         m_viewportConstrainedNodeID = 0;
@@ -3082,9 +3082,9 @@
         ts << " paintsIntoCompositedAncestor";
 
     ts << " primary layer ID " << backing.graphicsLayer()->primaryLayerID();
-    if (auto nodeID = backing.scrollingNodeIDForRole(ViewportConstrained))
+    if (auto nodeID = backing.scrollingNodeIDForRole(ScrollCoordinationRole::ViewportConstrained))
         ts << " viewport constrained scrolling node " << nodeID;
-    if (auto nodeID = backing.scrollingNodeIDForRole(Scrolling))
+    if (auto nodeID = backing.scrollingNodeIDForRole(ScrollCoordinationRole::Scrolling))
         ts << " scrolling node " << nodeID;
     return ts;
 }

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (239575 => 239576)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.h	2019-01-02 21:09:13 UTC (rev 239575)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h	2019-01-02 21:22:07 UTC (rev 239576)
@@ -30,6 +30,7 @@
 #include "GraphicsLayer.h"
 #include "GraphicsLayerClient.h"
 #include "RenderLayer.h"
+#include "RenderLayerCompositor.h"
 #include "ScrollingCoordinator.h"
 
 namespace WebCore {
@@ -104,26 +105,26 @@
     GraphicsLayer* scrollingLayer() const { return m_scrollingLayer.get(); }
     GraphicsLayer* scrollingContentsLayer() const { return m_scrollingContentsLayer.get(); }
 
-    void detachFromScrollingCoordinator(OptionSet<LayerScrollCoordinationRole>);
+    void detachFromScrollingCoordinator(OptionSet<ScrollCoordinationRole>);
     
-    ScrollingNodeID scrollingNodeIDForRole(LayerScrollCoordinationRole role) const
+    ScrollingNodeID scrollingNodeIDForRole(ScrollCoordinationRole role) const
     {
         switch (role) {
-        case Scrolling:
+        case ScrollCoordinationRole::Scrolling:
             return m_scrollingNodeID;
-        case ViewportConstrained:
+        case ScrollCoordinationRole::ViewportConstrained:
             return m_viewportConstrainedNodeID;
         }
         return 0;
     }
     
-    void setScrollingNodeIDForRole(ScrollingNodeID nodeID, LayerScrollCoordinationRole role)
+    void setScrollingNodeIDForRole(ScrollingNodeID nodeID, ScrollCoordinationRole role)
     {
         switch (role) {
-        case Scrolling:
+        case ScrollCoordinationRole::Scrolling:
             m_scrollingNodeID = nodeID;
             break;
-        case ViewportConstrained:
+        case ScrollCoordinationRole::ViewportConstrained:
             m_viewportConstrainedNodeID = nodeID;
             setIsScrollCoordinatedWithViewportConstrainedRole(nodeID);
             break;

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (239575 => 239576)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-01-02 21:09:13 UTC (rev 239575)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-01-02 21:22:07 UTC (rev 239576)
@@ -3662,15 +3662,15 @@
 
 void RenderLayerCompositor::updateScrollCoordinatedStatus(RenderLayer& layer, OptionSet<ScrollingNodeChangeFlags> changes)
 {
-    OptionSet<LayerScrollCoordinationRole> coordinationRoles;
+    OptionSet<ScrollCoordinationRole> coordinationRoles;
     if (isViewportConstrainedFixedOrStickyLayer(layer))
-        coordinationRoles.add(ViewportConstrained);
+        coordinationRoles.add(ScrollCoordinationRole::ViewportConstrained);
 
     if (useCoordinatedScrollingForLayer(layer))
-        coordinationRoles.add(Scrolling);
+        coordinationRoles.add(ScrollCoordinationRole::Scrolling);
 
     if (layer.isComposited())
-        layer.backing()->setIsScrollCoordinatedWithViewportConstrainedRole(coordinationRoles.contains(ViewportConstrained));
+        layer.backing()->setIsScrollCoordinatedWithViewportConstrainedRole(coordinationRoles.contains(ScrollCoordinationRole::ViewportConstrained));
 
     if (coordinationRoles && canCoordinateScrollingForLayer(layer)) {
         if (m_scrollCoordinatedLayers.add(&layer).isNewEntry)
@@ -3691,7 +3691,7 @@
     m_scrollCoordinatedLayers.remove(&layer);
     m_scrollCoordinatedLayersNeedingUpdate.remove(&layer);
 
-    detachScrollCoordinatedLayer(layer, { Scrolling, ViewportConstrained });
+    detachScrollCoordinatedLayer(layer, { ScrollCoordinationRole::Scrolling, ScrollCoordinationRole::ViewportConstrained });
 }
 
 FixedPositionViewportConstraints RenderLayerCompositor::computeFixedViewportConstraints(RenderLayer& layer) const
@@ -3810,19 +3810,19 @@
     }
 }
 
-static inline LayerScrollCoordinationRole scrollCoordinationRoleForNodeType(ScrollingNodeType nodeType)
+static inline ScrollCoordinationRole scrollCoordinationRoleForNodeType(ScrollingNodeType nodeType)
 {
     switch (nodeType) {
     case ScrollingNodeType::MainFrame:
     case ScrollingNodeType::Subframe:
     case ScrollingNodeType::Overflow:
-        return Scrolling;
+        return ScrollCoordinationRole::Scrolling;
     case ScrollingNodeType::Fixed:
     case ScrollingNodeType::Sticky:
-        return ViewportConstrained;
+        return ScrollCoordinationRole::ViewportConstrained;
     }
     ASSERT_NOT_REACHED();
-    return Scrolling;
+    return ScrollCoordinationRole::Scrolling;
 }
 
 ScrollingNodeID RenderLayerCompositor::attachScrollingNode(RenderLayer& layer, ScrollingNodeType nodeType, ScrollingNodeID parentNodeID)
@@ -3834,7 +3834,7 @@
     if (!backing)
         return 0;
 
-    LayerScrollCoordinationRole role = scrollCoordinationRoleForNodeType(nodeType);
+    ScrollCoordinationRole role = scrollCoordinationRoleForNodeType(nodeType);
     ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(role);
     if (!nodeID)
         nodeID = scrollingCoordinator->uniqueScrollingNodeID();
@@ -3849,19 +3849,19 @@
     return nodeID;
 }
 
-void RenderLayerCompositor::detachScrollCoordinatedLayer(RenderLayer& layer, OptionSet<LayerScrollCoordinationRole> roles)
+void RenderLayerCompositor::detachScrollCoordinatedLayer(RenderLayer& layer, OptionSet<ScrollCoordinationRole> roles)
 {
     auto* backing = layer.backing();
     if (!backing)
         return;
 
-    if (roles & Scrolling) {
-        if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(Scrolling))
+    if (roles.contains(ScrollCoordinationRole::Scrolling)) {
+        if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(ScrollCoordinationRole::Scrolling))
             m_scrollingNodeToLayerMap.remove(nodeID);
     }
 
-    if (roles & ViewportConstrained) {
-        if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(ViewportConstrained))
+    if (roles.contains(ScrollCoordinationRole::ViewportConstrained)) {
+        if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(ScrollCoordinationRole::ViewportConstrained))
             m_scrollingNodeToLayerMap.remove(nodeID);
     }
 
@@ -3888,7 +3888,7 @@
     scrollingCoordinator->updateFrameScrollingNode(nodeID, m_scrollLayer.get(), m_rootContentLayer.get(), fixedRootBackgroundLayer(), clipLayer(), scrollingGeometry);
 }
 
-void RenderLayerCompositor::updateScrollCoordinatedLayer(RenderLayer& layer, OptionSet<LayerScrollCoordinationRole> reasons, OptionSet<ScrollingNodeChangeFlags> changes)
+void RenderLayerCompositor::updateScrollCoordinatedLayer(RenderLayer& layer, OptionSet<ScrollCoordinationRole> roles, OptionSet<ScrollingNodeChangeFlags> changes)
 {
     bool isRenderViewLayer = layer.isRenderViewLayer();
 
@@ -3905,7 +3905,7 @@
             return;
 
         updateScrollCoordinationForThisFrame(parentDocumentHostingNodeID);
-        if (!(reasons & ViewportConstrained) && isRenderViewLayer)
+        if (!(roles.contains(ScrollCoordinationRole::ViewportConstrained)) && isRenderViewLayer)
             return;
     }
 
@@ -3917,7 +3917,7 @@
 
     // Always call this even if the backing is already attached because the parent may have changed.
     // If a node plays both roles, fixed/sticky is always the ancestor node of scrolling.
-    if (reasons & ViewportConstrained) {
+    if (roles.contains(ScrollCoordinationRole::ViewportConstrained)) {
         ScrollingNodeType nodeType = ScrollingNodeType::MainFrame;
         if (layer.renderer().isFixedPositioned())
             nodeType = ScrollingNodeType::Fixed;
@@ -3952,9 +3952,9 @@
         
         parentNodeID = nodeID;
     } else
-        detachScrollCoordinatedLayer(layer, ViewportConstrained);
+        detachScrollCoordinatedLayer(layer, ScrollCoordinationRole::ViewportConstrained);
         
-    if (reasons & Scrolling) {
+    if (roles.contains(ScrollCoordinationRole::Scrolling)) {
         if (isRenderViewLayer)
             updateScrollCoordinationForThisFrame(parentNodeID);
         else {
@@ -3988,7 +3988,7 @@
             scrollingCoordinator->updateOverflowScrollingNode(nodeID, backing->scrollingLayer(), backing->scrollingContentsLayer(), scrollingGeometry);
         }
     } else
-        detachScrollCoordinatedLayer(layer, Scrolling);
+        detachScrollCoordinatedLayer(layer, ScrollCoordinationRole::Scrolling);
 }
 
 ScrollableArea* RenderLayerCompositor::scrollableAreaForScrollLayerID(ScrollingNodeID nodeID) const
@@ -4070,7 +4070,7 @@
 void RenderLayerCompositor::willRemoveScrollingLayerWithBacking(RenderLayer& layer, RenderLayerBacking& backing)
 {
     if (auto* scrollingCoordinator = this->scrollingCoordinator()) {
-        backing.detachFromScrollingCoordinator(Scrolling);
+        backing.detachFromScrollingCoordinator(ScrollCoordinationRole::Scrolling);
 
         // For Coordinated Graphics.
         scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer);

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (239575 => 239576)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2019-01-02 21:09:13 UTC (rev 239575)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2019-01-02 21:22:07 UTC (rev 239576)
@@ -83,6 +83,11 @@
     EmbeddedView                           = 1 << 26,
 };
 
+enum class ScrollCoordinationRole {
+    ViewportConstrained = 1 << 0,
+    Scrolling           = 1 << 1
+};
+
 // RenderLayerCompositor manages the hierarchy of
 // composited RenderLayers. It determines which RenderLayers
 // become compositing, and creates and maintains a hierarchy of
@@ -446,8 +451,8 @@
 
     void updateScrollCoordinationForThisFrame(ScrollingNodeID);
     ScrollingNodeID attachScrollingNode(RenderLayer&, ScrollingNodeType, ScrollingNodeID parentNodeID);
-    void updateScrollCoordinatedLayer(RenderLayer&, OptionSet<LayerScrollCoordinationRole>, OptionSet<ScrollingNodeChangeFlags>);
-    void detachScrollCoordinatedLayer(RenderLayer&, OptionSet<LayerScrollCoordinationRole>);
+    void updateScrollCoordinatedLayer(RenderLayer&, OptionSet<ScrollCoordinationRole>, OptionSet<ScrollingNodeChangeFlags>);
+    void detachScrollCoordinatedLayer(RenderLayer&, OptionSet<ScrollCoordinationRole>);
     void reattachSubframeScrollLayers();
     
     FixedPositionViewportConstraints computeFixedViewportConstraints(RenderLayer&) const;
@@ -466,6 +471,7 @@
     bool hasCoordinatedScrolling() const;
     bool useCoordinatedScrollingForLayer(const RenderLayer&) const;
 
+    // FIXME: make the coordinated/async terminology consistent.
     bool isAsyncScrollableStickyLayer(const RenderLayer&, const RenderLayer** enclosingAcceleratedOverflowLayer = nullptr) const;
     bool isViewportConstrainedFixedOrStickyLayer(const RenderLayer&) const;
     
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to