Changeset 171045 in webkit


Ignore:
Timestamp:
Jul 12, 2014, 10:51:20 PM (11 years ago)
Author:
mitz@apple.com
Message:

[Cocoa] Notify the client when a navigation snapshot is taken
https://bugs.webkit.org/show_bug.cgi?id=134865

Reviewed by Sam Weinig.

  • UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: Declared new delegate method.
  • UIProcess/Cocoa/NavigationState.h:
  • UIProcess/Cocoa/NavigationState.mm:

(WebKit::NavigationState::setNavigationDelegate): Initialize new flag in
m_navigationDelegateMethods.
(WebKit::NavigationState::willRecordNavigationSnapshot): Added. Calls the new
WKNavigationDelegate method.

  • UIProcess/PageClient.h: Declared new client function.
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::willRecordNavigationSnapshot): Added. Calls the new client function.

  • UIProcess/WebPageProxy.h:
  • UIProcess/ios/PageClientImplIOS.h:
  • UIProcess/ios/PageClientImplIOS.mm:

(WebKit::PageClientImpl::willRecordNavigationSnapshot): Override that calls
NavigationState::willRecordNavigationSnapshot.

  • UIProcess/mac/PageClientImpl.h:
  • UIProcess/mac/PageClientImpl.mm:

(WebKit::PageClientImpl::willRecordNavigationSnapshot): Ditto.

  • UIProcess/mac/ViewSnapshotStore.mm:

(WebKit::ViewSnapshotStore::recordSnapshot): Added a call to
WebPageProxy::willRecordNavigationSnapshot.

