Title: [237148] trunk/Source
Revision
237148
Author
achristen...@apple.com
Date
2018-10-15 14:45:55 -0700 (Mon, 15 Oct 2018)

Log Message

Remove unused WebView._globalHistoryItem
https://bugs.webkit.org/show_bug.cgi?id=190601

Reviewed by Chris Dumez.

Source/WebCore:

This was a hack to give the client a more reliable current back/forward item, but it hasn't been used for years
and it's adding unnecessary complexity to the history code.

* loader/EmptyFrameLoaderClient.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
(WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
* loader/FrameLoaderClient.h:
* loader/HistoryController.cpp:
(WebCore::HistoryController::goToItem):
(WebCore::HistoryController::updateForStandardLoad):
(WebCore::HistoryController::updateForRedirectWithLockedBackForwardList):

Source/WebKitLegacy/mac:

* WebCoreSupport/WebFrameLoaderClient.h:
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::updateGlobalHistoryItemForPage): Deleted.
* WebView/WebView.mm:
(-[WebView _globalHistoryItem]): Deleted.
(-[WebView _setGlobalHistoryItem:]): Deleted.
* WebView/WebViewData.h:
* WebView/WebViewInternal.h:
* WebView/WebViewPrivate.h:

Source/WebKitLegacy/win:

* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::updateGlobalHistoryItemForPage): Deleted.
* WebCoreSupport/WebFrameLoaderClient.h:
* WebView.cpp:
(WebView::globalHistoryItem):
(WebView::setGlobalHistoryItem): Deleted.
* WebView.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (237147 => 237148)


--- trunk/Source/WebCore/ChangeLog	2018-10-15 21:40:49 UTC (rev 237147)
+++ trunk/Source/WebCore/ChangeLog	2018-10-15 21:45:55 UTC (rev 237148)
@@ -1,3 +1,23 @@
+2018-10-15  Alex Christensen  <achristen...@webkit.org>
+
+        Remove unused WebView._globalHistoryItem
+        https://bugs.webkit.org/show_bug.cgi?id=190601
+
+        Reviewed by Chris Dumez.
+
+        This was a hack to give the client a more reliable current back/forward item, but it hasn't been used for years
+        and it's adding unnecessary complexity to the history code.
+
+        * loader/EmptyFrameLoaderClient.h:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
+        (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
+        * loader/FrameLoaderClient.h:
+        * loader/HistoryController.cpp:
+        (WebCore::HistoryController::goToItem):
+        (WebCore::HistoryController::updateForStandardLoad):
+        (WebCore::HistoryController::updateForRedirectWithLockedBackForwardList):
+
 2018-10-15  Chris Dumez  <cdu...@apple.com>
 
         Experiment: target=_blank on anchors should imply rel=noopener

Modified: trunk/Source/WebCore/loader/EmptyFrameLoaderClient.h (237147 => 237148)


--- trunk/Source/WebCore/loader/EmptyFrameLoaderClient.h	2018-10-15 21:40:49 UTC (rev 237147)
+++ trunk/Source/WebCore/loader/EmptyFrameLoaderClient.h	2018-10-15 21:45:55 UTC (rev 237148)
@@ -166,7 +166,6 @@
     void updateGlobalHistory() final { }
     void updateGlobalHistoryRedirectLinks() final { }
     bool shouldGoToHistoryItem(HistoryItem&) const final { return false; }
-    void updateGlobalHistoryItemForPage() final { }
     void saveViewStateToItem(HistoryItem&) final { }
     bool canCachePage() const final { return false; }
     void didDisplayInsecureContent() final { }

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (237147 => 237148)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2018-10-15 21:40:49 UTC (rev 237147)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2018-10-15 21:45:55 UTC (rev 237148)
@@ -2437,7 +2437,6 @@
             if (shouldReset && item)
                 if (Page* page = m_frame.page()) {
                     page->backForward().setCurrentItem(item.get());
-                    m_frame.loader().client().updateGlobalHistoryItemForPage();
                 }
             return;
         }
