Title: [184422] trunk/Source/WebKit2
- Revision
- 184422
- Author
- [email protected]
- Date
- 2015-05-15 17:21:46 -0700 (Fri, 15 May 2015)
Log Message
REGRESSION (r181910): WKWebView incorrectly scales snapshot
https://bugs.webkit.org/show_bug.cgi?id=145076
Patch by James Savage <[email protected]> on 2015-05-15
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.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (184421 => 184422)
--- trunk/Source/WebKit2/ChangeLog 2015-05-15 23:29:29 UTC (rev 184421)
+++ trunk/Source/WebKit2/ChangeLog 2015-05-16 00:21:46 UTC (rev 184422)
@@ -1,3 +1,21 @@
+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-15 Alex Christensen <[email protected]>
[Content Extensions] Fail to load old content extension files
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (184421 => 184422)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-05-15 23:29:29 UTC (rev 184421)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-05-16 00:21:46 UTC (rev 184422)
@@ -2725,16 +2725,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