Bug 130385 - [iOS][WebKit2] Provide generic software-snapshotting API
Summary: [iOS][WebKit2] Provide generic software-snapshotting API
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Horton
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-03-17 23:17 PDT by Tim Horton
Modified: 2014-03-18 23:56 PDT (History)
6 users (show)

See Also:


Attachments
patch (11.60 KB, patch)
2014-03-18 11:15 PDT, Tim Horton
no flags Details | Formatted Diff | Diff
patch (14.81 KB, patch)
2014-03-18 15:04 PDT, Tim Horton
sam: review+
Details | Formatted Diff | Diff
ignore this patch (4.08 KB, patch)
2014-03-18 20:45 PDT, Tim Horton
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Horton 2014-03-17 23:17:08 PDT
We should provide a single method on WKWebView that does an async software paint of a given rect in view space into an image of a given size.

<rdar://problem/16005957>
Comment 1 Tim Horton 2014-03-18 11:15:38 PDT
Created attachment 227078 [details]
patch
Comment 2 Ian Henderson 2014-03-18 11:27:18 PDT
Comment on attachment 227078 [details]
patch

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

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:361
> +        if (!imageHandle.isNull()) {
> +            RefPtr<WebKit::ShareableBitmap> bitmap = WebKit::ShareableBitmap::create(imageHandle, WebKit::SharedMemory::ReadOnly);
> +
> +            if (bitmap) {
> +                RetainPtr<CGImageRef> cgImage;
> +                cgImage = bitmap->makeCGImage();
> +                copiedCompletionHandler(cgImage.get());
> +            }
> +        }
> +
> +        [copiedCompletionHandler release];

Clients should be able to rely on the completion handler being called, even if something went wrong.  Could we call the completion handler with a nil argument in this case instead of not calling it at all?
Comment 3 Tim Horton 2014-03-18 15:04:38 PDT
Created attachment 227116 [details]
patch
Comment 4 WebKit Commit Bot 2014-03-18 15:05:53 PDT
Attachment 227116 [details] did not pass style-queue:


ERROR: Source/WebKit2/WebProcess/WebPage/WebPage.h:425:  The parameter name "rect" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WebKit2/WebProcess/WebPage/WebPage.h:425:  The parameter name "options" adds no information, so it should be removed.  [readability/parameter_name] [5]
Total errors found: 2 in 10 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Tim Horton 2014-03-18 20:45:56 PDT
Created attachment 227151 [details]
ignore this patch
Comment 6 Sam Weinig 2014-03-18 22:08:39 PDT
Comment on attachment 227151 [details]
ignore this patch

This might build, but it is attached to the wrong bug.
Comment 7 Tim Horton 2014-03-18 22:29:24 PDT
(In reply to comment #6)
> (From update of attachment 227151 [details])
> This might build, but it is attached to the wrong bug.

Re r?'d the relevant patch.
Comment 8 Tim Horton 2014-03-18 23:56:12 PDT
http://trac.webkit.org/changeset/165872