Bug 146398 - [WK2][iOS] Add WKWebView private API to save a back/forward snapshot
Summary: [WK2][iOS] Add WKWebView private API to save a back/forward snapshot
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-06-28 13:02 PDT by Chris Dumez
Modified: 2015-06-29 12:09 PDT (History)
4 users (show)

See Also:


Attachments
Patch (2.34 KB, patch)
2015-06-28 13:23 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2015-06-28 13:02:34 PDT
Add WKWebView private API to save a back/forward snapshot so that the client can make sure a back/forward snapshot is available even when swapping WKWebView upon navigation.
Comment 1 Chris Dumez 2015-06-28 13:02:47 PDT
rdar://problem/21584231
Comment 2 mitz 2015-06-28 13:08:08 PDT
Is this something the existing session state API can do?
Comment 3 Chris Dumez 2015-06-28 13:09:19 PDT
(In reply to comment #2)
> Is this something the existing session state API can do?

I will check. I was trying to match the way we currently do this on Mac:

in WKViewPrivate.h
- (void)saveBackForwardSnapshotForItem:(WKBackForwardListItemRef)item;
Comment 4 Chris Dumez 2015-06-28 13:22:44 PDT
(In reply to comment #2)
> Is this something the existing session state API can do?

Please see comment on radar.
Comment 5 Chris Dumez 2015-06-28 13:23:13 PDT
Created attachment 255729 [details]
Patch
Comment 6 mitz 2015-06-28 13:26:28 PDT
Comment on attachment 255729 [details]
Patch

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

> Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h:212
> +- (void)_saveBackForwardSnapshotForItem:(WKBackForwardListItem *)item WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);

Can this be used on an item that isn’t the current item? What does it do in that case?
Comment 7 Chris Dumez 2015-06-28 13:30:44 PDT
Comment on attachment 255729 [details]
Patch

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

>> Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h:212
>> +- (void)_saveBackForwardSnapshotForItem:(WKBackForwardListItem *)item WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
> 
> Can this be used on an item that isn’t the current item? What does it do in that case?

Yes, it can and it is the intended use. On Mac, we have both saveBackForwardSnapshotForItem(item) and saveBackForwardSnapshotForCurrentItem().

What it does in this case is take a snapshot of the current view and save it on the WKBackForwardListItem that is given. The WKBackForwardListItem being given in this case would be from another WKWebView.
Comment 8 WebKit Commit Bot 2015-06-29 12:09:15 PDT
Comment on attachment 255729 [details]
Patch

Clearing flags on attachment: 255729

Committed r186077: <http://trac.webkit.org/changeset/186077>
Comment 9 WebKit Commit Bot 2015-06-29 12:09:19 PDT
All reviewed patches have been landed.  Closing bug.