With tiled drawing enabled, clicking a link to a PDF causes a cross-fade
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Mar 2012 23:27:17 +0000 (23:27 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Mar 2012 23:27:17 +0000 (23:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=79247
<rdar://problem/10910808>

Reviewed by Sam Weinig.

Instead of creating a new CALayer for the WKView when we're in tiled mode, re-use the existing layer that AppKit makes for us.
This way, we won't get any implicit animations when we change layer properties (such as sublayers in this case).

* UIProcess/API/mac/WKView.mm:
(-[WKView initWithFrame:contextRef:pageGroupRef:]):
(-[WKView wantsUpdateLayer]):
(-[WKView updateLayer]):

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

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

index 6ef5c89..8858a6c 100644 (file)
@@ -1,3 +1,19 @@
+2012-03-14  Anders Carlsson  <andersca@apple.com>
+
+        With tiled drawing enabled, clicking a link to a PDF causes a cross-fade
+        https://bugs.webkit.org/show_bug.cgi?id=79247
+        <rdar://problem/10910808>
+
+        Reviewed by Sam Weinig.
+
+        Instead of creating a new CALayer for the WKView when we're in tiled mode, re-use the existing layer that AppKit makes for us.
+        This way, we won't get any implicit animations when we change layer properties (such as sublayers in this case).
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView initWithFrame:contextRef:pageGroupRef:]):
+        (-[WKView wantsUpdateLayer]):
+        (-[WKView updateLayer]):
+
 2012-03-14  Alexey Proskuryakov  <ap@apple.com>
 
         WebProcess sometimes hits an assertion in SandboxExtensionTracker::didCommitProvisionalLoad after running regression tests
index f52071b..b474329 100644 (file)
@@ -2525,9 +2525,11 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
     bool hadPDFView = _data->_pdfViewController;
     _data->_pdfViewController = nullptr;
 
+    self.wantsLayer = pageHasCustomRepresentation;
+
     if (pageHasCustomRepresentation)
         _data->_pdfViewController = PDFViewController::create(self);
-    
+
     if (pageHasCustomRepresentation != hadPDFView)
         _data->_page->drawingArea()->pageCustomRepresentationChanged();
 }
@@ -2882,10 +2884,6 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
     [self _registerDraggedTypes];
 
     if ([self _shouldUseTiledDrawingArea]) {
-        CALayer *layer = [CALayer layer];
-        layer.backgroundColor = CGColorGetConstantColor(kCGColorWhite);
-        self.layer = layer;
-
         self.layerContentsRedrawPolicy = NSViewLayerContentsRedrawNever;
         self.wantsLayer = YES;
     }
@@ -2895,6 +2893,18 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
     return self;
 }
 
+#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
+- (BOOL)wantsUpdateLayer
+{
+    return [self _shouldUseTiledDrawingArea];
+}
+
+- (void)updateLayer
+{
+    self.layer.backgroundColor = CGColorGetConstantColor(kCGColorWhite);
+}
+#endif
+
 - (WKPageRef)pageRef
 {
     return toAPI(_data->_page.get());