WKThumbnailView should only use live layer trees before the snapshot arrives for...
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jun 2014 22:38:21 +0000 (22:38 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jun 2014 22:38:21 +0000 (22:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=134129
<rdar://problem/17401591>

Reviewed by Anders Carlsson.

* UIProcess/API/Cocoa/_WKThumbnailView.mm:
(-[_WKThumbnailView initWithFrame:fromWKView:]):
Add a white background to WKThumbnailView, so that if we have no snapshot and no layer tree,
the view isn't transparent.

* UIProcess/API/mac/WKView.mm:
(-[WKView _updateThumbnailViewLayer]):
We currently pull the live layer tree into the WKThumbnailView even in snapshot mode,
before the snapshot arrives, to avoid flashing when transitioning a live WKView to a thumbnail view.
This is, however, not useful for unparented WKViews, because their layer tree will be detached
and we'll flash anyway. So, only do that when the WKView is parented.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/_WKThumbnailView.mm
Source/WebKit2/UIProcess/API/mac/WKView.mm

index 011d580..b755901 100644 (file)
@@ -1,3 +1,23 @@
+2014-06-20  Timothy Horton  <timothy_horton@apple.com>
+
+        WKThumbnailView should only use live layer trees before the snapshot arrives for parented WKViews
+        https://bugs.webkit.org/show_bug.cgi?id=134129
+        <rdar://problem/17401591>
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/API/Cocoa/_WKThumbnailView.mm:
+        (-[_WKThumbnailView initWithFrame:fromWKView:]):
+        Add a white background to WKThumbnailView, so that if we have no snapshot and no layer tree,
+        the view isn't transparent.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _updateThumbnailViewLayer]):
+        We currently pull the live layer tree into the WKThumbnailView even in snapshot mode,
+        before the snapshot arrives, to avoid flashing when transitioning a live WKView to a thumbnail view.
+        This is, however, not useful for unparented WKViews, because their layer tree will be detached
+        and we'll flash anyway. So, only do that when the WKView is parented.
+
 2014-06-20  Geoffrey Garen  <ggaren@apple.com>
 
         WebKit delegate methods should document their default behaviors
index 4727f32..e765f34 100644 (file)
@@ -66,6 +66,7 @@ using namespace WebKit;
         return nil;
 
     self.wantsLayer = YES;
+    self.layer.backgroundColor = [NSColor whiteColor].CGColor;
 
     _wkView = wkView;
     _webPageProxy = toImpl([_wkView pageRef]);
index adda843..9c1c205 100644 (file)
@@ -3528,7 +3528,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
     _WKThumbnailView *thumbnailView = _data->_thumbnailView;
     ASSERT(thumbnailView);
 
-    if (!thumbnailView.usesSnapshot || thumbnailView._waitingForSnapshot)
+    if (!thumbnailView.usesSnapshot || (thumbnailView._waitingForSnapshot && self.window))
         [self _reparentLayerTreeInThumbnailView];
 }