Changeset 175759 in webkit


Ignore:
Timestamp:
Nov 7, 2014 12:35:23 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

Make it possible to associate snapshots with back/forward list items other than the current item.
https://bugs.webkit.org/show_bug.cgi?id=138490

Patch by Anshu Chimala <anshu@apple.com> on 2014-11-07
Reviewed by Tim Horton.

  • UIProcess/API/Cocoa/WKViewPrivate.h:

Declare -saveBackForwardSnapshotForItem:, an alternative to -saveBackForwardSnapshotForCurrentItem that accepts a
back/forward list item as an argument.

  • UIProcess/API/mac/WKView.mm:

(-[WKView saveBackForwardSnapshotForItem:]):
Pass the provided back/forward list item along to WebPageProxy::recordNavigationSnapshot().

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::recordNavigationSnapshot):
Overloaded to optionally take a back/forward list item as an argument. If one isn't provided, default to the current item
as before; otherwise, associate the snapshot with whichever item was provided.

  • UIProcess/WebPageProxy.h:

Declare the new recordNavigationSnapshot() overload.

  • UIProcess/mac/ViewSnapshotStore.h:

Make recordSnapshot() take a back/forward list item as an argument.

  • UIProcess/mac/ViewSnapshotStore.mm:

(WebKit::ViewSnapshotStore::recordSnapshot):
Store the snapshot in the provided back/forward list item instead of in the current item.

Location:
trunk/Source/WebKit2
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r175757 r175759  
     12014-11-07  Anshu Chimala  <anshu@apple.com>
     2
     3        Make it possible to associate snapshots with back/forward list items other than the current item.
     4        https://bugs.webkit.org/show_bug.cgi?id=138490
     5
     6        Reviewed by Tim Horton.
     7
     8        * UIProcess/API/Cocoa/WKViewPrivate.h:
     9        Declare -saveBackForwardSnapshotForItem:, an alternative to -saveBackForwardSnapshotForCurrentItem that accepts a
     10        back/forward list item as an argument.
     11        * UIProcess/API/mac/WKView.mm:
     12        (-[WKView saveBackForwardSnapshotForItem:]):
     13        Pass the provided back/forward list item along to WebPageProxy::recordNavigationSnapshot().
     14
     15        * UIProcess/WebPageProxy.cpp:
     16        (WebKit::WebPageProxy::recordNavigationSnapshot):
     17        Overloaded to optionally take a back/forward list item as an argument. If one isn't provided, default to the current item
     18        as before; otherwise, associate the snapshot with whichever item was provided.
     19        * UIProcess/WebPageProxy.h:
     20        Declare the new recordNavigationSnapshot() overload.
     21
     22        * UIProcess/mac/ViewSnapshotStore.h:
     23        Make recordSnapshot() take a back/forward list item as an argument.
     24        * UIProcess/mac/ViewSnapshotStore.mm:
     25        (WebKit::ViewSnapshotStore::recordSnapshot):
     26        Store the snapshot in the provided back/forward list item instead of in the current item.
     27
    1282014-11-07  Tim Horton  <timothy_horton@apple.com>
    229
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h

    r175732 r175759  
    110110
    111111- (void)saveBackForwardSnapshotForCurrentItem;
     112- (void)saveBackForwardSnapshotForItem:(WKBackForwardListItemRef)item;
    112113
    113114// Views must be layer-backed, have no transform applied, be in back-to-front z-order, and the whole set must be a contiguous opaque rectangle.
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r175756 r175759  
    37063706}
    37073707
     3708- (void)saveBackForwardSnapshotForItem:(WKBackForwardListItemRef)item
     3709{
     3710    _data->_page->recordNavigationSnapshot(*toImpl(item));
     3711}
     3712
    37083713- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef
    37093714{
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r175756 r175759  
    907907void WebPageProxy::recordNavigationSnapshot()
    908908{
     909    if (WebBackForwardListItem* item = m_backForwardList->currentItem())
     910        recordNavigationSnapshot(*item);
     911}
     912
     913void WebPageProxy::recordNavigationSnapshot(WebBackForwardListItem& item)
     914{
    909915    if (!m_shouldRecordNavigationSnapshots)
    910916        return;
    911917
    912918#if PLATFORM(COCOA)
    913     ViewSnapshotStore::shared().recordSnapshot(*this);
     919    ViewSnapshotStore::shared().recordSnapshot(*this, item);
     920#else
     921    UNUSED_PARAM(item);
    914922#endif
    915923}
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r175637 r175759  
    901901    void setShouldRecordNavigationSnapshots(bool shouldRecordSnapshots) { m_shouldRecordNavigationSnapshots = shouldRecordSnapshots; }
    902902    void recordNavigationSnapshot();
     903    void recordNavigationSnapshot(WebBackForwardListItem&);
    903904
    904905#if PLATFORM(COCOA)
  • trunk/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.h

    r171239 r175759  
    118118    static ViewSnapshotStore& shared();
    119119
    120     void recordSnapshot(WebPageProxy&);
     120    void recordSnapshot(WebPageProxy&, WebBackForwardListItem&);
    121121
    122122    void discardSnapshotImages();
  • trunk/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm

    r171239 r175759  
    107107}
    108108
    109 void ViewSnapshotStore::recordSnapshot(WebPageProxy& webPageProxy)
     109void ViewSnapshotStore::recordSnapshot(WebPageProxy& webPageProxy, WebBackForwardListItem& item)
    110110{
    111111    if (webPageProxy.isShowingNavigationGestureSnapshot())
    112112        return;
    113113
    114     WebBackForwardListItem* item = webPageProxy.backForwardList().currentItem();
    115 
    116     if (!item)
    117         return;
    118 
    119114    pruneSnapshots(webPageProxy);
    120115
    121     webPageProxy.willRecordNavigationSnapshot(*item);
     116    webPageProxy.willRecordNavigationSnapshot(item);
    122117
    123118    RefPtr<ViewSnapshot> snapshot = webPageProxy.takeViewSnapshot();
     
    129124    snapshot->setBackgroundColor(webPageProxy.pageExtendedBackgroundColor());
    130125
    131     item->setSnapshot(snapshot.release());
     126    item.setSnapshot(snapshot.release());
    132127}
    133128
Note: See TracChangeset for help on using the changeset viewer.