<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#c24">Comment # 24</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:dasau@microsoft.com" title="Dan Saunders <dasau@microsoft.com>"> <span class="fn">Dan Saunders</span></a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=288770&action=diff" name="attach_288770" title="Patch">attachment 288770</a> <a href="attachment.cgi?id=288770&action=edit" title="Patch">[details]</a></span>
Patch
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=288770&action=review">https://bugs.webkit.org/attachment.cgi?id=288770&action=review</a>
<span class="quote">>> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:886
>> + // Software snapshot will not capture elements rendered with hardware acceleration (WebGL, video, etc).
>
> If true, I am not sure it is acceptable to create API that will fail in this manner for so much content?</span >
It is not ideal, but we haven't been able to find a better option to capture the remote layer contents reliably. If a new AppKit API becomes available that will allow us to capture this content, we can change this implementation to use it instead. Should I open a tracking bug and reference it here?
<span class="quote">>> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:895
>> + auto rawHandler = (void (^)(CGImageRef, NSError *))handler.get();
>
> I believe there is a way to do this without all these typecast casts to the block type, perhaps by using the equivalence of blocks and lambdas.</span >
All of the asynchronous callbacks in WebViewImpl.mm and WKWebView.mm are using typecasts, so I was following the convention. I run into compiler errors with adoptNS constructor if I try to give it the correct type, and it is important to use the RetainPtr to make sure the callback does not get released outside of the lambda. I could do a manual release and avoid the RetainPtr, but this approach does not seem to be used other places. I can remove 1 of the typecasts so I will go ahead and do that in the next iteration.</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>