WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
59035
WebKit2: Need a way to get a snapshot of the visible contents of a page from the UI Process
https://bugs.webkit.org/show_bug.cgi?id=59035
Summary
WebKit2: Need a way to get a snapshot of the visible contents of a page from ...
Jessie Berlin
Reported
2011-04-20 16:28:43 PDT
<
rdar://problem/8607239
>
Attachments
Patch
(6.76 KB, patch)
2011-04-20 16:40 PDT
,
Jessie Berlin
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Jessie Berlin
Comment 1
2011-04-20 16:40:29 PDT
Created
attachment 90443
[details]
Patch
Brian Weinstein
Comment 2
2011-04-20 17:11:18 PDT
Comment on
attachment 90443
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=90443&action=review
I'm going to let Sam review this, just a couple comments I had.
> Source/WebKit2/ChangeLog:22 > + with a scale factor of 1.
Is this correct if the view is currently scaled when we ask for the snapshot? The visible contents might be at a scale factor of 2, would we expect the snapshot to show that?
> Source/WebKit2/UIProcess/WebPageProxy.cpp:3032 > + process()->sendSync(Messages::WebPage::VisibleContentsSnapshot(), Messages::WebPage::VisibleContentsSnapshot::Reply(snapshotHandle), m_pageID, 1);
A constant would be nice for the 1 here.
> Source/WebKit2/WebProcess/WebPage/WebPage.cpp:854 > + RefPtr<WebImage> snapshotImage = scaledSnapshotInDocumentCoordinates(contentRect, 1, ImageOptionsShareable);
Do we want the 1 here? Or do we want the current scale factor of the frame? (Repeat of question in ChangeLog).
Jessie Berlin
Comment 3
2011-04-21 09:26:17 PDT
(In reply to
comment #2
)
> (From update of
attachment 90443
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=90443&action=review
> > I'm going to let Sam review this, just a couple comments I had.
Thanks for the feedback!
> > > Source/WebKit2/ChangeLog:22 > > + with a scale factor of 1. > > Is this correct if the view is currently scaled when we ask for the snapshot? The visible contents might be at a scale factor of 2, would we expect the snapshot to show that?
That is already taken into account when the snapshot is made of that rect. The scale factor is any additional scaling that is desired.
> > > Source/WebKit2/UIProcess/WebPageProxy.cpp:3032 > > + process()->sendSync(Messages::WebPage::VisibleContentsSnapshot(), Messages::WebPage::VisibleContentsSnapshot::Reply(snapshotHandle), m_pageID, 1); > > A constant would be nice for the 1 here.
Changed to be: // Do not wait for more than a second (arbitrary) for the WebProcess to get the snapshot so // that the UI Process is not permanently stuck waiting on a potentially crashing Web Process. static const double visibleContentsSnapshotSyncMessageTimeout = 1.0; process()->sendSync(Messages::WebPage::VisibleContentsSnapshot(), Messages::WebPage::VisibleContentsSnapshot::Reply(snapshotHandle), m_pageID, visibleContentsSnapshotSyncMessageTimeout);
> > > Source/WebKit2/WebProcess/WebPage/WebPage.cpp:854 > > + RefPtr<WebImage> snapshotImage = scaledSnapshotInDocumentCoordinates(contentRect, 1, ImageOptionsShareable); > > Do we want the 1 here? Or do we want the current scale factor of the frame? (Repeat of question in ChangeLog).
See earlier response. I will update the Changelog comment to say that using a scale factor of one preserves any scaling already done on the web page (e.g. by zooming in or out).
Sam Weinig
Comment 4
2011-04-21 10:17:23 PDT
Comment on
attachment 90443
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=90443&action=review
> Source/WebKit2/UIProcess/API/C/WKPagePrivate.h:69 > +WK_EXPORT WKImageRef WKPageVisibleContentsSnapshot(WKPageRef pageRef);
This function name needs to Create in its name to indicate the ownership model. I think WKPageCreateSnapshotOfVisibleContent() to match the one in the bundle, would be good. We usually leave the Ref off the parameter name in the header.
Jessie Berlin
Comment 5
2011-04-21 10:31:22 PDT
(In reply to
comment #4
)
> (From update of
attachment 90443
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=90443&action=review
> > > Source/WebKit2/UIProcess/API/C/WKPagePrivate.h:69 > > +WK_EXPORT WKImageRef WKPageVisibleContentsSnapshot(WKPageRef pageRef); > > This function name needs to Create in its name to indicate the ownership model. I think WKPageCreateSnapshotOfVisibleContent() to match the one in the bundle, would be good.
Done (and changed all the other instances of visibleContentsSnapshot to createSnapshotOfVisibleContent).
> > We usually leave the Ref off the parameter name in the header.
I was wondering what our official style was for that. Fixed.
Jessie Berlin
Comment 6
2011-04-21 10:45:19 PDT
Comment on
attachment 90443
[details]
Patch Committed in
http://trac.webkit.org/changeset/84519
WebKit Review Bot
Comment 7
2011-04-21 11:24:35 PDT
http://trac.webkit.org/changeset/84519
might have broken Qt Linux ARMv7 Release and Qt Windows 32-bit Debug
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug