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

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 12 19:41:19 PDT 2016


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

--- Comment #5 from Dan <dasau at microsoft.com> ---
Comment on attachment 288553
  --> https://bugs.webkit.org/attachment.cgi?id=288553
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=288553&action=review

>> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:885
>> +    _page->takeSnapshot(snapshotRect, bitmapSize, WebKit::SnapshotOptionsInViewCoordinates, [handler](const WebKit::ShareableBitmap::Handle& imageHandle, WebKit::CallbackBase::Error errorCode) {
> 
> This is a software painted snapshot, meaning that 3D transforms will be flattened and ugly, and video/WebGL may-or-may-not work. So, it's not great.
> 
> We have code (WebViewImpl::takeViewSnapshot) that shows how to do a window-server snapshot, which captures all of those things, but it has a downside: if the web view is obscured, the thing it's obscured will will end up in the snapshot as well.
> 
> _snapshotRect:intoImageOfWidth:completionHandler: gets around this, but uses functions that are only available/possible on iOS. We should definitely make use of that to implement this method on iOS, though, since it is much, much better than a software snapshot.

In our scenario, the WKWebView is sometimes overlapped by other views, clipped by a scroll view, or not parented to a window at all but we still need to get a snapshot of the contents. We cannot use CGWindowListCreateImage and crop out the WKWebView because of this limitation. Preferably the snapshot would include video and WebGL, but it is better to have a snapshot resembling the web page in most cases than nothing at all. I will look into changing the implementation for iOS.

-- 
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/20160913/1bd4a7fb/attachment.html>


More information about the webkit-unassigned mailing list