Title: [184498] branches/safari-601.1.32.2-branch/Source/WebKit2
Revision
184498
Author
[email protected]
Date
2015-05-18 10:01:19 -0700 (Mon, 18 May 2015)

Log Message

Merge r184422. rdar://problem/20410944

Modified Paths

Diff

Modified: branches/safari-601.1.32.2-branch/Source/WebKit2/ChangeLog (184497 => 184498)


--- branches/safari-601.1.32.2-branch/Source/WebKit2/ChangeLog	2015-05-18 17:01:13 UTC (rev 184497)
+++ branches/safari-601.1.32.2-branch/Source/WebKit2/ChangeLog	2015-05-18 17:01:19 UTC (rev 184498)
@@ -1,5 +1,27 @@
 2015-05-18  Matthew Hanson  <[email protected]>
 
+        Merge r184422. rdar://problem/20410944
+
+    2015-05-15  James Savage  <[email protected]>
+
+            REGRESSION (r181910): WKWebView incorrectly scales snapshot
+            https://bugs.webkit.org/show_bug.cgi?id=145076
+
+            Reviewed by Tim Horton.
+
+            We added a fast path to snapshotting using IOSurfaces with
+            http://trac.webkit.org/changeset/181910 which incorrectly determined
+            scale and transform and resulted in bad snapshots in some situations.
+
+            * UIProcess/API/Cocoa/WKWebView.mm:
+            (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
+            When snapshotting an IOSurface we need to compute our scale based off of
+            the rect in the WKWebView coordinates, we also failed to account for
+            non-zero origins in the snapshot rect. Remove an unused varible while
+            we're here.
+
+2015-05-18  Matthew Hanson  <[email protected]>
+
         Merge r184399. rdar://problem/20939743
 
     2015-05-15  Chris Dumez  <[email protected]>

Modified: branches/safari-601.1.32.2-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (184497 => 184498)


--- branches/safari-601.1.32.2-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-05-18 17:01:13 UTC (rev 184497)
+++ branches/safari-601.1.32.2-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-05-18 17:01:19 UTC (rev 184498)
@@ -2709,16 +2709,10 @@
 #if USE(IOSURFACE)
     // If we are parented and thus won't incur a significant penalty from paging in tiles, snapshot the view hierarchy directly.
     if (self.window) {
-        float deviceScaleFactor = _page->deviceScaleFactor();
-
-        CGRect imageRectInPoints;
-        imageRectInPoints.size.width = imageWidth / deviceScaleFactor;
-        imageRectInPoints.size.height = imageRectInPoints.size.width / rectInViewCoordinates.size.width * rectInViewCoordinates.size.height;
-        imageRectInPoints.origin.x = rectInViewCoordinates.origin.x / deviceScaleFactor;
-        imageRectInPoints.origin.y = rectInViewCoordinates.origin.y / deviceScaleFactor;
-
         auto surface = WebCore::IOSurface::create(WebCore::expandedIntSize(WebCore::FloatSize(imageSize)), WebCore::ColorSpaceDeviceRGB);
-        CATransform3D transform = CATransform3DMakeScale(deviceScaleFactor, deviceScaleFactor, 1);
+        CGFloat imageScaleInViewCoordinates = imageWidth / rectInViewCoordinates.size.width;
+        CATransform3D transform = CATransform3DMakeScale(imageScaleInViewCoordinates, imageScaleInViewCoordinates, 1);
+        transform = CATransform3DTranslate(transform, -rectInViewCoordinates.origin.x, -rectInViewCoordinates.origin.y, 0);
         CARenderServerRenderLayerWithTransform(MACH_PORT_NULL, self.layer.context.contextId, reinterpret_cast<uint64_t>(self.layer), surface->surface(), 0, 0, &transform);
         completionHandler(surface->createImage().get());
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to