Title: [239658] trunk/Source
Revision
239658
Author
[email protected]
Date
2019-01-05 10:40:18 -0800 (Sat, 05 Jan 2019)

Log Message

Factor legacy WK1 code for fixed and scrolling layers into their own helper class
https://bugs.webkit.org/show_bug.cgi?id=193165

Reviewed by Frédéric Wang.

Source/WebCore:

RenderLayerCompositor has some code to handle registration of viewport-constrained
and scrolling layers which is specific to iOS WK1. To reduce pollution, move this
into its own helper class called LegacyWebKitScrollingLayerCoordinator, which is only
allocated for iOS WK1.

iOS WK1 never has a ScrollingCoordinator, so rather than the check for scrollingCoordinator(),
we know that we only made a LegacyWebKitScrollingLayerCoordinator when there's a platform widget
(i.e. WK1).

* page/ChromeClient.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::RenderLayerCompositor):
(WebCore::RenderLayerCompositor::updateCustomLayersAfterFlush):
(WebCore::RenderLayerCompositor::didFlushChangesForLayer):
(WebCore::RenderLayerCompositor::setIsInWindow):
(WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking): No longer check the page cache state; now we
destroy the render tree of pages in the page cache, so we should never hit this code path.
(WebCore::RenderLayerCompositor::didAddScrollingLayer):
(WebCore::LegacyWebKitScrollingLayerCoordinator::registerAllViewportConstrainedLayers):
(WebCore::LegacyWebKitScrollingLayerCoordinator::unregisterAllViewportConstrainedLayers):
(WebCore::scrollbarHasDisplayNone):
(WebCore::LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer):
(WebCore::LegacyWebKitScrollingLayerCoordinator::registerAllScrollingLayers):
(WebCore::LegacyWebKitScrollingLayerCoordinator::registerScrollingLayersNeedingUpdate):
(WebCore::LegacyWebKitScrollingLayerCoordinator::unregisterAllScrollingLayers):
(WebCore::LegacyWebKitScrollingLayerCoordinator::addScrollingLayer):
(WebCore::LegacyWebKitScrollingLayerCoordinator::removeScrollingLayer):
(WebCore::LegacyWebKitScrollingLayerCoordinator::didFlushChangesForLayer):
(WebCore::updateScrollingLayerWithClient): Deleted.
(WebCore::RenderLayerCompositor::registerAllViewportConstrainedLayers): Deleted.
(WebCore::RenderLayerCompositor::unregisterAllViewportConstrainedLayers): Deleted.
(WebCore::RenderLayerCompositor::registerAllScrollingLayers): Deleted.
(WebCore::RenderLayerCompositor::unregisterAllScrollingLayers): Deleted.
* rendering/RenderLayerCompositor.h:
(WebCore::LegacyWebKitScrollingLayerCoordinator::LegacyWebKitScrollingLayerCoordinator):
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):

Source/WebKitLegacy/ios:

Make the stickyContainerMap argument const. We WTFMove() values out of the first
argument, so it can't be const.

* WebCoreSupport/WebChromeClientIOS.h:
* WebCoreSupport/WebChromeClientIOS.mm:
(WebChromeClientIOS::updateViewportConstrainedLayers):
* WebCoreSupport/WebFixedPositionContent.mm:
(-[WebFixedPositionContent setViewportConstrainedLayers:stickyContainerMap:]):
* WebCoreSupport/WebFixedPositionContentInternal.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (239657 => 239658)