Location:
trunk/Source/WebKit2
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r171042 r171045  
     12014-07-12  Dan Bernstein  <mitz@apple.com>
     2
     3        [Cocoa] Notify the client when a navigation snapshot is taken
     4        https://bugs.webkit.org/show_bug.cgi?id=134865
     5
     6        Reviewed by Sam Weinig.
     7
     8        * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: Declared new delegate method.
     9
     10        * UIProcess/Cocoa/NavigationState.h:
     11        * UIProcess/Cocoa/NavigationState.mm:
     12        (WebKit::NavigationState::setNavigationDelegate): Initialize new flag in
     13        m_navigationDelegateMethods.
     14        (WebKit::NavigationState::willRecordNavigationSnapshot): Added. Calls the new
     15        WKNavigationDelegate method.
     16
     17        * UIProcess/PageClient.h: Declared new client function.
     18
     19        * UIProcess/WebPageProxy.cpp:
     20        (WebKit::WebPageProxy::willRecordNavigationSnapshot): Added. Calls the new client function.
     21        * UIProcess/WebPageProxy.h:
     22
     23        * UIProcess/ios/PageClientImplIOS.h:
     24        * UIProcess/ios/PageClientImplIOS.mm:
     25        (WebKit::PageClientImpl::willRecordNavigationSnapshot): Override that calls
     26        NavigationState::willRecordNavigationSnapshot.
     27
     28        * UIProcess/mac/PageClientImpl.h:
     29        * UIProcess/mac/PageClientImpl.mm:
     30        (WebKit::PageClientImpl::willRecordNavigationSnapshot): Ditto.
     31
     32        * UIProcess/mac/ViewSnapshotStore.mm:
     33        (WebKit::ViewSnapshotStore::recordSnapshot): Added a call to
     34        WebPageProxy::willRecordNavigationSnapshot.
     35
    1362014-07-12  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
    237
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h

    r171034 r171045  
    6565// Only called if how the gesture will end (with or without navigation) is known before it ends.
    6666- (void)_webViewWillEndNavigationGesture:(WKWebView *)webView withNavigationToBackForwardListItem:(WKBackForwardListItem *)item;
    67 
     67- (void)_webView:(WKWebView *)webView willSnapshotBackForwardListItem:(WKBackForwardListItem *)item;
    6868
    6969#if TARGET_OS_IPHONE
  • trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h

    r171034 r171045  
    7979    void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&);
    8080    void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&);
     81    void willRecordNavigationSnapshot(WebBackForwardListItem&);
    8182
    8283private:
     
    167168        bool webViewWillEndNavigationGestureWithNavigationToBackForwardListItem : 1;
    168169        bool webViewDidEndNavigationGestureWithNavigationToBackForwardListItem : 1;
     170        bool webViewWillSnapshotBackForwardListItem : 1;
    169171#if USE(QUICK_LOOK)
    170172        bool webViewDidStartLoadForQuickLookDocumentInMainFrame : 1;
  • trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm

    r171034 r171045  
    141141    m_navigationDelegateMethods.webViewWillEndNavigationGestureWithNavigationToBackForwardListItem = [delegate respondsToSelector:@selector(_webViewWillEndNavigationGesture:withNavigationToBackForwardListItem:)];
    142142    m_navigationDelegateMethods.webViewDidEndNavigationGestureWithNavigationToBackForwardListItem = [delegate respondsToSelector:@selector(_webViewDidEndNavigationGesture:withNavigationToBackForwardListItem:)];
     143    m_navigationDelegateMethods.webViewWillSnapshotBackForwardListItem = [delegate respondsToSelector:@selector(_webView:willSnapshotBackForwardListItem:)];
    143144#if USE(QUICK_LOOK)
    144145    m_navigationDelegateMethods.webViewDidStartLoadForQuickLookDocumentInMainFrame = [delegate respondsToSelector:@selector(_webView:didStartLoadForQuickLookDocumentInMainFrameWithFileName:uti:)];
     
    289290
    290291    [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate) _webViewDidEndNavigationGesture:m_webView withNavigationToBackForwardListItem:willNavigate ? wrapper(item) : nil];
     292}
     293
     294void NavigationState::willRecordNavigationSnapshot(WebBackForwardListItem& item)
     295{
     296    if (!m_navigationDelegateMethods.webViewWillSnapshotBackForwardListItem)
     297        return;
     298
     299    auto navigationDelegate = m_navigationDelegate.get();
     300    if (!navigationDelegate)
     301        return;
     302
     303    [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate) _webView:m_webView willSnapshotBackForwardListItem:wrapper(item)];
    291304}
    292305
  • trunk/Source/WebKit2/UIProcess/PageClient.h

    r171034 r171045  
    299299    virtual void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&) = 0;
    300300    virtual void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) = 0;
     301    virtual void willRecordNavigationSnapshot(WebBackForwardListItem&) = 0;
    301302};
    302303
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r171034 r171045  
    51445144}
    51455145
     5146void WebPageProxy::willRecordNavigationSnapshot(WebBackForwardListItem& item)
     5147{
     5148    m_pageClient.willRecordNavigationSnapshot(item);
     5149}
     5150
    51465151void WebPageProxy::navigationGestureSnapshotWasRemoved()
    51475152{
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r171034 r171045  
    902902    void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&);
    903903    void navigationGestureSnapshotWasRemoved();
     904    void willRecordNavigationSnapshot(WebBackForwardListItem&);
    904905
    905906    bool isShowingNavigationGestureSnapshot() const { return m_isShowingNavigationGestureSnapshot; }
  • trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h

    r171034 r171045  
    171171    virtual void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&) override;
    172172    virtual void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) override;
     173    virtual void willRecordNavigationSnapshot(WebBackForwardListItem&) override;
    173174
    174175    WKContentView *m_contentView;
  • trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm

    r171034 r171045  
    668668}
    669669
     670void PageClientImpl::willRecordNavigationSnapshot(WebBackForwardListItem& item)
     671{
     672    NavigationState::fromWebPage(*m_webView->_page).willRecordNavigationSnapshot(item);
     673}
     674
    670675} // namespace WebKit
    671676
  • trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h

    r171034 r171045  
    177177    virtual void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&) override;
    178178    virtual void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) override;
     179    virtual void willRecordNavigationSnapshot(WebBackForwardListItem&) override;
    179180
    180181    NSView *activeView() const;
  • trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm

    r171041 r171045  
    715715}
    716716
     717void PageClientImpl::willRecordNavigationSnapshot(WebBackForwardListItem& item)
     718{
     719#if WK_API_ENABLED
     720    NavigationState::fromWebPage(*m_webView->_page).willRecordNavigationSnapshot(item);
     721#else
     722    UNUSED_PARAM(item);
     723#endif
     724}
     725
    717726} // namespace WebKit
    718727
  • trunk/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm

    r170974 r171045  
    120120    pruneSnapshots(webPageProxy);
    121121
     122    webPageProxy.willRecordNavigationSnapshot(*item);
     123
    122124    RefPtr<ViewSnapshot> snapshot = webPageProxy.takeViewSnapshot();
    123125    if (!snapshot || !snapshot->hasImage())
Note: See TracChangeset for help on using the changeset viewer.