<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - No reliable way to get a snapshot of WKWebView (macOS)"
href="https://bugs.webkit.org/show_bug.cgi?id=161450#c19">Comment # 19</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - No reliable way to get a snapshot of WKWebView (macOS)"
href="https://bugs.webkit.org/show_bug.cgi?id=161450">bug 161450</a>
from <span class="vcard"><a class="email" href="mailto:thorton@apple.com" title="Tim Horton <thorton@apple.com>"> <span class="fn">Tim Horton</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=161450#c18">comment #18</a>)
<span class="quote">> (In reply to <a href="show_bug.cgi?id=161450#c17">comment #17</a>)
> > I think Darin was asking whether your patch could make one of the existing
> > AppKit snapshotting mechanisms work. I think the answer is no, because
> > they're all synchronous and we'd really prefer not to add another sync wait
> > from the UI process, but perhaps there is a way (or perhaps there is an
> > asynchronous one? I haven't seen it.)
>
> Sorry I misunderstood the question. Making WKWebView respond to the existing
> AppKit API would work well for us, I am not sure how to do it without a
> synchronous IPC call. I think I need to better understand the underlying
> problem, hopefully you may be able to help. From looking at the code, it
> looks like the Mac WKWebView to use a remote CALayer to do the rendering
> from the WebContent process to UI process. The corresponding API seem to be
> WKCAContextMakeRemoteForWindowServer in the WebContent process which sends a
> context id to the UI process and creates the CALayer with
> WKMakeRenderLayer(contextId). I don't have the source code to these two API,
> so I am not sure their internal implementation. The CALayerHost remote layer
> is added as a sublayer of WKFlippedView's layer. Using renderInContext on
> the CALayerHost, or the WKFlippedView layer is not producing any image. Is
> there any private API we could use to get the content from the layer?
>
> I see some of the private API are being used to capture WKWebView snapshot
> content in iOS, but it is not linking when I try to use them on Mac. Is
> there any equivalent API that would work for Mac:</span >
No, there aren't.
<span class="quote">> void CARenderServerCaptureLayerWithTransform(mach_port_t, uint32_t clientId,
> uint64_t layerId, uint32_t slotId, int32_t ox, int32_t oy, const
> CATransform3D*);
> void CARenderServerRenderLayerWithTransform(mach_port_t server_port,
> uint32_t client_id, uint64_t layer_id, IOSurfaceRef, int32_t ox, int32_t oy,
> const CATransform3D*);
> void CARenderServerRenderDisplayLayerWithTransformAndTimeOffset(mach_port_t,
> CFStringRef display_name, uint32_t client_id, uint64_t layer_id,
> IOSurfaceRef, int32_t ox, int32_t oy, const CATransform3D*, CFTimeInterval);
>
> Given the implementation of WebViewImpl::takeViewSnapshot() that is using a
> window snapshot instead of a view snapshot for a similar case, I am thinking
> there may not currently be an AppKit API available that could let us render
> the layer to an image.</span >
Right.
<span class="quote">> It is possible a better implementation was overlooked
> for takeViewSnapshot.</span >
I don't think so.
<span class="quote">> Could you please confirm.
>
> Thanks,
> Dan</span ></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>