--- trunk/Source/WebCore/ChangeLog	2019-01-05 12:01:10 UTC (rev 239657)
+++ trunk/Source/WebCore/ChangeLog	2019-01-05 18:40:18 UTC (rev 239658)
@@ -1,3 +1,48 @@
+2019-01-04  Simon Fraser  <[email protected]>
+
+        Factor legacy WK1 code for fixed and scrolling layers into their own helper class
+        https://bugs.webkit.org/show_bug.cgi?id=193165
+
+        Reviewed by Frédéric Wang.
+
+        RenderLayerCompositor has some code to handle registration of viewport-constrained
+        and scrolling layers which is specific to iOS WK1. To reduce pollution, move this
+        into its own helper class called LegacyWebKitScrollingLayerCoordinator, which is only
+        allocated for iOS WK1.
+        
+        iOS WK1 never has a ScrollingCoordinator, so rather than the check for scrollingCoordinator(),
+        we know that we only made a LegacyWebKitScrollingLayerCoordinator when there's a platform widget
+        (i.e. WK1).
+        
+        * page/ChromeClient.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::RenderLayerCompositor):
+        (WebCore::RenderLayerCompositor::updateCustomLayersAfterFlush):
+        (WebCore::RenderLayerCompositor::didFlushChangesForLayer):
+        (WebCore::RenderLayerCompositor::setIsInWindow):
+        (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking): No longer check the page cache state; now we
+        destroy the render tree of pages in the page cache, so we should never hit this code path.
+        (WebCore::RenderLayerCompositor::didAddScrollingLayer):
+        (WebCore::LegacyWebKitScrollingLayerCoordinator::registerAllViewportConstrainedLayers):
+        (WebCore::LegacyWebKitScrollingLayerCoordinator::unregisterAllViewportConstrainedLayers):
+        (WebCore::scrollbarHasDisplayNone):
+        (WebCore::LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer):
+        (WebCore::LegacyWebKitScrollingLayerCoordinator::registerAllScrollingLayers):
+        (WebCore::LegacyWebKitScrollingLayerCoordinator::registerScrollingLayersNeedingUpdate):
+        (WebCore::LegacyWebKitScrollingLayerCoordinator::unregisterAllScrollingLayers):
+        (WebCore::LegacyWebKitScrollingLayerCoordinator::addScrollingLayer):
+        (WebCore::LegacyWebKitScrollingLayerCoordinator::removeScrollingLayer):
+        (WebCore::LegacyWebKitScrollingLayerCoordinator::didFlushChangesForLayer):
+        (WebCore::updateScrollingLayerWithClient): Deleted.
+        (WebCore::RenderLayerCompositor::registerAllViewportConstrainedLayers): Deleted.
+        (WebCore::RenderLayerCompositor::unregisterAllViewportConstrainedLayers): Deleted.
+        (WebCore::RenderLayerCompositor::registerAllScrollingLayers): Deleted.
+        (WebCore::RenderLayerCompositor::unregisterAllScrollingLayers): Deleted.
+        * rendering/RenderLayerCompositor.h:
+        (WebCore::LegacyWebKitScrollingLayerCoordinator::LegacyWebKitScrollingLayerCoordinator):
+        * workers/service/ServiceWorkerContainer.cpp:
+        (WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
+
 2019-01-05  Zalan Bujtas  <[email protected]>
 
         [LFC] VerticalMargin should only have the used values.

Modified: trunk/Source/WebCore/page/ChromeClient.h (239657 => 239658)


--- trunk/Source/WebCore/page/ChromeClient.h	2019-01-05 12:01:10 UTC (rev 239657)
+++ trunk/Source/WebCore/page/ChromeClient.h	2019-01-05 18:40:18 UTC (rev 239658)
@@ -262,7 +262,7 @@
 
     virtual bool fetchCustomFixedPositionLayoutRect(IntRect&) { return false; }
 
-    virtual void updateViewportConstrainedLayers(HashMap<PlatformLayer*, std::unique_ptr<ViewportConstraints>>&, HashMap<PlatformLayer*, PlatformLayer*>&) { }
+    virtual void updateViewportConstrainedLayers(HashMap<PlatformLayer*, std::unique_ptr<ViewportConstraints>>&, const HashMap<PlatformLayer*, PlatformLayer*>&) { }
 
     virtual void addOrUpdateScrollingLayer(Node*, PlatformLayer* scrollingLayer, PlatformLayer* contentsLayer, const IntSize& scrollSize, bool allowHorizontalScrollbar, bool allowVerticalScrollbar) = 0;
     virtual void removeScrollingLayer(Node*, PlatformLayer* scrollingLayer, PlatformLayer* contentsLayer) = 0;

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (239657 => 239658)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-01-05 12:01:10 UTC (rev 239657)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-01-05 18:40:18 UTC (rev 239658)
@@ -275,6 +275,10 @@
     , m_updateCompositingLayersTimer(*this, &RenderLayerCompositor::updateCompositingLayersTimerFired)
     , m_layerFlushTimer(*this, &RenderLayerCompositor::layerFlushTimerFired)
 {
+#if PLATFORM(IOS_FAMILY)
+    if (m_renderView.frameView().platformWidget())
+        m_legacyScrollingLayerCoordinator = std::make_unique<LegacyWebKitScrollingLayerCoordinator>(page().chrome().client(), isMainFrameCompositor());
+#endif
 }
 
 RenderLayerCompositor::~RenderLayerCompositor()
@@ -522,40 +526,13 @@
         updateScrollCoordinatedStatus(*layer, ScrollingNodeChangeFlags::Layer);
 }
 
