REGRESSION(r240047): Overflow scrollers on WK1 fail to update their content size...
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Jul 2019 18:09:27 +0000 (18:09 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Jul 2019 18:09:27 +0000 (18:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=199360
<rdar://problem/51643386>

Reviewed by Simon Fraser.

r240047 replaced didCommitChangesForLayer() mechanism by a more narrow didChangePlatformLayerForLayer.
Unfortunately on WK1 we relied on scroll layers being invalidated after every size (and scrollbar) change.
Without this invalidation we don't call WebChromeClientIOS::addOrUpdateScrollingLayer and the UIKit delegate
that resizes the UIScrollView content.

Fix by removing the scroll layer invalidation mechanism from LegacyWebKitScrollingLayerCoordinator completely and instead
simply update all scroll layers after commit. The UIKit delegate doesn't do any significant work if nothing changes,
this was not a very meaninful optimization.

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlush):

Update all scroll layers after flush (similar to viewport constrained layers).

(WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
(WebCore::LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer):
(WebCore::LegacyWebKitScrollingLayerCoordinator::addScrollingLayer):
(WebCore::LegacyWebKitScrollingLayerCoordinator::removeScrollingLayer):
(WebCore::LegacyWebKitScrollingLayerCoordinator::registerScrollingLayersNeedingUpdate): Deleted.
(WebCore::LegacyWebKitScrollingLayerCoordinator::didChangePlatformLayerForLayer): Deleted.
* rendering/RenderLayerCompositor.h:

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderLayerCompositor.h

index 75890a7..6e202fd 100644 (file)
@@ -1,3 +1,33 @@
+2019-07-01  Antti Koivisto  <antti@apple.com>
+
+        REGRESSION(r240047): Overflow scrollers on WK1 fail to update their content size when it changes
+        https://bugs.webkit.org/show_bug.cgi?id=199360
+        <rdar://problem/51643386>
+
+        Reviewed by Simon Fraser.
+
+        r240047 replaced didCommitChangesForLayer() mechanism by a more narrow didChangePlatformLayerForLayer.
+        Unfortunately on WK1 we relied on scroll layers being invalidated after every size (and scrollbar) change.
+        Without this invalidation we don't call WebChromeClientIOS::addOrUpdateScrollingLayer and the UIKit delegate
+        that resizes the UIScrollView content.
+
+        Fix by removing the scroll layer invalidation mechanism from LegacyWebKitScrollingLayerCoordinator completely and instead
+        simply update all scroll layers after commit. The UIKit delegate doesn't do any significant work if nothing changes,
+        this was not a very meaninful optimization.
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlush):
+
+        Update all scroll layers after flush (similar to viewport constrained layers).
+
+        (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
+        (WebCore::LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer):
+        (WebCore::LegacyWebKitScrollingLayerCoordinator::addScrollingLayer):
+        (WebCore::LegacyWebKitScrollingLayerCoordinator::removeScrollingLayer):
+        (WebCore::LegacyWebKitScrollingLayerCoordinator::registerScrollingLayersNeedingUpdate): Deleted.
+        (WebCore::LegacyWebKitScrollingLayerCoordinator::didChangePlatformLayerForLayer): Deleted.
+        * rendering/RenderLayerCompositor.h:
+
 2019-07-01  Philippe Normand  <pnormand@igalia.com>
 
         [GStreamer] Cannot play Bert's Bytes radio stream from http://radio.dos.nl/
index ffa15da..9060820 100644 (file)
@@ -557,18 +557,13 @@ void RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlush()
 {
     if (m_legacyScrollingLayerCoordinator) {
         m_legacyScrollingLayerCoordinator->registerAllViewportConstrainedLayers(*this);
-        m_legacyScrollingLayerCoordinator->registerScrollingLayersNeedingUpdate();
+        m_legacyScrollingLayerCoordinator->registerAllScrollingLayers();
     }
 }
 #endif
 
 void RenderLayerCompositor::didChangePlatformLayerForLayer(RenderLayer& layer, const GraphicsLayer*)
 {
-#if PLATFORM(IOS_FAMILY)
-    if (m_legacyScrollingLayerCoordinator)
-        m_legacyScrollingLayerCoordinator->didChangePlatformLayerForLayer(layer);
-#endif
-
     auto* scrollingCoordinator = this->scrollingCoordinator();
     if (!scrollingCoordinator)
         return;
@@ -4777,6 +4772,7 @@ void LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer(RenderLayer& la
 
     bool allowHorizontalScrollbar = !layer.horizontalScrollbarHiddenByStyle();
     bool allowVerticalScrollbar = !layer.verticalScrollbarHiddenByStyle();
+
     m_chromeClient.addOrUpdateScrollingLayer(layer.renderer().element(), backing->scrollContainerLayer()->platformLayer(), backing->scrolledContentsLayer()->platformLayer(),
         layer.reachableTotalContentsSize(), allowHorizontalScrollbar, allowVerticalScrollbar);
 }
@@ -4787,14 +4783,6 @@ void LegacyWebKitScrollingLayerCoordinator::registerAllScrollingLayers()
         updateScrollingLayer(*layer);
 }
 
-void LegacyWebKitScrollingLayerCoordinator::registerScrollingLayersNeedingUpdate()
-{
-    for (auto* layer : m_scrollingLayersNeedingUpdate)
-        updateScrollingLayer(*layer);
-    
-    m_scrollingLayersNeedingUpdate.clear();
-}
-
 void LegacyWebKitScrollingLayerCoordinator::unregisterAllScrollingLayers()
 {
     for (auto* layer : m_scrollingLayers) {
@@ -4807,12 +4795,10 @@ void LegacyWebKitScrollingLayerCoordinator::unregisterAllScrollingLayers()
 void LegacyWebKitScrollingLayerCoordinator::addScrollingLayer(RenderLayer& layer)
 {
     m_scrollingLayers.add(&layer);
-    m_scrollingLayersNeedingUpdate.add(&layer);
 }
 
 void LegacyWebKitScrollingLayerCoordinator::removeScrollingLayer(RenderLayer& layer, RenderLayerBacking& backing)
 {
-    m_scrollingLayersNeedingUpdate.remove(&layer);
     if (m_scrollingLayers.remove(&layer)) {
         auto* scrollContainerLayer = backing.scrollContainerLayer()->platformLayer();
         auto* scrolledContentsLayer = backing.scrolledContentsLayer()->platformLayer();
@@ -4838,12 +4824,6 @@ void LegacyWebKitScrollingLayerCoordinator::removeViewportConstrainedLayer(Rende
     m_viewportConstrainedLayers.remove(&layer);
 }
 
-void LegacyWebKitScrollingLayerCoordinator::didChangePlatformLayerForLayer(RenderLayer& layer)
-{
-    if (m_scrollingLayers.contains(&layer))
-        m_scrollingLayersNeedingUpdate.add(&layer);
-}
-
 #endif
 
 } // namespace WebCore
index ec35d7c..1135951 100644 (file)
@@ -118,7 +118,6 @@ public:
     void unregisterAllViewportConstrainedLayers();
     
     void registerAllScrollingLayers();
-    void registerScrollingLayersNeedingUpdate();
     void unregisterAllScrollingLayers();
     
     void addScrollingLayer(RenderLayer&);
@@ -127,8 +126,6 @@ public:
     void addViewportConstrainedLayer(RenderLayer&);
     void removeViewportConstrainedLayer(RenderLayer&);
 
-    void didChangePlatformLayerForLayer(RenderLayer&);
-
     void removeLayer(RenderLayer&);
 
 private:
@@ -139,7 +136,6 @@ private:
     HashSet<RenderLayer*> m_scrollingLayers;
     HashSet<RenderLayer*> m_viewportConstrainedLayers;
 
-    HashSet<RenderLayer*> m_scrollingLayersNeedingUpdate;
     const bool m_coordinateViewportConstrainedLayers;
 };
 #endif