Title: [260186] trunk/Source/WebKit
Revision
260186
Author
timothy_hor...@apple.com
Date
2020-04-16 08:33:34 -0700 (Thu, 16 Apr 2020)

Log Message

REGRESSION (r259898): WebKit-based Books views are all blank
https://bugs.webkit.org/show_bug.cgi?id=210590
<rdar://problem/61791109>

Reviewed by Chris Dumez.

* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::enterAcceleratedCompositingWithRootLayer):
(WebKit::WebViewImpl::setAcceleratedCompositingRootLayer):
(WebKit::WebViewImpl::setAcceleratedCompositingRootLayerAfterFlush): Deleted.
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::enterAcceleratedCompositingMode):
(WebKit::PageClientImpl::didFirstLayerFlush):
The changes to setAcceleratedCompositingRootLayer in r259898 proved
to be wrong in a second way (the first being fixed in r260104): when
setAcceleratedCompositingRootLayer is called from updateAcceleratedCompositingMode,
because the layer hosting mode changed (Books appears to use app-hosted layers),
it incorrectly identified the root layer change as a process swap, resulting
in the correct layer never being unhidden.

This is enough mistakes that I'm going to try a different approach:
put setAcceleratedCompositingRootLayer back to the way it was before, where
it immediately updates the layer without any smarts, remove
setAcceleratedCompositingRootLayerAfterFlush, because it's no longer necessary,
and add enterAcceleratedCompositingWithRootLayer, which is specifically only
called in the case where DrawingArea will for-sure send us a follow-up
(didFirstLayerFlush) that will unhide the root layer.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (260185 => 260186)


--- trunk/Source/WebKit/ChangeLog	2020-04-16 14:55:32 UTC (rev 260185)
+++ trunk/Source/WebKit/ChangeLog	2020-04-16 15:33:34 UTC (rev 260186)
@@ -1,3 +1,34 @@
+2020-04-16  Tim Horton  <timothy_hor...@apple.com>
+
+        REGRESSION (r259898): WebKit-based Books views are all blank
+        https://bugs.webkit.org/show_bug.cgi?id=210590
+        <rdar://problem/61791109>
+
+        Reviewed by Chris Dumez.
+
+        * UIProcess/Cocoa/WebViewImpl.h:
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::enterAcceleratedCompositingWithRootLayer):
+        (WebKit::WebViewImpl::setAcceleratedCompositingRootLayer):
+        (WebKit::WebViewImpl::setAcceleratedCompositingRootLayerAfterFlush): Deleted.
+        * UIProcess/mac/PageClientImplMac.mm:
+        (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
+        (WebKit::PageClientImpl::didFirstLayerFlush):
+        The changes to setAcceleratedCompositingRootLayer in r259898 proved
+        to be wrong in a second way (the first being fixed in r260104): when
+        setAcceleratedCompositingRootLayer is called from updateAcceleratedCompositingMode,
+        because the layer hosting mode changed (Books appears to use app-hosted layers),
+        it incorrectly identified the root layer change as a process swap, resulting
+        in the correct layer never being unhidden.
+
+        This is enough mistakes that I'm going to try a different approach:
+        put setAcceleratedCompositingRootLayer back to the way it was before, where
+        it immediately updates the layer without any smarts, remove
+        setAcceleratedCompositingRootLayerAfterFlush, because it's no longer necessary,
+        and add enterAcceleratedCompositingWithRootLayer, which is specifically only
+        called in the case where DrawingArea will for-sure send us a follow-up
+        (didFirstLayerFlush) that will unhide the root layer.
+
 2020-04-16  Eric Carlson  <eric.carl...@apple.com>
 
         [macOS] Update ScreenTime as playback state changes

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h (260185 => 260186)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h	2020-04-16 14:55:32 UTC (rev 260185)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h	2020-04-16 15:33:34 UTC (rev 260186)
@@ -431,8 +431,8 @@
     NSString *stringForToolTip(NSToolTipTag tag);
     void toolTipChanged(const String& oldToolTip, const String& newToolTip);
 
+    void enterAcceleratedCompositingWithRootLayer(CALayer *);
     void setAcceleratedCompositingRootLayer(CALayer *);
-    void setAcceleratedCompositingRootLayerAfterFlush(CALayer *);
     CALayer *acceleratedCompositingRootLayer() const { return m_rootLayer.get(); }
 
     void setThumbnailView(_WKThumbnailView *);

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (260185 => 260186)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2020-04-16 14:55:32 UTC (rev 260185)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2020-04-16 15:33:34 UTC (rev 260186)
@@ -3804,17 +3804,17 @@
     }
 }
 
-void WebViewImpl::setAcceleratedCompositingRootLayer(CALayer *rootLayer)
+void WebViewImpl::enterAcceleratedCompositingWithRootLayer(CALayer *rootLayer)
 {
-    [rootLayer web_disableAllActions];
-
     // This is the process-swap case. We add the new layer behind the existing root layer and mark it as hidden.
     // This way, the new layer gets accelerated compositing but won't be visible until
-    // setAcceleratedCompositingRootLayerAfterFlush() is called, in order to prevent flashing.
+    // setAcceleratedCompositingRootLayer() is called by didFirstLayerFlush(), in order to prevent flashing.
     if (m_rootLayer && rootLayer && m_rootLayer != rootLayer) {
         if (m_thumbnailView)
             return;
 
+        [rootLayer web_disableAllActions];
+
         [CATransaction begin];
         [CATransaction setDisableActions:YES];
 
@@ -3825,6 +3825,13 @@
         return;
     }
 
+    setAcceleratedCompositingRootLayer(rootLayer);
+}
+
+void WebViewImpl::setAcceleratedCompositingRootLayer(CALayer *rootLayer)
+{
+    [rootLayer web_disableAllActions];
+
     m_rootLayer = rootLayer;
     rootLayer.hidden = NO;
 
@@ -3841,12 +3848,6 @@
     [CATransaction commit];
 }
 
-void WebViewImpl::setAcceleratedCompositingRootLayerAfterFlush(CALayer *rootLayer)
-{
-    m_rootLayer = nullptr; // Make sure we replace the existing layer.
-    setAcceleratedCompositingRootLayer(rootLayer);
-}
-
 void WebViewImpl::setThumbnailView(_WKThumbnailView *thumbnailView)
 {
     ASSERT(!m_thumbnailView || !thumbnailView);

Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm (260185 => 260186)


--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm	2020-04-16 14:55:32 UTC (rev 260185)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm	2020-04-16 15:33:34 UTC (rev 260186)
@@ -530,7 +530,7 @@
     ASSERT(!layerTreeContext.isEmpty());
 
     CALayer *renderLayer = [CALayer _web_renderLayerWithContextID:layerTreeContext.contextID];
-    m_impl->setAcceleratedCompositingRootLayer(renderLayer);
+    m_impl->enterAcceleratedCompositingWithRootLayer(renderLayer);
 }
 
 void PageClientImpl::didFirstLayerFlush(const LayerTreeContext& layerTreeContext)
@@ -538,7 +538,7 @@
     ASSERT(!layerTreeContext.isEmpty());
 
     CALayer *renderLayer = [CALayer _web_renderLayerWithContextID:layerTreeContext.contextID];
-    m_impl->setAcceleratedCompositingRootLayerAfterFlush(renderLayer);
+    m_impl->setAcceleratedCompositingRootLayer(renderLayer);
 }
 
 void PageClientImpl::exitAcceleratedCompositingMode()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to