-#if PLATFORM(IOS_FAMILY)
-static bool scrollbarHasDisplayNone(Scrollbar* scrollbar)
-{
-    if (!scrollbar || !scrollbar->isCustomScrollbar())
-        return false;
-
-    std::unique_ptr<RenderStyle> scrollbarStyle = static_cast<RenderScrollbar*>(scrollbar)->getScrollbarPseudoStyle(ScrollbarBGPart, PseudoId::Scrollbar);
-    return scrollbarStyle && scrollbarStyle->display() == DisplayType::None;
-}
-
-// FIXME: Can we make |layer| const RenderLayer&?
-static void updateScrollingLayerWithClient(RenderLayer& layer, ChromeClient& client)
-{
-    auto* backing = layer.backing();
-    ASSERT(backing);
-
-    bool allowHorizontalScrollbar = !scrollbarHasDisplayNone(layer.horizontalScrollbar());
-    bool allowVerticalScrollbar = !scrollbarHasDisplayNone(layer.verticalScrollbar());
-    client.addOrUpdateScrollingLayer(layer.renderer().element(), backing->scrollingLayer()->platformLayer(), backing->scrollingContentsLayer()->platformLayer(),
-        layer.scrollableContentsSize(), allowHorizontalScrollbar, allowVerticalScrollbar);
-}
-#endif
-
 void RenderLayerCompositor::updateCustomLayersAfterFlush()
 {
 #if PLATFORM(IOS_FAMILY)
-    registerAllViewportConstrainedLayers();
-
-    if (!m_scrollingLayersNeedingUpdate.isEmpty()) {
-        for (auto* layer : m_scrollingLayersNeedingUpdate)
-            updateScrollingLayerWithClient(*layer, page().chrome().client());
-        m_scrollingLayersNeedingUpdate.clear();
+    if (m_legacyScrollingLayerCoordinator) {
+        m_legacyScrollingLayerCoordinator->registerAllViewportConstrainedLayers(*this, m_scrollCoordinatedLayers);
+        m_legacyScrollingLayerCoordinator->registerScrollingLayersNeedingUpdate();
     }
-    m_scrollingLayersNeedingUpdate.clear();
 #endif
 }
 
@@ -565,8 +542,8 @@
         m_scrollCoordinatedLayersNeedingUpdate.add(&layer);
 
 #if PLATFORM(IOS_FAMILY)
-    if (m_scrollingLayers.contains(&layer))
-        m_scrollingLayersNeedingUpdate.add(&layer);
+    if (m_legacyScrollingLayerCoordinator)
+        m_legacyScrollingLayerCoordinator->didFlushChangesForLayer(layer);
 #endif
 
     auto* backing = layer.backing();
@@ -2038,8 +2015,10 @@
         RootLayerAttachment attachment = isMainFrameCompositor() ? RootLayerAttachedViaChromeClient : RootLayerAttachedViaEnclosingFrame;
         attachRootLayer(attachment);
 #if PLATFORM(IOS_FAMILY)
-        registerAllViewportConstrainedLayers();
-        registerAllScrollingLayers();
+        if (m_legacyScrollingLayerCoordinator) {
+            m_legacyScrollingLayerCoordinator->registerAllViewportConstrainedLayers(*this, m_scrollCoordinatedLayers);
+            m_legacyScrollingLayerCoordinator->registerAllScrollingLayers();
+        }
 #endif
     } else {
         if (m_rootLayerAttachment == RootLayerUnattached)
@@ -2047,8 +2026,10 @@
 
         detachRootLayer();
 #if PLATFORM(IOS_FAMILY)
-        unregisterAllViewportConstrainedLayers();
-        unregisterAllScrollingLayers();
+        if (m_legacyScrollingLayerCoordinator) {
+            m_legacyScrollingLayerCoordinator->unregisterAllViewportConstrainedLayers();
+            m_legacyScrollingLayerCoordinator->unregisterAllScrollingLayers();
+        }
 #endif
     }
 }