@@ -3301,10 +3300,8 @@
         // we only do this when punting a navigation for the target frame or top-level frame.  
         if ((isTargetItem || m_frame.isMainFrame()) && isBackForwardLoadType(policyChecker().loadType())) {
             if (Page* page = m_frame.page()) {
-                if (HistoryItem* resetItem = m_frame.mainFrame().loader().history().currentItem()) {
+                if (HistoryItem* resetItem = m_frame.mainFrame().loader().history().currentItem())
                     page->backForward().setCurrentItem(resetItem);
-                    m_frame.loader().client().updateGlobalHistoryItemForPage();
-                }
             }
         }
         return;

Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (237147 => 237148)


--- trunk/Source/WebCore/loader/FrameLoaderClient.h	2018-10-15 21:40:49 UTC (rev 237147)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h	2018-10-15 21:45:55 UTC (rev 237148)
@@ -221,7 +221,6 @@
     virtual void updateGlobalHistoryRedirectLinks() = 0;
 
     virtual bool shouldGoToHistoryItem(HistoryItem&) const = 0;
-    virtual void updateGlobalHistoryItemForPage() { }
 
     // This frame has set its opener to null, disowning it for the lifetime of the frame.
     // See http://html.spec.whatwg.org/#dom-opener.

Modified: trunk/Source/WebCore/loader/HistoryController.cpp (237147 => 237148)


--- trunk/Source/WebCore/loader/HistoryController.cpp	2018-10-15 21:40:49 UTC (rev 237147)
+++ trunk/Source/WebCore/loader/HistoryController.cpp	2018-10-15 21:45:55 UTC (rev 237148)
@@ -317,7 +317,6 @@
     // as opposed to happening for some/one of the page commits that might happen soon
     RefPtr<HistoryItem> currentItem = page->backForward().currentItem();
     page->backForward().setCurrentItem(&targetItem);
-    m_frame.loader().client().updateGlobalHistoryItemForPage();
 
     // First set the provisional item of any frames that are not actually navigating.
     // This must be done before trying to navigate the desired frame, because some
@@ -395,8 +394,6 @@
                 if (frameLoader.documentLoader()->unreachableURL().isEmpty())
                     frameLoader.client().updateGlobalHistoryRedirectLinks();
             }
-
-            m_frame.loader().client().updateGlobalHistoryItemForPage();
         }
     } else {
         // The client redirect replaces the current history item.
@@ -429,8 +426,6 @@
                     if (m_frame.loader().documentLoader()->unreachableURL().isEmpty())
                         m_frame.loader().client().updateGlobalHistoryRedirectLinks();
                 }
-
-                m_frame.loader().client().updateGlobalHistoryItemForPage();
             }
         }
         // The client redirect replaces the current history item.

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (237147 => 237148)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2018-10-15 21:40:49 UTC (rev 237147)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2018-10-15 21:45:55 UTC (rev 237148)
@@ -1,5 +1,22 @@
 2018-10-15  Alex Christensen  <achristen...@webkit.org>
 
+        Remove unused WebView._globalHistoryItem
+        https://bugs.webkit.org/show_bug.cgi?id=190601
+
+        Reviewed by Chris Dumez.
+
+        * WebCoreSupport/WebFrameLoaderClient.h:
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (WebFrameLoaderClient::updateGlobalHistoryItemForPage): Deleted.
+        * WebView/WebView.mm:
+        (-[WebView _globalHistoryItem]): Deleted.
+        (-[WebView _setGlobalHistoryItem:]): Deleted.
+        * WebView/WebViewData.h:
+        * WebView/WebViewInternal.h:
+        * WebView/WebViewPrivate.h:
+
+2018-10-15  Alex Christensen  <achristen...@webkit.org>
+
         Remove unused parameters from FrameLoaderClient::createFrame
         https://bugs.webkit.org/show_bug.cgi?id=190587
 

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h (237147 => 237148)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h	2018-10-15 21:40:49 UTC (rev 237147)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h	2018-10-15 21:45:55 UTC (rev 237148)
@@ -156,7 +156,6 @@
     void updateGlobalHistoryRedirectLinks() final;
 
     bool shouldGoToHistoryItem(WebCore::HistoryItem&) const final;
