Changeset 239576 in webkit
- Timestamp:
- Jan 2, 2019 1:22:07 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r239575 r239576 1 2019-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 1 29 2019-01-02 Simon Fraser <simon.fraser@apple.com> 2 30 -
trunk/Source/WebCore/page/FrameView.cpp
r239512 r239576 906 906 return 0; 907 907 908 return backing->scrollingNodeIDForRole(Scroll ing);908 return backing->scrollingNodeIDForRole(ScrollCoordinationRole::Scrolling); 909 909 } 910 910 -
trunk/Source/WebCore/rendering/RenderLayer.h
r239427 r239576 108 108 }; 109 109 110 enum LayerScrollCoordinationRole {111 ViewportConstrained = 1 << 0,112 Scrolling = 1 << 1113 };114 115 110 enum class RequestState { 116 111 Unknown, -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r239427 r239576 245 245 updateMaskingLayer(false, false); 246 246 updateScrollingLayers(false); 247 detachFromScrollingCoordinator({ Scroll ing,ViewportConstrained });247 detachFromScrollingCoordinator({ ScrollCoordinationRole::Scrolling, ScrollCoordinationRole::ViewportConstrained }); 248 248 destroyGraphicsLayers(); 249 249 } … … 1773 1773 } 1774 1774 1775 void RenderLayerBacking::detachFromScrollingCoordinator(OptionSet< LayerScrollCoordinationRole> roles)1775 void RenderLayerBacking::detachFromScrollingCoordinator(OptionSet<ScrollCoordinationRole> roles) 1776 1776 { 1777 1777 if (!m_scrollingNodeID && !m_viewportConstrainedNodeID) … … 1782 1782 return; 1783 1783 1784 if ((roles & Scrolling) && m_scrollingNodeID) {1784 if ((roles.contains(ScrollCoordinationRole::Scrolling)) && m_scrollingNodeID) { 1785 1785 LOG(Compositing, "Detaching Scrolling node %" PRIu64, m_scrollingNodeID); 1786 1786 scrollingCoordinator->detachFromStateTree(m_scrollingNodeID); … … 1788 1788 } 1789 1789 1790 if ((roles & ViewportConstrained) && m_viewportConstrainedNodeID) {1790 if ((roles.contains(ScrollCoordinationRole::ViewportConstrained)) && m_viewportConstrainedNodeID) { 1791 1791 LOG(Compositing, "Detaching ViewportConstrained node %" PRIu64, m_viewportConstrainedNodeID); 1792 1792 scrollingCoordinator->detachFromStateTree(m_viewportConstrainedNodeID); … … 3083 3083 3084 3084 ts << " primary layer ID " << backing.graphicsLayer()->primaryLayerID(); 3085 if (auto nodeID = backing.scrollingNodeIDForRole( ViewportConstrained))3085 if (auto nodeID = backing.scrollingNodeIDForRole(ScrollCoordinationRole::ViewportConstrained)) 3086 3086 ts << " viewport constrained scrolling node " << nodeID; 3087 if (auto nodeID = backing.scrollingNodeIDForRole(Scroll ing))3087 if (auto nodeID = backing.scrollingNodeIDForRole(ScrollCoordinationRole::Scrolling)) 3088 3088 ts << " scrolling node " << nodeID; 3089 3089 return ts; -
trunk/Source/WebCore/rendering/RenderLayerBacking.h
r238090 r239576 31 31 #include "GraphicsLayerClient.h" 32 32 #include "RenderLayer.h" 33 #include "RenderLayerCompositor.h" 33 34 #include "ScrollingCoordinator.h" 34 35 … … 105 106 GraphicsLayer* scrollingContentsLayer() const { return m_scrollingContentsLayer.get(); } 106 107 107 void detachFromScrollingCoordinator(OptionSet< LayerScrollCoordinationRole>);108 109 ScrollingNodeID scrollingNodeIDForRole( LayerScrollCoordinationRole role) const108 void detachFromScrollingCoordinator(OptionSet<ScrollCoordinationRole>); 109 110 ScrollingNodeID scrollingNodeIDForRole(ScrollCoordinationRole role) const 110 111 { 111 112 switch (role) { 112 case Scroll ing:113 case ScrollCoordinationRole::Scrolling: 113 114 return m_scrollingNodeID; 114 case ViewportConstrained:115 case ScrollCoordinationRole::ViewportConstrained: 115 116 return m_viewportConstrainedNodeID; 116 117 } … … 118 119 } 119 120 120 void setScrollingNodeIDForRole(ScrollingNodeID nodeID, LayerScrollCoordinationRole role)121 void setScrollingNodeIDForRole(ScrollingNodeID nodeID, ScrollCoordinationRole role) 121 122 { 122 123 switch (role) { 123 case Scroll ing:124 case ScrollCoordinationRole::Scrolling: 124 125 m_scrollingNodeID = nodeID; 125 126 break; 126 case ViewportConstrained:127 case ScrollCoordinationRole::ViewportConstrained: 127 128 m_viewportConstrainedNodeID = nodeID; 128 129 setIsScrollCoordinatedWithViewportConstrainedRole(nodeID); -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r239548 r239576 3663 3663 void RenderLayerCompositor::updateScrollCoordinatedStatus(RenderLayer& layer, OptionSet<ScrollingNodeChangeFlags> changes) 3664 3664 { 3665 OptionSet< LayerScrollCoordinationRole> coordinationRoles;3665 OptionSet<ScrollCoordinationRole> coordinationRoles; 3666 3666 if (isViewportConstrainedFixedOrStickyLayer(layer)) 3667 coordinationRoles.add( ViewportConstrained);3667 coordinationRoles.add(ScrollCoordinationRole::ViewportConstrained); 3668 3668 3669 3669 if (useCoordinatedScrollingForLayer(layer)) 3670 coordinationRoles.add(Scroll ing);3670 coordinationRoles.add(ScrollCoordinationRole::Scrolling); 3671 3671 3672 3672 if (layer.isComposited()) 3673 layer.backing()->setIsScrollCoordinatedWithViewportConstrainedRole(coordinationRoles.contains( ViewportConstrained));3673 layer.backing()->setIsScrollCoordinatedWithViewportConstrainedRole(coordinationRoles.contains(ScrollCoordinationRole::ViewportConstrained)); 3674 3674 3675 3675 if (coordinationRoles && canCoordinateScrollingForLayer(layer)) { … … 3692 3692 m_scrollCoordinatedLayersNeedingUpdate.remove(&layer); 3693 3693 3694 detachScrollCoordinatedLayer(layer, { Scroll ing,ViewportConstrained });3694 detachScrollCoordinatedLayer(layer, { ScrollCoordinationRole::Scrolling, ScrollCoordinationRole::ViewportConstrained }); 3695 3695 } 3696 3696 … … 3811 3811 } 3812 3812 3813 static inline LayerScrollCoordinationRole scrollCoordinationRoleForNodeType(ScrollingNodeType nodeType)3813 static inline ScrollCoordinationRole scrollCoordinationRoleForNodeType(ScrollingNodeType nodeType) 3814 3814 { 3815 3815 switch (nodeType) { … … 3817 3817 case ScrollingNodeType::Subframe: 3818 3818 case ScrollingNodeType::Overflow: 3819 return Scroll ing;3819 return ScrollCoordinationRole::Scrolling; 3820 3820 case ScrollingNodeType::Fixed: 3821 3821 case ScrollingNodeType::Sticky: 3822 return ViewportConstrained;3822 return ScrollCoordinationRole::ViewportConstrained; 3823 3823 } 3824 3824 ASSERT_NOT_REACHED(); 3825 return Scroll ing;3825 return ScrollCoordinationRole::Scrolling; 3826 3826 } 3827 3827 … … 3835 3835 return 0; 3836 3836 3837 LayerScrollCoordinationRole role = scrollCoordinationRoleForNodeType(nodeType);3837 ScrollCoordinationRole role = scrollCoordinationRoleForNodeType(nodeType); 3838 3838 ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(role); 3839 3839 if (!nodeID) … … 3850 3850 } 3851 3851 3852 void RenderLayerCompositor::detachScrollCoordinatedLayer(RenderLayer& layer, OptionSet< LayerScrollCoordinationRole> roles)3852 void RenderLayerCompositor::detachScrollCoordinatedLayer(RenderLayer& layer, OptionSet<ScrollCoordinationRole> roles) 3853 3853 { 3854 3854 auto* backing = layer.backing(); … … 3856 3856 return; 3857 3857 3858 if (roles & Scrolling) {3859 if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(Scroll ing))3858 if (roles.contains(ScrollCoordinationRole::Scrolling)) { 3859 if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(ScrollCoordinationRole::Scrolling)) 3860 3860 m_scrollingNodeToLayerMap.remove(nodeID); 3861 3861 } 3862 3862 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)) 3865 3865 m_scrollingNodeToLayerMap.remove(nodeID); 3866 3866 } … … 3889 3889 } 3890 3890 3891 void RenderLayerCompositor::updateScrollCoordinatedLayer(RenderLayer& layer, OptionSet< LayerScrollCoordinationRole> reasons, OptionSet<ScrollingNodeChangeFlags> changes)3891 void RenderLayerCompositor::updateScrollCoordinatedLayer(RenderLayer& layer, OptionSet<ScrollCoordinationRole> roles, OptionSet<ScrollingNodeChangeFlags> changes) 3892 3892 { 3893 3893 bool isRenderViewLayer = layer.isRenderViewLayer(); … … 3906 3906 3907 3907 updateScrollCoordinationForThisFrame(parentDocumentHostingNodeID); 3908 if (!(r easons & ViewportConstrained) && isRenderViewLayer)3908 if (!(roles.contains(ScrollCoordinationRole::ViewportConstrained)) && isRenderViewLayer) 3909 3909 return; 3910 3910 } … … 3918 3918 // Always call this even if the backing is already attached because the parent may have changed. 3919 3919 // If a node plays both roles, fixed/sticky is always the ancestor node of scrolling. 3920 if (r easons & ViewportConstrained) {3920 if (roles.contains(ScrollCoordinationRole::ViewportConstrained)) { 3921 3921 ScrollingNodeType nodeType = ScrollingNodeType::MainFrame; 3922 3922 if (layer.renderer().isFixedPositioned()) … … 3953 3953 parentNodeID = nodeID; 3954 3954 } else 3955 detachScrollCoordinatedLayer(layer, ViewportConstrained);3955 detachScrollCoordinatedLayer(layer, ScrollCoordinationRole::ViewportConstrained); 3956 3956 3957 if (r easons & Scrolling) {3957 if (roles.contains(ScrollCoordinationRole::Scrolling)) { 3958 3958 if (isRenderViewLayer) 3959 3959 updateScrollCoordinationForThisFrame(parentNodeID); … … 3989 3989 } 3990 3990 } else 3991 detachScrollCoordinatedLayer(layer, Scroll ing);3991 detachScrollCoordinatedLayer(layer, ScrollCoordinationRole::Scrolling); 3992 3992 } 3993 3993 … … 4071 4071 { 4072 4072 if (auto* scrollingCoordinator = this->scrollingCoordinator()) { 4073 backing.detachFromScrollingCoordinator(Scroll ing);4073 backing.detachFromScrollingCoordinator(ScrollCoordinationRole::Scrolling); 4074 4074 4075 4075 // For Coordinated Graphics. -
trunk/Source/WebCore/rendering/RenderLayerCompositor.h
r238354 r239576 84 84 }; 85 85 86 enum class ScrollCoordinationRole { 87 ViewportConstrained = 1 << 0, 88 Scrolling = 1 << 1 89 }; 90 86 91 // RenderLayerCompositor manages the hierarchy of 87 92 // composited RenderLayers. It determines which RenderLayers … … 447 452 void updateScrollCoordinationForThisFrame(ScrollingNodeID); 448 453 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>); 451 456 void reattachSubframeScrollLayers(); 452 457 … … 467 472 bool useCoordinatedScrollingForLayer(const RenderLayer&) const; 468 473 474 // FIXME: make the coordinated/async terminology consistent. 469 475 bool isAsyncScrollableStickyLayer(const RenderLayer&, const RenderLayer** enclosingAcceleratedOverflowLayer = nullptr) const; 470 476 bool isViewportConstrainedFixedOrStickyLayer(const RenderLayer&) const;
Note: See TracChangeset
for help on using the changeset viewer.