@@ -4002,74 +3983,6 @@
     return m_scrollingNodeToLayerMap.get(nodeID);
 }
 
-#if PLATFORM(IOS_FAMILY)
-typedef HashMap<PlatformLayer*, std::unique_ptr<ViewportConstraints>> LayerMap;
-typedef HashMap<PlatformLayer*, PlatformLayer*> StickyContainerMap;
-
-void RenderLayerCompositor::registerAllViewportConstrainedLayers()
-{
-    // Only the main frame should register fixed/sticky layers.
-    if (!isMainFrameCompositor())
-        return;
-
-    if (scrollingCoordinator())
-        return;
-
-    LayerMap layerMap;
-    StickyContainerMap stickyContainerMap;
-
-    for (auto* layer : m_scrollCoordinatedLayers) {
-        ASSERT(layer->isComposited());
-
-        std::unique_ptr<ViewportConstraints> constraints;
-        if (layer->renderer().isStickilyPositioned()) {
-            constraints = std::make_unique<StickyPositionViewportConstraints>(computeStickyViewportConstraints(*layer));
-            const RenderLayer* enclosingTouchScrollableLayer = nullptr;
-            if (isAsyncScrollableStickyLayer(*layer, &enclosingTouchScrollableLayer) && enclosingTouchScrollableLayer) {
-                ASSERT(enclosingTouchScrollableLayer->isComposited());
-                stickyContainerMap.add(layer->backing()->graphicsLayer()->platformLayer(), enclosingTouchScrollableLayer->backing()->scrollingLayer()->platformLayer());
-            }
-        } else if (layer->renderer().isFixedPositioned())
-            constraints = std::make_unique<FixedPositionViewportConstraints>(computeFixedViewportConstraints(*layer));
-        else
-            continue;
-
-        layerMap.add(layer->backing()->graphicsLayer()->platformLayer(), WTFMove(constraints));
-    }
-    
-    page().chrome().client().updateViewportConstrainedLayers(layerMap, stickyContainerMap);
-}
-
-void RenderLayerCompositor::unregisterAllViewportConstrainedLayers()
-{
-    // Only the main frame should register fixed/sticky layers.
-    if (!isMainFrameCompositor())
-        return;
-
-    if (scrollingCoordinator())
-        return;
-
-    LayerMap layerMap;
-    StickyContainerMap stickyContainerMap;
-    page().chrome().client().updateViewportConstrainedLayers(layerMap, stickyContainerMap);
-}
-
-void RenderLayerCompositor::registerAllScrollingLayers()
-{
-    for (auto* layer : m_scrollingLayers)
-        updateScrollingLayerWithClient(*layer, page().chrome().client());
-}
-
-void RenderLayerCompositor::unregisterAllScrollingLayers()
-{
-    for (auto* layer : m_scrollingLayers) {
-        auto* backing = layer->backing();
-        ASSERT(backing);
-        page().chrome().client().removeScrollingLayer(layer->renderer().element(), backing->scrollingLayer()->platformLayer(), backing->scrollingContentsLayer()->platformLayer());
-    }
-}
-#endif
-
 void RenderLayerCompositor::willRemoveScrollingLayerWithBacking(RenderLayer& layer, RenderLayerBacking& backing)
 {
     if (auto* scrollingCoordinator = this->scrollingCoordinator()) {
@@ -4081,15 +3994,9 @@
     }
 
 #if PLATFORM(IOS_FAMILY)
-    m_scrollingLayersNeedingUpdate.remove(&layer);
-    m_scrollingLayers.remove(&layer);
-
-    if (m_renderView.document().pageCacheState() != Document::NotInPageCache)
-        return;
-
-    auto* scrollingLayer = backing.scrollingLayer()->platformLayer();
-    auto* contentsLayer = backing.scrollingContentsLayer()->platformLayer();
-    page().chrome().client().removeScrollingLayer(layer.renderer().element(), scrollingLayer, contentsLayer);
+    ASSERT(m_renderView.document().pageCacheState() == Document::NotInPageCache);
+    if (m_legacyScrollingLayerCoordinator)
+        m_legacyScrollingLayerCoordinator->removeScrollingLayer(layer, backing);
 #endif
 }
 