-    void updateGlobalHistoryItemForPage() final;
 
     void didDisplayInsecureContent() final;
     void didRunInsecureContent(WebCore::SecurityOrigin&, const WebCore::URL&) final;

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm (237147 => 237148)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm	2018-10-15 21:40:49 UTC (rev 237147)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm	2018-10-15 21:45:55 UTC (rev 237148)
@@ -1103,19 +1103,6 @@
     return [[view _policyDelegateForwarder] webView:view shouldGoToHistoryItem:kit(&item)];
 }
 
-void WebFrameLoaderClient::updateGlobalHistoryItemForPage()
-{
-    HistoryItem* historyItem = 0;
-
-    if (Page* page = core(m_webFrame.get())->page()) {
-        if (!page->sessionID().isEphemeral())
-            historyItem = page->backForward().currentItem();
-    }
-
-    WebView *webView = getWebView(m_webFrame.get());
-    [webView _setGlobalHistoryItem:historyItem];
-}
-
 void WebFrameLoaderClient::didDisplayInsecureContent()
 {
     WebView *webView = getWebView(m_webFrame.get());   

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (237147 => 237148)


--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2018-10-15 21:40:49 UTC (rev 237147)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2018-10-15 21:45:55 UTC (rev 237148)
@@ -4468,19 +4468,6 @@
     [[self preferences] _postPreferencesChangedAPINotification];
 }
 
