RESOLVED FIXED 156073
Web Automation: Add Automation.takeScreenshot
https://bugs.webkit.org/show_bug.cgi?id=156073
Summary Web Automation: Add Automation.takeScreenshot
Joseph Pecoraro
Reported 2016-03-31 11:16:25 PDT
* SUMMARY Add Automation.screenshot. Screenshot of the entire page, not just the visible/viewport portion.
Attachments
[PATCH] Proposed Fix (19.30 KB, patch)
2016-03-31 11:32 PDT, Joseph Pecoraro
timothy: review+
Radar WebKit Bug Importer
Comment 1 2016-03-31 11:16:47 PDT
Joseph Pecoraro
Comment 2 2016-03-31 11:32:48 PDT
Created attachment 275307 [details] [PATCH] Proposed Fix
Timothy Hatcher
Comment 3 2016-03-31 11:43:01 PDT
Comment on attachment 275307 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=275307&action=review > Source/WebKit2/UIProcess/Automation/Automation.json:313 > + "name": "screenshot", I think takeScreenshot would be better. See below. > Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp:777 > +void WebAutomationSession::screenshot(ErrorString& errorString, const String& handle, Ref<ScreenshotCallback>&& callback) WebAutomationSession::takeScreenshot would be good, we have been naming these the same as the WebAutomationSessionPoxy methods. > Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.cpp:476 > + RefPtr<WebImage> image = page->scaledSnapshotWithOptions(snapshotRect, 1, SnapshotOptionsShareable); This forces 1x? I wonder if we should make it work with 2x too.
Joseph Pecoraro
Comment 4 2016-03-31 11:44:51 PDT
(In reply to comment #3) > Comment on attachment 275307 [details] > [PATCH] Proposed Fix > > View in context: > https://bugs.webkit.org/attachment.cgi?id=275307&action=review > > > Source/WebKit2/UIProcess/Automation/Automation.json:313 > > + "name": "screenshot", > > I think takeScreenshot would be better. See below. > > > Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp:777 > > +void WebAutomationSession::screenshot(ErrorString& errorString, const String& handle, Ref<ScreenshotCallback>&& callback) > > WebAutomationSession::takeScreenshot would be good, we have been naming > these the same as the WebAutomationSessionPoxy methods. I'll rename. > > Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.cpp:476 > > + RefPtr<WebImage> image = page->scaledSnapshotWithOptions(snapshotRect, 1, SnapshotOptionsShareable); > > This forces 1x? I wonder if we should make it work with 2x too. Nope, this is an "additional scale". it is fine to be 1.
Blaze Burg
Comment 5 2016-03-31 11:46:12 PDT
Comment on attachment 275307 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=275307&action=review r=me! > Source/WebKit2/ChangeLog:35 > + Use null string where possible for efficiency. Efficiency! :) > Source/WebKit2/UIProcess/Automation/WebAutomationSession.h:109 > + void screenshot(Inspector::ErrorString&, const String& handle, Ref<Inspector::AutomationBackendDispatcherHandler::ScreenshotCallback>&&) override; I would name it takeScreenshot to match the callback. > Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.cpp:455 > + ShareableBitmap::Handle handle; Nit: move this closer to the use-site.
Joseph Pecoraro
Comment 6 2016-03-31 11:49:33 PDT
> > Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.cpp:455 > > + ShareableBitmap::Handle handle; > > Nit: move this closer to the use-site. This is used, even when empty, in all the DidTakeScreenshot responses, so I put it at the top.
Joseph Pecoraro
Comment 7 2016-03-31 12:04:11 PDT
Note You need to log in before you can comment on or make changes to this bug.