@@ -4105,7 +4012,8 @@
 
 #if PLATFORM(IOS_FAMILY)
     ASSERT(m_renderView.document().pageCacheState() == Document::NotInPageCache);
-    m_scrollingLayers.add(&layer);
+    if (m_legacyScrollingLayerCoordinator)
+        m_legacyScrollingLayerCoordinator->addScrollingLayer(layer);
 #endif
 }
 
@@ -4222,6 +4130,115 @@
     return ts;
 }
 
+#if PLATFORM(IOS_FAMILY)
+typedef HashMap<PlatformLayer*, std::unique_ptr<ViewportConstraints>> LayerMap;
+typedef HashMap<PlatformLayer*, PlatformLayer*> StickyContainerMap;
+
+void LegacyWebKitScrollingLayerCoordinator::registerAllViewportConstrainedLayers(RenderLayerCompositor& compositor, const HashSet<RenderLayer*>& layers)
+{
+    if (!m_coordinateViewportConstainedLayers)
+        return;
+
+    LayerMap layerMap;
+    StickyContainerMap stickyContainerMap;
+
+    for (auto* layer : layers) {
+        ASSERT(layer->isComposited());
+
+        std::unique_ptr<ViewportConstraints> constraints;
+        if (layer->renderer().isStickilyPositioned()) {
+            constraints = std::make_unique<StickyPositionViewportConstraints>(compositor.computeStickyViewportConstraints(*layer));
+            const RenderLayer* enclosingTouchScrollableLayer = nullptr;
+            if (compositor.isAsyncScrollableStickyLayer(*layer, &enclosingTouchScrollableLayer) && enclosingTouchScrollableLayer) {
+                ASSERT(enclosingTouchScrollableLayer->isComposited());
+                stickyContainerMap.add(layer->backing()->graphicsLayer()->platformLayer(), enclosingTouchScrollableLayer->backing()->scrollingLayer()->platformLayer());
+            }
+        } else if (layer->renderer().isFixedPositioned())
+            constraints = std::make_unique<FixedPositionViewportConstraints>(compositor.computeFixedViewportConstraints(*layer));
+        else
+            continue;
+
+        layerMap.add(layer->backing()->graphicsLayer()->platformLayer(), WTFMove(constraints));
+    }
+    
+    m_chromeClient.updateViewportConstrainedLayers(layerMap, stickyContainerMap);
+}
+
+void LegacyWebKitScrollingLayerCoordinator::unregisterAllViewportConstrainedLayers()
+{
+    if (!m_coordinateViewportConstainedLayers)
+        return;
+
+    LayerMap layerMap;
+    m_chromeClient.updateViewportConstrainedLayers(layerMap, { });
+}
+
+static bool scrollbarHasDisplayNone(Scrollbar* scrollbar)
+{
+    if (!scrollbar || !scrollbar->isCustomScrollbar())
+        return false;
+
+    std::unique_ptr<RenderStyle> scrollbarStyle = static_cast<RenderScrollbar*>(scrollbar)->getScrollbarPseudoStyle(ScrollbarBGPart, PseudoId::Scrollbar);
+    return scrollbarStyle && scrollbarStyle->display() == DisplayType::None;
+}
+
+void LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer(RenderLayer& layer)
+{
+    auto* backing = layer.backing();
+    ASSERT(backing);
+
+    bool allowHorizontalScrollbar = !scrollbarHasDisplayNone(layer.horizontalScrollbar());
+    bool allowVerticalScrollbar = !scrollbarHasDisplayNone(layer.verticalScrollbar());
+    m_chromeClient.addOrUpdateScrollingLayer(layer.renderer().element(), backing->scrollingLayer()->platformLayer(), backing->scrollingContentsLayer()->platformLayer(),
+        layer.scrollableContentsSize(), allowHorizontalScrollbar, allowVerticalScrollbar);
+}
+
+void LegacyWebKitScrollingLayerCoordinator::registerAllScrollingLayers()
+{
+    for (auto* layer : m_scrollingLayers)
+        updateScrollingLayer(*layer);
+}
+
+void LegacyWebKitScrollingLayerCoordinator::registerScrollingLayersNeedingUpdate()
+{
+    for (auto* layer : m_scrollingLayersNeedingUpdate)
+        updateScrollingLayer(*layer);
+    
+    m_scrollingLayersNeedingUpdate.clear();
+}
+
+void LegacyWebKitScrollingLayerCoordinator::unregisterAllScrollingLayers()
+{
+    for (auto* layer : m_scrollingLayers) {
+        auto* backing = layer->backing();
+        ASSERT(backing);
+        m_chromeClient.removeScrollingLayer(layer->renderer().element(), backing->scrollingLayer()->platformLayer(), backing->scrollingContentsLayer()->platformLayer());
+    }
+}
+
+void LegacyWebKitScrollingLayerCoordinator::addScrollingLayer(RenderLayer& layer)
+{
+    m_scrollingLayers.add(&layer);
+}
+
+void LegacyWebKitScrollingLayerCoordinator::removeScrollingLayer(RenderLayer& layer, RenderLayerBacking& backing)
+{
+    m_scrollingLayersNeedingUpdate.remove(&layer);
+    m_scrollingLayers.remove(&layer);
+
+    auto* scrollingLayer = backing.scrollingLayer()->platformLayer();
+    auto* contentsLayer = backing.scrollingContentsLayer()->platformLayer();
+    m_chromeClient.removeScrollingLayer(layer.renderer().element(), scrollingLayer, contentsLayer);
+}
+
+void LegacyWebKitScrollingLayerCoordinator::didFlushChangesForLayer(RenderLayer& layer)
+{
+    if (m_scrollingLayers.contains(&layer))
+        m_scrollingLayersNeedingUpdate.add(&layer);
+}
+
+#endif
+
 } // namespace WebCore
 
 #if ENABLE(TREE_DEBUGGING)

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (239657 => 239658)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2019-01-05 12:01:10 UTC (rev 239657)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2019-01-05 18:40:18 UTC (rev 239658)
@@ -88,6 +88,37 @@
     Scrolling           = 1 << 1
 };
 