-- (WebHistoryItem *)_globalHistoryItem
-{
-    if (!_private)
-        return nil;
-
-    return kit(_private->_globalHistoryItem.get());
-}
-
-- (void)_setGlobalHistoryItem:(HistoryItem*)historyItem
-{
-    _private->_globalHistoryItem = historyItem;
-}
-
 - (WebTextIterator *)textIteratorForRect:(NSRect)rect
 {
     IntPoint rectStart(rect.origin.x, rect.origin.y);

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebViewData.h (237147 => 237148)


--- trunk/Source/WebKitLegacy/mac/WebView/WebViewData.h	2018-10-15 21:40:49 UTC (rev 237147)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebViewData.h	2018-10-15 21:45:55 UTC (rev 237148)
@@ -357,8 +357,6 @@
     std::unique_ptr<WebSelectionServiceController> _selectionServiceController;
 #endif
 
-    RefPtr<WebCore::HistoryItem> _globalHistoryItem;
-
     BOOL interactiveFormValidationEnabled;
     int validationMessageTimerMagnification;
 

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebViewInternal.h (237147 => 237148)


--- trunk/Source/WebKitLegacy/mac/WebView/WebViewInternal.h	2018-10-15 21:40:49 UTC (rev 237147)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebViewInternal.h	2018-10-15 21:45:55 UTC (rev 237148)
@@ -53,7 +53,6 @@
 class Frame;
 class HTMLMediaElement;
 class HTMLVideoElement;
-class HistoryItem;
 class KeyboardEvent;
 class Page;
 class RenderBox;
@@ -168,7 +167,6 @@
 
 #ifdef __cplusplus
 - (WebCore::Page*)page;
-- (void)_setGlobalHistoryItem:(WebCore::HistoryItem*)historyItem;
 - (WTF::String)_userAgentString;
 #endif
 

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebViewPrivate.h (237147 => 237148)


--- trunk/Source/WebKitLegacy/mac/WebView/WebViewPrivate.h	2018-10-15 21:40:49 UTC (rev 237147)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebViewPrivate.h	2018-10-15 21:45:55 UTC (rev 237148)
@@ -721,8 +721,6 @@
 - (BOOL)usesPageCache;
 - (void)setUsesPageCache:(BOOL)usesPageCache;
 
-- (WebHistoryItem *)_globalHistoryItem;
-
 /*!
     @method textIteratorForRect:
     @param rect The rectangle of the document that we're interested in text from.

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (237147 => 237148)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2018-10-15 21:40:49 UTC (rev 237147)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2018-10-15 21:45:55 UTC (rev 237148)
@@ -1,5 +1,20 @@
 2018-10-15  Alex Christensen  <achristen...@webkit.org>
 
+        Remove unused WebView._globalHistoryItem
+        https://bugs.webkit.org/show_bug.cgi?id=190601
+
+        Reviewed by Chris Dumez.
+
+        * WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebFrameLoaderClient::updateGlobalHistoryItemForPage): Deleted.
+        * WebCoreSupport/WebFrameLoaderClient.h:
+        * WebView.cpp:
+        (WebView::globalHistoryItem):
+        (WebView::setGlobalHistoryItem): Deleted.
+        * WebView.h:
+
+2018-10-15  Alex Christensen  <achristen...@webkit.org>
+
         Remove unused parameters from FrameLoaderClient::createFrame
         https://bugs.webkit.org/show_bug.cgi?id=190587
 

Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp (237147 => 237148)


--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp	2018-10-15 21:40:49 UTC (rev 237147)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp	2018-10-15 21:45:55 UTC (rev 237148)
@@ -770,19 +770,6 @@
     return true;
 }
 
-void WebFrameLoaderClient::updateGlobalHistoryItemForPage()
-{
-    HistoryItem* historyItem = 0;
-    WebView* webView = m_webFrame->webView();
-
-    if (Page* page = webView->page()) {
-        if (!page->usesEphemeralSession())
-            historyItem = page->backForward().currentItem();
-    }
-
-    webView->setGlobalHistoryItem(historyItem);
-}
-
 void WebFrameLoaderClient::didDisplayInsecureContent()
 {
     WebView* webView = m_webFrame->webView();

Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h (237147 => 237148)


--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h	2018-10-15 21:40:49 UTC (rev 237147)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h	2018-10-15 21:45:55 UTC (rev 237148)
@@ -137,7 +137,6 @@
     void updateGlobalHistory() override;
     void updateGlobalHistoryRedirectLinks() override;
     bool shouldGoToHistoryItem(WebCore::HistoryItem&) const override;
-    void updateGlobalHistoryItemForPage() override;
 
     void didDisplayInsecureContent() override;
     void didRunInsecureContent(WebCore::SecurityOrigin&, const WebCore::URL&) override;

Modified: trunk/Source/WebKitLegacy/win/WebView.cpp (237147 => 237148)


--- trunk/Source/WebKitLegacy/win/WebView.cpp	2018-10-15 21:40:49 UTC (rev 237147)
+++ trunk/Source/WebKitLegacy/win/WebView.cpp	2018-10-15 21:45:55 UTC (rev 237148)
@@ -6741,15 +6741,6 @@
     if (!item)
         return E_POINTER;
     *item = nullptr;
-    if (!m_page)
-        return E_FAIL;
-
-    if (!m_globalHistoryItem) {
-        *item = nullptr;
-        return S_OK;
-    }
-
-    *item = WebHistoryItem::createInstance(m_globalHistoryItem.copyRef());
     return S_OK;
 }
 
@@ -7516,11 +7507,6 @@
     return S_OK;
 }
 
-void WebView::setGlobalHistoryItem(HistoryItem* historyItem)
-{
-    m_globalHistoryItem = historyItem;
-}
-
 #if ENABLE(FULLSCREEN_API)
 bool WebView::supportsFullScreenForElement(const WebCore::Element*, bool withKeyboard) const
 {

Modified: trunk/Source/WebKitLegacy/win/WebView.h (237147 => 237148)


--- trunk/Source/WebKitLegacy/win/WebView.h	2018-10-15 21:40:49 UTC (rev 237147)
+++ trunk/Source/WebKitLegacy/win/WebView.h	2018-10-15 21:45:55 UTC (rev 237148)
@@ -516,8 +516,6 @@
 
     void setLastCursor(HCURSOR cursor) { m_lastSetCursor = cursor; }
 
-    void setGlobalHistoryItem(WebCore::HistoryItem*);
-
 #if ENABLE(FULLSCREEN_API)
     bool supportsFullScreenForElement(const WebCore::Element*, bool withKeyboard) const;
     bool isFullScreen() const;
@@ -717,8 +715,6 @@
 
     HCURSOR m_lastSetCursor { nullptr };
 
-    RefPtr<WebCore::HistoryItem> m_globalHistoryItem;
-
 #if ENABLE(FULLSCREEN_API)
     RefPtr<WebCore::Element> m_fullScreenElement;
     std::unique_ptr<WebCore::FullScreenController> m_fullscreenController;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to