RESOLVED FIXED 143341
InjectedBundleNodeHandle::renderedImage() needs to be exposed from the Cocoa WebAPI layer
https://bugs.webkit.org/show_bug.cgi?id=143341
Summary InjectedBundleNodeHandle::renderedImage() needs to be exposed from the Cocoa ...
Said Abou-Hallawa
Reported 2015-04-02 13:31:22 PDT
A given node in the web page can render itself to an NSImage or UIImage. This can be useful for the UI process to draw complex static html elements (e.g. table, SVG etc) without having to create a WKView for the drawing. All it needs is to create a background WebProcess, load a local web page, get the node of a specific item and draw it to a bitmap.
Attachments
Patch (3.32 KB, patch)
2015-04-02 13:35 PDT, Said Abou-Hallawa
no flags
Patch (3.54 KB, patch)
2015-04-03 11:39 PDT, Said Abou-Hallawa
no flags
Said Abou-Hallawa
Comment 1 2015-04-02 13:35:59 PDT
Darin Adler
Comment 2 2015-04-02 13:49:42 PDT
Comment on attachment 250004 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=250004&action=review > Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:46 > +#if TARGET_OS_IPHONE > +- (UIImage *)renderedImage:(WKSnapshotOptions)options; > +#else > +- (NSImage *)renderedImage:(WKSnapshotOptions)options; > +#endif I think we need new availability annotation when we add a new method. > Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:74 > + return [[UIImage alloc] initWithCGImage:image->bitmap()->makeCGImage().get()]; This is missing an autorelease. > Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:85 > + return [[NSImage alloc] initWithCGImage:image->bitmap()->makeCGImage().get() size:NSZeroSize]; This is missing an autorelease.
Anders Carlsson
Comment 3 2015-04-03 11:26:11 PDT
(In reply to comment #2) > Comment on attachment 250004 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=250004&action=review > > > Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:46 > > +#if TARGET_OS_IPHONE > > +- (UIImage *)renderedImage:(WKSnapshotOptions)options; > > +#else > > +- (NSImage *)renderedImage:(WKSnapshotOptions)options; > > +#endif > > I think we need new availability annotation when we add a new method. > Yes. I also think we should call this renderedImageWithOptions:
Said Abou-Hallawa
Comment 4 2015-04-03 11:39:57 PDT
Said Abou-Hallawa
Comment 5 2015-04-03 12:18:59 PDT
(In reply to comment #2) > Comment on attachment 250004 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=250004&action=review > > > Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:46 > > +#if TARGET_OS_IPHONE > > +- (UIImage *)renderedImage:(WKSnapshotOptions)options; > > +#else > > +- (NSImage *)renderedImage:(WKSnapshotOptions)options; > > +#endif > > I think we need new availability annotation when we add a new method. > Done. I was not aware of the Cocoa availability annotation. > > Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:74 > > + return [[UIImage alloc] initWithCGImage:image->bitmap()->makeCGImage().get()]; > > This is missing an autorelease. > Done. > > Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:85 > > + return [[NSImage alloc] initWithCGImage:image->bitmap()->makeCGImage().get() size:NSZeroSize]; > > This is missing an autorelease. Done.
Said Abou-Hallawa
Comment 6 2015-04-03 12:19:14 PDT
(In reply to comment #3) > (In reply to comment #2) > > Comment on attachment 250004 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=250004&action=review > > > > > Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:46 > > > +#if TARGET_OS_IPHONE > > > +- (UIImage *)renderedImage:(WKSnapshotOptions)options; > > > +#else > > > +- (NSImage *)renderedImage:(WKSnapshotOptions)options; > > > +#endif > > > > I think we need new availability annotation when we add a new method. > > > > Yes. I also think we should call this renderedImageWithOptions: Done.
Radar WebKit Bug Importer
Comment 7 2015-04-03 12:20:48 PDT
WebKit Commit Bot
Comment 8 2015-04-03 13:13:17 PDT
Comment on attachment 250091 [details] Patch Clearing flags on attachment: 250091 Committed r182327: <http://trac.webkit.org/changeset/182327>
WebKit Commit Bot
Comment 9 2015-04-03 13:13:21 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.