+#if PLATFORM(IOS_FAMILY)
+class LegacyWebKitScrollingLayerCoordinator {
+public:
+    LegacyWebKitScrollingLayerCoordinator(ChromeClient& chromeClient, bool coordinateViewportConstainedLayers)
+        : m_chromeClient(chromeClient)
+        , m_coordinateViewportConstainedLayers(coordinateViewportConstainedLayers)
+    {
+    }
+
+    void registerAllViewportConstrainedLayers(RenderLayerCompositor&, const HashSet<RenderLayer*>&);
+    void unregisterAllViewportConstrainedLayers();
+    
+    void registerAllScrollingLayers();
+    void registerScrollingLayersNeedingUpdate();
+    void unregisterAllScrollingLayers();
+    
+    void addScrollingLayer(RenderLayer&);
+    void removeScrollingLayer(RenderLayer&, RenderLayerBacking&);
+
+    void didFlushChangesForLayer(RenderLayer&);
+
+private:
+    void updateScrollingLayer(RenderLayer&);
+
+    ChromeClient& m_chromeClient;
+    HashSet<RenderLayer*> m_scrollingLayers;
+    HashSet<RenderLayer*> m_scrollingLayersNeedingUpdate;
+    const bool m_coordinateViewportConstainedLayers;
+};
+#endif
+
 // RenderLayerCompositor manages the hierarchy of
 // composited RenderLayers. It determines which RenderLayers
 // become compositing, and creates and maintains a hierarchy of
