Title: [250269] branches/safari-608-branch/Source/WebKit
Revision
250269
Author
[email protected]
Date
2019-09-23 17:13:20 -0700 (Mon, 23 Sep 2019)

Log Message

Cherry-pick r250069. rdar://problem/55524981

    Eagerly create and add the m_layerHostingView to WKWebView.
    https://bugs.webkit.org/show_bug.cgi?id=201942

    Reviewed by Tim Horton.

    Some apps will add subviews to WKWebView, and by the time we add our m_layerHostingView view we might be
    adding it behind a view that should have been added behind our layer hosting view subview. This affected
    the Spark email app, due to changes in order of loading delegate calls and when compositing is enabled.
    Instead of delayed creation of m_layerHostingView, always create it and add it to to the WKWebView.
    This ensures proper ordering of subviews when clients add a view behind all existing subviews.

    * UIProcess/Cocoa/WebViewImpl.mm:
    (WebKit::WebViewImpl::WebViewImpl): Create and add m_layerHostingView here.
    (WebKit::WebViewImpl::setAcceleratedCompositingRootLayer): Remove creation and removal of m_layerHostingView.
    Just set the sublayers of m_layerHostingView's layer here.

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

Modified Paths

Diff

Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (250268 => 250269)


--- branches/safari-608-branch/Source/WebKit/ChangeLog	2019-09-24 00:13:15 UTC (rev 250268)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog	2019-09-24 00:13:20 UTC (rev 250269)
@@ -1,5 +1,46 @@
 2019-09-23  Alan Coon  <[email protected]>
 
+        Cherry-pick r250069. rdar://problem/55524981
+
+    Eagerly create and add the m_layerHostingView to WKWebView.
+    https://bugs.webkit.org/show_bug.cgi?id=201942
+    
+    Reviewed by Tim Horton.
+    
+    Some apps will add subviews to WKWebView, and by the time we add our m_layerHostingView view we might be
+    adding it behind a view that should have been added behind our layer hosting view subview. This affected
+    the Spark email app, due to changes in order of loading delegate calls and when compositing is enabled.
+    Instead of delayed creation of m_layerHostingView, always create it and add it to to the WKWebView.
+    This ensures proper ordering of subviews when clients add a view behind all existing subviews.
+    
+    * UIProcess/Cocoa/WebViewImpl.mm:
+    (WebKit::WebViewImpl::WebViewImpl): Create and add m_layerHostingView here.
+    (WebKit::WebViewImpl::setAcceleratedCompositingRootLayer): Remove creation and removal of m_layerHostingView.
+    Just set the sublayers of m_layerHostingView's layer here.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250069 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-09-18  Timothy Hatcher  <[email protected]>
+
+            Eagerly create and add the m_layerHostingView to WKWebView.
+            https://bugs.webkit.org/show_bug.cgi?id=201942
+
+            Reviewed by Tim Horton.
+
+            Some apps will add subviews to WKWebView, and by the time we add our m_layerHostingView view we might be
+            adding it behind a view that should have been added behind our layer hosting view subview. This affected
+            the Spark email app, due to changes in order of loading delegate calls and when compositing is enabled.
+            Instead of delayed creation of m_layerHostingView, always create it and add it to to the WKWebView.
+            This ensures proper ordering of subviews when clients add a view behind all existing subviews.
+
+            * UIProcess/Cocoa/WebViewImpl.mm:
+            (WebKit::WebViewImpl::WebViewImpl): Create and add m_layerHostingView here.
+            (WebKit::WebViewImpl::setAcceleratedCompositingRootLayer): Remove creation and removal of m_layerHostingView.
+            Just set the sublayers of m_layerHostingView's layer here.
+
+2019-09-23  Alan Coon  <[email protected]>
+
         Apply patch. rdar://problem/55608031
 
     Clean up handling of summary items and payment method updates https://bugs.webkit.org/show_bug.cgi?id=202018 <rdar://problem/55470632>

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (250268 => 250269)


--- branches/safari-608-branch/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2019-09-24 00:13:15 UTC (rev 250268)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2019-09-24 00:13:20 UTC (rev 250269)
@@ -1351,6 +1351,22 @@
 
     [view addTrackingArea:m_primaryTrackingArea.get()];
 
+    // Create an NSView that will host our layer tree.
+    m_layerHostingView = adoptNS([[WKFlippedView alloc] initWithFrame:[m_view bounds]]);
+    [m_layerHostingView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+
+    [view addSubview:m_layerHostingView.get() positioned:NSWindowBelow relativeTo:nil];
+
+    // Create a root layer that will back the NSView.
+    RetainPtr<CALayer> layer = adoptNS([[CALayer alloc] init]);
+    [layer setDelegate:[WebActionDisablingCALayerDelegate shared]];
+#ifndef NDEBUG
+    [layer setName:@"Hosting root layer"];
+#endif
+
+    [m_layerHostingView setLayer:layer.get()];
+    [m_layerHostingView setWantsLayer:YES];
+
     m_page->setIntrinsicDeviceScaleFactor(intrinsicDeviceScaleFactor());
 
     if (Class gestureClass = NSClassFromString(@"NSImmediateActionGestureRecognizer")) {
@@ -3765,34 +3781,8 @@
     [CATransaction begin];
     [CATransaction setDisableActions:YES];
 
-    if (rootLayer) {
-        if (!m_layerHostingView) {
-            // Create an NSView that will host our layer tree.
-            m_layerHostingView = adoptNS([[WKFlippedView alloc] initWithFrame:[m_view bounds]]);
-            [m_layerHostingView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+    [m_layerHostingView layer].sublayers = rootLayer ? @[ rootLayer ] : nil;
 
-            [m_view addSubview:m_layerHostingView.get() positioned:NSWindowBelow relativeTo:nil];
-
-            // Create a root layer that will back the NSView.
-            RetainPtr<CALayer> layer = adoptNS([[CALayer alloc] init]);
-            [layer setDelegate:[WebActionDisablingCALayerDelegate shared]];
-#ifndef NDEBUG
-            [layer setName:@"Hosting root layer"];
-#endif
-
-            [m_layerHostingView setLayer:layer.get()];
-            [m_layerHostingView setWantsLayer:YES];
-        }
-
-        [m_layerHostingView layer].sublayers = [NSArray arrayWithObject:rootLayer];
-    } else if (m_layerHostingView) {
-        [m_layerHostingView removeFromSuperview];
-        [m_layerHostingView setLayer:nil];
-        [m_layerHostingView setWantsLayer:NO];
-
-        m_layerHostingView = nullptr;
-    }
-
     [CATransaction commit];
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to