Changeset 80310 in webkit


Ignore:
Timestamp:
Mar 3, 2011 7:21:07 PM (13 years ago)
Author:
andersca@apple.com
Message:

2011-03-03 Anders Carlsson <andersca@apple.com>

Reviewed by Sam Weinig.

Get rid of Page::globalHistoryItem
https://bugs.webkit.org/show_bug.cgi?id=55738

  • WebCoreSupport/WebFrameLoaderClient.cpp: (WebFrameLoaderClient::updateGlobalHistoryItemForPage): Get the current history item and update it using WebView::setGlobalHistoryItem.


  • WebCoreSupport/WebFrameLoaderClient.h:
  • WebView.cpp: (WebView::globalHistoryItem): (WebView::setGlobalHistoryItem):
  • WebView.h:

2011-03-03 Anders Carlsson <andersca@apple.com>

Reviewed by Sam Weinig.

Get rid of Page::globalHistoryItem
https://bugs.webkit.org/show_bug.cgi?id=55738

  • WebCoreSupport/WebFrameLoaderClient.h:
  • WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::updateGlobalHistoryItemForPage): Get the current history item and update it using -[WebView _setGlobalHistoryItem:].


  • WebView/WebView.mm: (-[WebView _globalHistoryItem]): (-[WebView _setGlobalHistoryItem:]): Set _globalHistoryItem ivar.
  • WebView/WebViewData.h:
  • WebView/WebViewData.mm: Add _globalHistoryItem ivar.

2011-03-03 Anders Carlsson <andersca@apple.com>

Reviewed by Sam Weinig.

Get rid of Page::globalHistoryItem
https://bugs.webkit.org/show_bug.cgi?id=55738

The m_globalHistoryItem is only used by Mac and Windows WebKit1.
Instead of having WebCore updating this member variable, just call out
to a FrameLoaderClient member function and let WebKit keep it up to date.

  • loader/EmptyClients.h: (WebCore::EmptyFrameLoaderClient::dispatchDidRemoveBackForwardItem): (WebCore::EmptyFrameLoaderClient::updateGlobalHistoryItemForPage):
  • loader/FrameLoader.cpp: (WebCore::FrameLoader::checkLoadCompleteForThisFrame): (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
  • loader/FrameLoaderClient.h: (WebCore::FrameLoaderClient::updateGlobalHistoryItemForPage):
  • loader/HistoryController.cpp: (WebCore::HistoryController::goToItem): (WebCore::HistoryController::updateForStandardLoad): (WebCore::HistoryController::updateForRedirectWithLockedBackForwardList):
  • page/Page.cpp:
  • page/Page.h:
Location:
trunk/Source
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r80308 r80310  
     12011-03-03  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Get rid of Page::globalHistoryItem
     6        https://bugs.webkit.org/show_bug.cgi?id=55738
     7
     8        The m_globalHistoryItem is only used by Mac and Windows WebKit1.
     9        Instead of having WebCore updating this member variable, just call out
     10        to a FrameLoaderClient member function and let WebKit keep it up to date.
     11
     12        * loader/EmptyClients.h:
     13        (WebCore::EmptyFrameLoaderClient::dispatchDidRemoveBackForwardItem):
     14        (WebCore::EmptyFrameLoaderClient::updateGlobalHistoryItemForPage):
     15        * loader/FrameLoader.cpp:
     16        (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
     17        (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
     18        * loader/FrameLoaderClient.h:
     19        (WebCore::FrameLoaderClient::updateGlobalHistoryItemForPage):
     20        * loader/HistoryController.cpp:
     21        (WebCore::HistoryController::goToItem):
     22        (WebCore::HistoryController::updateForStandardLoad):
     23        (WebCore::HistoryController::updateForRedirectWithLockedBackForwardList):
     24        * page/Page.cpp:
     25        * page/Page.h:
     26
    1272011-03-02  Jeremy Orlow  <jorlow@chromium.org>
    228
  • trunk/Source/WebCore/loader/EmptyClients.h

    r80279 r80310  
    353353    virtual bool shouldStopLoadingForHistoryItem(HistoryItem*) const { return false; }
    354354    virtual void dispatchDidAddBackForwardItem(HistoryItem*) const { }
    355     virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const { };
     355    virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const { }
    356356    virtual void dispatchDidChangeBackForwardIndex() const { }
     357    virtual void updateGlobalHistoryItemForPage() { }
    357358    virtual void saveViewStateToItem(HistoryItem*) { }
    358359    virtual bool canCachePage() const { return false; }
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r80299 r80310  
    23922392                if (Page* page = m_frame->page()) {
    23932393                    page->backForward()->setCurrentItem(item.get());
    2394                     Settings* settings = m_frame->settings();
    2395                     page->setGlobalHistoryItem((!settings || settings->privateBrowsingEnabled()) ? 0 : item.get());
     2394                    m_frame->loader()->client()->updateGlobalHistoryItemForPage();
    23962395                }
    23972396            return;
     
    29632962        // problem that we have optimistically moved the b/f cursor already, so move it back.  For sanity,
    29642963        // we only do this when punting a navigation for the target frame or top-level frame. 
    2965         if ((isTargetItem || isLoadingMainFrame()) && isBackForwardLoadType(policyChecker()->loadType()))
     2964        if ((isTargetItem || isLoadingMainFrame()) && isBackForwardLoadType(policyChecker()->loadType())) {
    29662965            if (Page* page = m_frame->page()) {
    29672966                Frame* mainFrame = page->mainFrame();
    29682967                if (HistoryItem* resetItem = mainFrame->loader()->history()->currentItem()) {
    29692968                    page->backForward()->setCurrentItem(resetItem);
    2970                     Settings* settings = m_frame->settings();
    2971                     page->setGlobalHistoryItem((!settings || settings->privateBrowsingEnabled()) ? 0 : resetItem);
     2969                    m_frame->loader()->client()->updateGlobalHistoryItemForPage();
    29722970                }
    29732971            }
     2972        }
    29742973        return;
    29752974    }
  • trunk/Source/WebCore/loader/FrameLoaderClient.h

    r79771 r80310  
    192192        virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const = 0;
    193193        virtual void dispatchDidChangeBackForwardIndex() const = 0;
     194        virtual void updateGlobalHistoryItemForPage() { }
    194195
    195196        // This frame has displayed inactive content (such as an image) from an
  • trunk/Source/WebCore/loader/HistoryController.cpp

    r79107 r80310  
    251251    RefPtr<HistoryItem> currentItem = page->backForward()->currentItem();
    252252    page->backForward()->setCurrentItem(targetItem);
    253     Settings* settings = m_frame->settings();
    254     page->setGlobalHistoryItem((!settings || settings->privateBrowsingEnabled()) ? 0 : targetItem);
     253    m_frame->loader()->client()->updateGlobalHistoryItemForPage();
    255254
    256255    // First set the provisional item of any frames that are not actually navigating.
     
    324323                    frameLoader->client()->updateGlobalHistoryRedirectLinks();
    325324            }
    326             if (Page* page = m_frame->page())
    327                 page->setGlobalHistoryItem(needPrivacy ? 0 : page->backForward()->currentItem());
     325
     326            m_frame->loader()->client()->updateGlobalHistoryItemForPage();
    328327        }
    329328    } else {
     
    362361                        m_frame->loader()->client()->updateGlobalHistoryRedirectLinks();
    363362                }
    364                 if (Page* page = m_frame->page())
    365                     page->setGlobalHistoryItem(needPrivacy ? 0 : page->backForward()->currentItem());
     363
     364                m_frame->loader()->client()->updateGlobalHistoryItemForPage();
    366365            }
    367366        }
  • trunk/Source/WebCore/page/Page.cpp

    r80030 r80310  
    344344}
    345345
    346 void Page::setGlobalHistoryItem(HistoryItem* item)
    347 {
    348     m_globalHistoryItem = item;
    349 }
    350 
    351346void Page::setGroupName(const String& name)
    352347{
  • trunk/Source/WebCore/page/Page.h

    r78620 r80310  
    148148        void goToItem(HistoryItem*, FrameLoadType);
    149149
    150         HistoryItem* globalHistoryItem() const { return m_globalHistoryItem.get(); }
    151         void setGlobalHistoryItem(HistoryItem*);
    152 
    153150        void setGroupName(const String&);
    154151        const String& groupName() const;
     
    336333        RefPtr<Frame> m_mainFrame;
    337334
    338         RefPtr<HistoryItem> m_globalHistoryItem;
    339 
    340335        mutable RefPtr<PluginData> m_pluginData;
    341336
  • trunk/Source/WebKit/mac/ChangeLog

    r80299 r80310  
     12011-03-03  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Get rid of Page::globalHistoryItem
     6        https://bugs.webkit.org/show_bug.cgi?id=55738
     7
     8        * WebCoreSupport/WebFrameLoaderClient.h:
     9        * WebCoreSupport/WebFrameLoaderClient.mm:
     10        (WebFrameLoaderClient::updateGlobalHistoryItemForPage):
     11        Get the current history item and update it using -[WebView _setGlobalHistoryItem:].
     12   
     13        * WebView/WebView.mm:
     14        (-[WebView _globalHistoryItem]):
     15        (-[WebView _setGlobalHistoryItem:]):
     16        Set _globalHistoryItem ivar.
     17
     18        * WebView/WebViewData.h:
     19        * WebView/WebViewData.mm:
     20        Add _globalHistoryItem ivar.
     21
    1222011-03-03  Brady Eidson  <beidson@apple.com>
    223
  • trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h

    r79771 r80310  
    156156    virtual void dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const;
    157157    virtual void dispatchDidChangeBackForwardIndex() const;
     158    virtual void updateGlobalHistoryItemForPage();
    158159
    159160    virtual void didDisplayInsecureContent();
  • trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm

    r79771 r80310  
    7676#import "WebViewInternal.h"
    7777#import <WebCore/AuthenticationMac.h>
     78#import <WebCore/BackForwardController.h>
    7879#import <WebCore/BlockExceptions.h>
    7980#import <WebCore/CachedFrame.h>
     
    967968}
    968969
     970void WebFrameLoaderClient::updateGlobalHistoryItemForPage()
     971{
     972    HistoryItem* historyItem = 0;
     973
     974    if (Page* page = core(m_webFrame.get())->page()) {
     975        if (!page->settings()->privateBrowsingEnabled())
     976            historyItem = page->backForward()->currentItem();
     977    }
     978
     979    WebView *webView = getWebView(m_webFrame.get());
     980    [webView _setGlobalHistoryItem:historyItem];
     981}
     982
    969983void WebFrameLoaderClient::didDisplayInsecureContent()
    970984{
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r80299 r80310  
    22532253- (WebHistoryItem *)_globalHistoryItem
    22542254{
    2255     if (!_private->page)
     2255    if (!_private)
    22562256        return nil;
    2257     return kit(_private->page->globalHistoryItem());
     2257
     2258    return kit(_private->_globalHistoryItem.get());
     2259}
     2260
     2261- (void)_setGlobalHistoryItem:(HistoryItem*)historyItem
     2262{
     2263    _private->_globalHistoryItem = historyItem;
    22582264}
    22592265
  • trunk/Source/WebKit/mac/WebView/WebViewData.h

    r79953 r80310  
    3636
    3737namespace WebCore {
     38    class HistoryItem;
    3839    class Page;
    3940}
     
    184185    id<WebGeolocationProvider> _geolocationProvider;
    185186    id<WebDeviceOrientationProvider> m_deviceOrientationProvider;
     187
     188    RefPtr<WebCore::HistoryItem> _globalHistoryItem;
    186189}
    187190@end
  • trunk/Source/WebKit/mac/WebView/WebViewData.mm

    r67274 r80310  
    3333#import "WebPreferenceKeysPrivate.h"
    3434#import <WebCore/WebCoreObjCExtras.h>
     35#import <WebCore/HistoryItem.h>
    3536#import <objc/objc-auto.h>
    3637#import <runtime/InitializeThreading.h>
  • trunk/Source/WebKit/mac/WebView/WebViewInternal.h

    r75277 r80310  
    4242    class Element;
    4343    class Frame;
     44    class HistoryItem;
    4445    class KURL;
    4546    class KeyboardEvent;
     
    115116#ifdef __cplusplus
    116117- (WebCore::Page*)page;
     118- (void)_setGlobalHistoryItem:(WebCore::HistoryItem*)historyItem;
    117119#endif
    118120
  • trunk/Source/WebKit/win/ChangeLog

    r80305 r80310  
     12011-03-03  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Get rid of Page::globalHistoryItem
     6        https://bugs.webkit.org/show_bug.cgi?id=55738
     7
     8        * WebCoreSupport/WebFrameLoaderClient.cpp:
     9        (WebFrameLoaderClient::updateGlobalHistoryItemForPage):
     10        Get the current history item and update it using WebView::setGlobalHistoryItem.
     11       
     12        * WebCoreSupport/WebFrameLoaderClient.h:
     13        * WebView.cpp:
     14        (WebView::globalHistoryItem):
     15        (WebView::setGlobalHistoryItem):
     16        * WebView.h:
     17
    1182011-03-03  Brent Fulgham  <bfulgham@webkit.org>
    219
  • trunk/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp

    r79107 r80310  
    5151#include "WebView.h"
    5252#pragma warning(push, 0)
     53#include <WebCore/BackForwardController.h>
    5354#include <WebCore/CachedFrame.h>
    5455#include <WebCore/DocumentLoader.h>
     
    6869#include <WebCore/RenderPart.h>
    6970#include <WebCore/ResourceHandle.h>
     71#include <WebCore/Settings.h>
    7072#pragma warning(pop)
    7173
     
    620622}
    621623
     624void WebFrameLoaderClient::updateGlobalHistoryItemForPage()
     625{
     626    HistoryItem* historyItem = 0;
     627    WebView* webView = m_webFrame->webView();
     628
     629    if (Page* page = webView->page()) {
     630        if (!page->settings()->privateBrowsingEnabled())
     631            historyItem = page->backForward()->currentItem();
     632    }
     633
     634    webView->setGlobalHistoryItem(historyItem);
     635}
     636
    622637void WebFrameLoaderClient::didDisplayInsecureContent()
    623638{
  • trunk/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h

    r79107 r80310  
    9999    virtual void dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const;
    100100    virtual void dispatchDidChangeBackForwardIndex() const;
     101    virtual void updateGlobalHistoryItemForPage();
    101102
    102103    virtual void didDisplayInsecureContent();
  • trunk/Source/WebKit/win/WebView.cpp

    r80218 r80310  
    58935893        return E_FAIL;
    58945894
    5895     if (!m_page->globalHistoryItem()) {
     5895    if (!m_globalHistoryItem) {
    58965896        *item = 0;
    58975897        return S_OK;
    58985898    }
    58995899
    5900     *item = WebHistoryItem::createInstance(m_page->globalHistoryItem());
     5900    *item = WebHistoryItem::createInstance(m_globalHistoryItem);
    59015901    return S_OK;
    59025902}
     
    66346634    return S_OK;
    66356635}
     6636
     6637void WebView::setGlobalHistoryItem(HistoryItem* historyItem)
     6638{
     6639    m_globalHistoryItem = historyItem;
     6640}
  • trunk/Source/WebKit/win/WebView.h

    r78620 r80310  
    4848}
    4949#endif
     50
     51namespace WebCore {
     52    class HistoryItem;
     53}
    5054
    5155class FullscreenVideoController;
     
    925929    void setLastCursor(HCURSOR cursor) { m_lastSetCursor = cursor; }
    926930
     931    void setGlobalHistoryItem(WebCore::HistoryItem*);
     932
    927933private:
    928934    void setZoomMultiplier(float multiplier, bool isTextOnly);
     
    10741080
    10751081    HCURSOR m_lastSetCursor;
     1082
     1083    RefPtr<WebCore::HistoryItem> m_globalHistoryItem;
    10761084};
    10771085
Note: See TracChangeset for help on using the changeset viewer.