@@ -97,6 +128,7 @@
 
 class RenderLayerCompositor final : public GraphicsLayerClient, public GraphicsLayerUpdaterClient {
     WTF_MAKE_FAST_ALLOCATED;
+    friend class LegacyWebKitScrollingLayerCoordinator;
 public:
     explicit RenderLayerCompositor(RenderView&);
     virtual ~RenderLayerCompositor();
@@ -296,14 +328,6 @@
     void willRemoveScrollingLayerWithBacking(RenderLayer&, RenderLayerBacking&);
     void didAddScrollingLayer(RenderLayer&);
 
-#if PLATFORM(IOS_FAMILY)
-    void registerAllViewportConstrainedLayers();
-    void unregisterAllViewportConstrainedLayers();
-
-    void registerAllScrollingLayers();
-    void unregisterAllScrollingLayers();
-#endif
-
     void resetTrackedRepaintRects();
     void setTracksRepaints(bool tracksRepaints) { m_isTrackingRepaints = tracksRepaints; }
 
@@ -526,10 +550,6 @@
     RefPtr<GraphicsLayer> m_clipLayer;
     RefPtr<GraphicsLayer> m_scrollLayer;
 
-#if PLATFORM(IOS_FAMILY)
-    HashSet<RenderLayer*> m_scrollingLayers;
-    HashSet<RenderLayer*> m_scrollingLayersNeedingUpdate;
-#endif
     HashSet<RenderLayer*> m_scrollCoordinatedLayers;
     HashSet<RenderLayer*> m_scrollCoordinatedLayersNeedingUpdate;
 
@@ -570,6 +590,9 @@
     Color m_rootExtendedBackgroundColor;
 
     HashMap<ScrollingNodeID, RenderLayer*> m_scrollingNodeToLayerMap;
+#if PLATFORM(IOS_FAMILY)
+    std::unique_ptr<LegacyWebKitScrollingLayerCoordinator> m_legacyScrollingLayerCoordinator;
+#endif
 };
 
 void paintScrollbar(Scrollbar*, GraphicsContext&, const IntRect& clip);

Modified: trunk/Source/WebKitLegacy/ios/ChangeLog (239657 => 239658)


--- trunk/Source/WebKitLegacy/ios/ChangeLog	2019-01-05 12:01:10 UTC (rev 239657)
+++ trunk/Source/WebKitLegacy/ios/ChangeLog	2019-01-05 18:40:18 UTC (rev 239658)
@@ -1,3 +1,20 @@
+2019-01-04  Simon Fraser  <[email protected]>
+
+        Factor legacy WK1 code for fixed and scrolling layers into their own helper class
+        https://bugs.webkit.org/show_bug.cgi?id=193165
+
+        Reviewed by Frédéric Wang.
+
+        Make the stickyContainerMap argument const. We WTFMove() values out of the first
+        argument, so it can't be const.
+
+        * WebCoreSupport/WebChromeClientIOS.h:
+        * WebCoreSupport/WebChromeClientIOS.mm:
+        (WebChromeClientIOS::updateViewportConstrainedLayers):
+        * WebCoreSupport/WebFixedPositionContent.mm:
+        (-[WebFixedPositionContent setViewportConstrainedLayers:stickyContainerMap:]):
+        * WebCoreSupport/WebFixedPositionContentInternal.h:
+
 2018-12-20  Yusuke Suzuki  <[email protected]>
 
         Use Ref<> as much as possible

