[Webkit-unassigned] [Bug 161450] No reliable way to get a snapshot of WKWebView (macOS)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Oct 13 10:23:09 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=161450

--- Comment #19 from Tim Horton <thorton at apple.com> ---
(In reply to comment #18)
> (In reply to comment #17)
> > 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:

No, there aren't.

> 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.

Right.

> It is possible a better implementation was overlooked
> for takeViewSnapshot.

I don't think so.

> Could you please confirm.
> 
> Thanks,
> Dan

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20161013/d2436520/attachment.html>


More information about the webkit-unassigned mailing list