ScrollingTreeScrollingNode: use LayerRepresentation for scroll container, scrolled...
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Sep 2019 05:15:40 +0000 (05:15 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Sep 2019 05:15:40 +0000 (05:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=202256
<rdar://problem/55772092>

Reviewed by Simon Fraser.

Source/WebCore:

Make the scroll container and scrolled contents layer holders
platform-independent by using the LayerRepresentation as the underlying
type for the two member variables in ScrollingTreeScrollingNode.

* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
* page/scrolling/ScrollingTreeScrollingNode.h:
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
* page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
(WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):

Source/WebKit:

* UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
(WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
Use static casts to retrieve the CALayer pointers from the
LayerRepresentation objects due to the explicit operators.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250498 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp
Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h
Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm
Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm

index cdd74ec..a227644 100644 (file)
@@ -1,3 +1,23 @@
+2019-09-29  Zan Dobersek  <zdobersek@igalia.com>
+
+        ScrollingTreeScrollingNode: use LayerRepresentation for scroll container, scrolled contents layers
+        https://bugs.webkit.org/show_bug.cgi?id=202256
+        <rdar://problem/55772092>
+
+        Reviewed by Simon Fraser.
+
+        Make the scroll container and scrolled contents layer holders
+        platform-independent by using the LayerRepresentation as the underlying
+        type for the two member variables in ScrollingTreeScrollingNode.
+
+        * page/scrolling/ScrollingTreeScrollingNode.cpp:
+        (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
+        * page/scrolling/ScrollingTreeScrollingNode.h:
+        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
+        * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):
+
 2019-09-28  Brent Fulgham  <bfulgham@apple.com>
 
         [FTW] Correct compositing, shadow, and radial gradient implementations
index 81256ee..d035dad 100644 (file)
@@ -100,13 +100,11 @@ void ScrollingTreeScrollingNode::commitStateBeforeChildren(const ScrollingStateN
     if (state.hasChangedProperty(ScrollingStateScrollingNode::ExpectsWheelEventTestTrigger))
         m_expectsWheelEventTestTrigger = state.expectsWheelEventTestTrigger();
 
-#if PLATFORM(COCOA)
     if (state.hasChangedProperty(ScrollingStateScrollingNode::ScrollContainerLayer))
-        m_scrollContainerLayer = static_cast<CALayer*>(state.scrollContainerLayer());
+        m_scrollContainerLayer = state.scrollContainerLayer();
 
     if (state.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer))
-        m_scrolledContentsLayer = static_cast<CALayer*>(state.scrolledContentsLayer());
-#endif
+        m_scrolledContentsLayer = state.scrolledContentsLayer();
 }
 
 void ScrollingTreeScrollingNode::commitStateAfterChildren(const ScrollingStateNode& stateNode)
index 298f49d..16f8b6e 100644 (file)
@@ -88,10 +88,8 @@ public:
     bool scrollLimitReached(const PlatformWheelEvent&) const;
     ScrollingTreeScrollingNode* scrollingNodeForPoint(LayoutPoint) const override;
 
-#if PLATFORM(COCOA)
-    CALayer *scrollContainerLayer() const { return m_scrollContainerLayer.get(); }
-    CALayer *scrolledContentsLayer() const { return m_scrolledContentsLayer.get(); }
-#endif
+    const LayerRepresentation& scrollContainerLayer() const { return m_scrollContainerLayer; }
+    const LayerRepresentation& scrolledContentsLayer() const { return m_scrolledContentsLayer; }
 
 protected:
     ScrollingTreeScrollingNode(ScrollingTree&, ScrollingNodeType, ScrollingNodeID);
@@ -153,10 +151,8 @@ private:
     bool m_expectsWheelEventTestTrigger { false };
     bool m_isFirstCommit { true };
 
-#if PLATFORM(COCOA)
-    RetainPtr<CALayer> m_scrollContainerLayer;
-    RetainPtr<CALayer> m_scrolledContentsLayer;
-#endif
+    LayerRepresentation m_scrollContainerLayer;
+    LayerRepresentation m_scrolledContentsLayer;
 };
 
 } // namespace WebCore
index 08ad482..d633dfc 100644 (file)
@@ -199,7 +199,7 @@ void ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged()
 void ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers()
 {
     // We use scroll position here because the root content layer is offset to account for scrollOrigin (see FrameView::positionForRootContentLayer).
-    scrolledContentsLayer().position = -currentScrollPosition();
+    static_cast<CALayer*>(scrolledContentsLayer()).position = -currentScrollPosition();
 }
 
 void ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers()
index 5b09793..77d9510 100644 (file)
@@ -91,7 +91,7 @@ FloatPoint ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition(const F
 
 void ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers()
 {
-    [scrollContainerLayer() _web_setLayerBoundsOrigin:currentScrollOffset()];
+    [static_cast<CALayer*>(scrollContainerLayer()) _web_setLayerBoundsOrigin:currentScrollOffset()];
 }
 
 void ScrollingTreeOverflowScrollingNodeMac::repositionRelatedLayers()
index 4a93f3c..0760b42 100644 (file)
@@ -1,5 +1,18 @@
 2019-09-29  Zan Dobersek  <zdobersek@igalia.com>
 
+        ScrollingTreeScrollingNode: use LayerRepresentation for scroll container, scrolled contents layers
+        https://bugs.webkit.org/show_bug.cgi?id=202256
+        <rdar://problem/55772092>
+
+        Reviewed by Simon Fraser.
+
+        * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
+        (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
+        Use static casts to retrieve the CALayer pointers from the
+        LayerRepresentation objects due to the explicit operators.
+
+2019-09-29  Zan Dobersek  <zdobersek@igalia.com>
+
         Tighten up LayerRepresentation operators
         https://bugs.webkit.org/show_bug.cgi?id=202344
 
index 54e0eab..b813bef 100644 (file)
@@ -156,7 +156,7 @@ void RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations(const
             auto* overflowNode = downcast<ScrollingTreeOverflowScrollingNode>(m_scrollingTree->nodeForID(overflowNodeID));
             if (!overflowNode)
                 continue;
-            stationaryScrollContainerIDs.append(RemoteLayerTreeNode::layerID(overflowNode->scrollContainerLayer()));
+            stationaryScrollContainerIDs.append(RemoteLayerTreeNode::layerID(static_cast<CALayer*>(overflowNode->scrollContainerLayer())));
         }
 
         if (auto* layerNode = RemoteLayerTreeNode::forCALayer(positionedNode->layer())) {
@@ -170,7 +170,7 @@ void RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations(const
         if (!overflowNode)
             continue;
         if (auto* layerNode = RemoteLayerTreeNode::forCALayer(scrollProxyNode->layer())) {
-            layerNode->setActingScrollContainerID(RemoteLayerTreeNode::layerID(overflowNode->scrollContainerLayer()));
+            layerNode->setActingScrollContainerID(RemoteLayerTreeNode::layerID(static_cast<CALayer*>(overflowNode->scrollContainerLayer())));
             m_layersWithScrollingRelations.add(layerNode->layerID());
         }
     }