Modified: trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h (239657 => 239658)


--- trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h	2019-01-05 12:01:10 UTC (rev 239657)
+++ trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h	2019-01-05 18:40:18 UTC (rev 239658)
@@ -78,7 +78,7 @@
 
     void didFlushCompositingLayers() final;
 
-    void updateViewportConstrainedLayers(HashMap<PlatformLayer*, std::unique_ptr<WebCore::ViewportConstraints>>&, HashMap<PlatformLayer*, PlatformLayer*>&) final;
+    void updateViewportConstrainedLayers(HashMap<PlatformLayer*, std::unique_ptr<WebCore::ViewportConstraints>>&, const HashMap<PlatformLayer*, PlatformLayer*>&) final;
 
     bool fetchCustomFixedPositionLayoutRect(WebCore::IntRect&) final;
     void addOrUpdateScrollingLayer(WebCore::Node*, PlatformLayer*, PlatformLayer*, const WebCore::IntSize&, bool allowHorizontalScrollbar, bool allowVerticalScrollbar) final;

Modified: trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm (239657 => 239658)


--- trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm	2019-01-05 12:01:10 UTC (rev 239657)
+++ trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm	2019-01-05 18:40:18 UTC (rev 239658)
@@ -340,7 +340,7 @@
     return false;
 }
 
-void WebChromeClientIOS::updateViewportConstrainedLayers(HashMap<PlatformLayer*, std::unique_ptr<ViewportConstraints>>& layerMap, HashMap<PlatformLayer*, PlatformLayer*>& stickyContainers)
+void WebChromeClientIOS::updateViewportConstrainedLayers(HashMap<PlatformLayer*, std::unique_ptr<ViewportConstraints>>& layerMap, const HashMap<PlatformLayer*, PlatformLayer*>& stickyContainers)
 {
     [[webView() _fixedPositionContent] setViewportConstrainedLayers:layerMap stickyContainerMap:stickyContainers];
 }

Modified: trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebFixedPositionContent.mm (239657 => 239658)


--- trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebFixedPositionContent.mm	2019-01-05 12:01:10 UTC (rev 239657)
+++ trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebFixedPositionContent.mm	2019-01-05 18:40:18 UTC (rev 239658)
@@ -170,7 +170,7 @@
     });
 }
 
-- (void)setViewportConstrainedLayers:(WTF::HashMap<CALayer *, std::unique_ptr<WebCore::ViewportConstraints>>&)layerMap stickyContainerMap:(WTF::HashMap<CALayer*, CALayer*>&)stickyContainers
+- (void)setViewportConstrainedLayers:(WTF::HashMap<CALayer *, std::unique_ptr<WebCore::ViewportConstraints>>&)layerMap stickyContainerMap:(const WTF::HashMap<CALayer*, CALayer*>&)stickyContainers
 {
     auto locker = holdLock(webFixedPositionContentDataLock);
 

Modified: trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebFixedPositionContentInternal.h (239657 => 239658)


--- trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebFixedPositionContentInternal.h	2019-01-05 12:01:10 UTC (rev 239657)
+++ trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebFixedPositionContentInternal.h	2019-01-05 18:40:18 UTC (rev 239658)
@@ -35,6 +35,6 @@
 @interface WebFixedPositionContent(WebKitInternal)
 // Called from inside WebKit.
 
-- (void)setViewportConstrainedLayers:(WTF::HashMap<CALayer *, std::unique_ptr<WebCore::ViewportConstraints>>&)layerMap stickyContainerMap:(WTF::HashMap<CALayer*, CALayer*>&)stickyContainers;
+- (void)setViewportConstrainedLayers:(WTF::HashMap<CALayer *, std::unique_ptr<WebCore::ViewportConstraints>>&)layerMap stickyContainerMap:(const WTF::HashMap<CALayer*, CALayer*>&)stickyContainers;
 
 @end
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to