Title: [181910] trunk/Source
- Revision
- 181910
- Author
- [email protected]
- Date
- 2015-03-24 15:47:53 -0700 (Tue, 24 Mar 2015)
Log Message
Source/WebCore:
WebCore part of <rdar://problem/20282863> Transforms are flattened in snapshots of on-screen WKWebViews
https://bugs.webkit.org/show_bug.cgi?id=143023
Reviewed by Tim Horton.
* platform/spi/cocoa/QuartzCoreSPI.h: Added the declaration of
CARenderServerRenderLayerWithTransform.
Source/WebKit2:
WebKit2 part of <rdar://problem/20282863> Transforms are flattened in snapshots of on-screen WKWebViews
https://bugs.webkit.org/show_bug.cgi?id=143023
Reviewed by Tim Horton.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]): If the view is in a
window, use CARenderServerRenderLayerWithTransform to synchronously capture a snapshot of
its layer tree into an IOSurfcae, then call the completion handler with an image created
from the IOSurface.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (181909 => 181910)
--- trunk/Source/WebCore/ChangeLog 2015-03-24 21:50:32 UTC (rev 181909)
+++ trunk/Source/WebCore/ChangeLog 2015-03-24 22:47:53 UTC (rev 181910)
@@ -1,3 +1,13 @@
+2015-03-24 Dan Bernstein <[email protected]>
+
+ WebCore part of <rdar://problem/20282863> Transforms are flattened in snapshots of on-screen WKWebViews
+ https://bugs.webkit.org/show_bug.cgi?id=143023
+
+ Reviewed by Tim Horton.
+
+ * platform/spi/cocoa/QuartzCoreSPI.h: Added the declaration of
+ CARenderServerRenderLayerWithTransform.
+
2015-03-24 David Hyatt <[email protected]>
Disable layout dimensions optimization for RenderRegions
Modified: trunk/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h (181909 => 181910)
--- trunk/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h 2015-03-24 21:50:32 UTC (rev 181909)
+++ trunk/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h 2015-03-24 22:47:53 UTC (rev 181910)
@@ -115,6 +115,8 @@
EXTERN_C void CARenderServerCaptureLayerWithTransform(mach_port_t serverPort, uint32_t clientId, uint64_t layerId,
uint32_t slotId, int32_t ox, int32_t oy, const CATransform3D *);
+EXTERN_C void CARenderServerRenderLayerWithTransform(mach_port_t server_port, uint32_t client_id, uint64_t layer_id, IOSurfaceRef iosurface, int32_t ox, int32_t oy, const CATransform3D *matrix);
+
EXTERN_C NSString * const kCATiledLayerRemoveImmediately;
EXTERN_C NSString * const kCAFilterColorInvert;
Modified: trunk/Source/WebKit2/ChangeLog (181909 => 181910)
--- trunk/Source/WebKit2/ChangeLog 2015-03-24 21:50:32 UTC (rev 181909)
+++ trunk/Source/WebKit2/ChangeLog 2015-03-24 22:47:53 UTC (rev 181910)
@@ -1,3 +1,16 @@
+2015-03-24 Dan Bernstein <[email protected]>
+
+ WebKit2 part of <rdar://problem/20282863> Transforms are flattened in snapshots of on-screen WKWebViews
+ https://bugs.webkit.org/show_bug.cgi?id=143023
+
+ Reviewed by Tim Horton.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]): If the view is in a
+ window, use CARenderServerRenderLayerWithTransform to synchronously capture a snapshot of
+ its layer tree into an IOSurfcae, then call the completion handler with an image created
+ from the IOSurface.
+
2015-03-24 Beth Dakin <[email protected]>
Add events related to force click gesture
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (181909 => 181910)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-03-24 21:50:32 UTC (rev 181909)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-03-24 22:47:53 UTC (rev 181910)
@@ -77,6 +77,7 @@
#import "_WKWebsiteDataStoreInternal.h"
#import <_javascript_Core/JSContext.h>
#import <_javascript_Core/JSValue.h>
+#import <WebCore/IOSurface.h>
#import <wtf/HashMap.h>
#import <wtf/MathExtras.h>
#import <wtf/NeverDestroyed.h>
@@ -2502,7 +2503,27 @@
UIGraphicsEndImageContext();
return;
}
-
+
+#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);
+ CARenderServerRenderLayerWithTransform(MACH_PORT_NULL, self.layer.context.contextId, reinterpret_cast<uint64_t>(self.layer), surface->surface(), 0, 0, &transform);
+ completionHandler(surface->createImage().get());
+
+ return;
+ }
+#endif
+
void(^copiedCompletionHandler)(CGImageRef) = [completionHandler copy];
_page->takeSnapshot(WebCore::enclosingIntRect(snapshotRectInContentCoordinates), WebCore::expandedIntSize(WebCore::FloatSize(imageSize)), WebKit::SnapshotOptionsExcludeDeviceScaleFactor, [=](const WebKit::ShareableBitmap::Handle& imageHandle, WebKit::CallbackBase::Error) {
if (imageHandle.isNull()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes