Changeset 235157 in webkit


Ignore:
Timestamp:
Aug 21, 2018 8:51:52 PM (6 years ago)
Author:
achristensen@apple.com
Message:

Roll out r235139 and r235146
https://bugs.webkit.org/show_bug.cgi?id=188805

Source/WebKit:

It turns out shouldKeepCurrentBackForwardListItemInList has one use left.

  • UIProcess/API/APILoaderClient.h:

(API::LoaderClient::shouldKeepCurrentBackForwardListItemInList):

  • UIProcess/API/C/WKPage.cpp:

(WKPageSetPageLoaderClient):

  • UIProcess/WebBackForwardList.cpp:

(WebKit::WebBackForwardList::addItem):
(WebKit::WebBackForwardList::goToItem):

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::shouldKeepCurrentBackForwardListItemInList):

  • UIProcess/WebPageProxy.h:

Tools:

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKit/ShouldKeepCurrentBackForwardListItemInList.cpp:
Location:
trunk
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r235156 r235157  
     12018-08-21  Alex Christensen  <achristensen@webkit.org>
     2
     3        Roll out r235139 and r235146
     4        https://bugs.webkit.org/show_bug.cgi?id=188805
     5
     6        It turns out shouldKeepCurrentBackForwardListItemInList has one use left.
     7
     8        * UIProcess/API/APILoaderClient.h:
     9        (API::LoaderClient::shouldKeepCurrentBackForwardListItemInList):
     10        * UIProcess/API/C/WKPage.cpp:
     11        (WKPageSetPageLoaderClient):
     12        * UIProcess/WebBackForwardList.cpp:
     13        (WebKit::WebBackForwardList::addItem):
     14        (WebKit::WebBackForwardList::goToItem):
     15        * UIProcess/WebPageProxy.cpp:
     16        (WebKit::WebPageProxy::shouldKeepCurrentBackForwardListItemInList):
     17        * UIProcess/WebPageProxy.h:
     18
    1192018-08-21  Wenson Hsieh  <wenson_hsieh@apple.com>
    220
  • trunk/Source/WebKit/UIProcess/API/APILoaderClient.h

    r235139 r235157  
    9191
    9292    virtual void didChangeBackForwardList(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem*, Vector<Ref<WebKit::WebBackForwardListItem>>&&) { }
     93    virtual bool shouldKeepCurrentBackForwardListItemInList(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem&) { return true; }
    9394    virtual void willGoToBackForwardListItem(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem&, API::Object*) { }
    9495
  • trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp

    r235139 r235157  
    10431043        {
    10441044            initialize(client);
    1045             ASSERT(!m_client.shouldKeepCurrentBackForwardListItemInList);
    10461045        }
    10471046
     
    12481247
    12491248            m_client.didChangeBackForwardList(toAPI(&page), toAPI(addedItem), toAPI(removedItemsArray.get()), m_client.base.clientInfo);
     1249        }
     1250
     1251        bool shouldKeepCurrentBackForwardListItemInList(WebKit::WebPageProxy& page, WebKit::WebBackForwardListItem& item) override
     1252        {
     1253            if (!m_client.shouldKeepCurrentBackForwardListItemInList)
     1254                return true;
     1255
     1256            return m_client.shouldKeepCurrentBackForwardListItemInList(toAPI(&page), toAPI(&item), m_client.base.clientInfo);
    12501257        }
    12511258
  • trunk/Source/WebKit/UIProcess/WebBackForwardList.cpp

    r235146 r235157  
    142142        m_currentIndex = 0;
    143143        m_hasCurrentIndex = true;
    144     } else
    145         m_currentIndex++;
     144    } else {
     145        shouldKeepCurrentItem = m_page->shouldKeepCurrentBackForwardListItemInList(m_entries[m_currentIndex]);
     146        if (shouldKeepCurrentItem)
     147            m_currentIndex++;
     148    }
    146149
    147150    auto* newItemPtr = newItem.ptr();
     
    196199    // item should remain in the list.
    197200    auto& currentItem = m_entries[m_currentIndex];
    198     if (currentItem.ptr() != &item)
     201    bool shouldKeepCurrentItem = true;
     202    if (currentItem.ptr() != &item) {
    199203        m_page->recordAutomaticNavigationSnapshot();
     204        shouldKeepCurrentItem = m_page->shouldKeepCurrentBackForwardListItemInList(m_entries[m_currentIndex]);
     205    }
     206
     207    // If the client said to remove the current item, remove it and then update the target index.
     208    Vector<Ref<WebBackForwardListItem>> removedItems;
     209    if (!shouldKeepCurrentItem) {
     210        removedItems.append(currentItem.copyRef());
     211        m_entries.remove(m_currentIndex);
     212        targetIndex = notFound;
     213        for (size_t i = 0; i < m_entries.size(); ++i) {
     214            if (m_entries[i].ptr() == &item) {
     215                targetIndex = i;
     216                break;
     217            }
     218        }
     219        ASSERT(targetIndex != notFound);
     220    }
    200221
    201222    m_currentIndex = targetIndex;
    202223
    203224    LOG(BackForward, "(Back/Forward) WebBackForwardList %p going to item %s, is now at index %zu", this, item.itemID().logString(), targetIndex);
    204     m_page->didChangeBackForwardList(nullptr, { });
     225    m_page->didChangeBackForwardList(nullptr, WTFMove(removedItems));
    205226}
    206227
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r235156 r235157  
    12911291}
    12921292
     1293bool WebPageProxy::shouldKeepCurrentBackForwardListItemInList(WebBackForwardListItem& item)
     1294{
     1295    PageClientProtector protector(m_pageClient);
     1296
     1297    return m_loaderClient->shouldKeepCurrentBackForwardListItemInList(*this, item);
     1298}
     1299
    12931300bool WebPageProxy::canShowMIMEType(const String& mimeType)
    12941301{
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r235156 r235157  
    469469    void willGoToBackForwardListItem(const WebCore::BackForwardItemIdentifier&, bool inPageCache, const UserData&);
    470470
     471    bool shouldKeepCurrentBackForwardListItemInList(WebBackForwardListItem&);
     472
    471473    bool willHandleHorizontalScrollEvents() const;
    472474
  • trunk/Tools/ChangeLog

    r235156 r235157  
     12018-08-21  Alex Christensen  <achristensen@webkit.org>
     2
     3        Roll out r235139 and r235146
     4        https://bugs.webkit.org/show_bug.cgi?id=188805
     5
     6        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     7        * TestWebKitAPI/Tests/WebKit/ShouldKeepCurrentBackForwardListItemInList.cpp:
     8
    192018-08-21  Wenson Hsieh  <wenson_hsieh@apple.com>
    210
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r235140 r235157  
    534534                7CCE7F121A411AE600447C4C /* ScrollPinningBehaviors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D640B5417875DFF00BFAF99 /* ScrollPinningBehaviors.cpp */; };
    535535                7CCE7F131A411AE600447C4C /* ShouldGoToBackForwardListItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51FCF7981534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp */; };
     536                7CCE7F141A411AE600447C4C /* ShouldKeepCurrentBackForwardListItemInList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51E5C7041919EA5F00D8B3E1 /* ShouldKeepCurrentBackForwardListItemInList.cpp */; };
    536537                7CCE7F151A411AE600447C4C /* SpacebarScrolling.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C02B77F1126612140026BF0F /* SpacebarScrolling.cpp */; };
    537538                7CCE7F161A411AE600447C4C /* TerminateTwice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE72F47173EB214006362F0 /* TerminateTwice.cpp */; };
     
    14981499                51D124971E763AF8002B2820 /* WKHTTPCookieStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKHTTPCookieStore.mm; sourceTree = "<group>"; };
    14991500                51DB16CD1F085047001FA4C5 /* WebViewIconLoading.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebViewIconLoading.mm; sourceTree = "<group>"; };
     1501                51E5C7041919EA5F00D8B3E1 /* ShouldKeepCurrentBackForwardListItemInList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShouldKeepCurrentBackForwardListItemInList.cpp; sourceTree = "<group>"; };
    15001502                51E6A8921D2F1BEC00C004B6 /* LocalStorageClear.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalStorageClear.mm; sourceTree = "<group>"; };
    15011503                51E6A8951D2F1C7700C004B6 /* LocalStorageClear.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = LocalStorageClear.html; sourceTree = "<group>"; };
     
    29342936                                51FCF7981534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp */,
    29352937                                51FCF7971534AC6D00104491 /* ShouldGoToBackForwardListItem_Bundle.cpp */,
     2938                                51E5C7041919EA5F00D8B3E1 /* ShouldKeepCurrentBackForwardListItemInList.cpp */,
    29362939                                C02B77F1126612140026BF0F /* SpacebarScrolling.cpp */,
    29372940                                76734997193016DC00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad.cpp */,
     
    39413944                                A179918B1E1CA24100A505ED /* SharedBufferTest.cpp in Sources */,
    39423945                                7CCE7F131A411AE600447C4C /* ShouldGoToBackForwardListItem.cpp in Sources */,
     3946                                7CCE7F141A411AE600447C4C /* ShouldKeepCurrentBackForwardListItemInList.cpp in Sources */,
    39433947                                37BCA61C1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm in Sources */,
    39443948                                7C83E0C51D0A654600FEBCF3 /* ShrinkToFit.mm in Sources */,
Note: See TracChangeset for help on using the changeset viewer.