Commit e10e1282 authored by darin@apple.com's avatar darin@apple.com

More back/forward refactoring

Reviewed by Sam Weinig.

WebCore: 

* WebCore.exp.in: Updated.

* GNUmakefile.am: Removed BackForwardControllerClient.h.
* WebCore.gypi: Ditto.
* WebCore.pro: Ditto.
* WebCore.vcproj/WebCore.vcproj: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.

* history/BackForwardControllerClient.h: Removed.

* history/BackForwardController.cpp:
(WebCore::BackForwardController::BackForwardController):
Set up just m_client.
(WebCore::BackForwardController::~BackForwardController):
Removed call to backForwardControllerDestroyed.
(WebCore::BackForwardController::canGoBackOrForward): Added.
(WebCore::BackForwardController::goBackOrForward): Added.
(WebCore::BackForwardController::goBack): Added.
(WebCore::BackForwardController::goForward): Added.
(WebCore::BackForwardController::addItem): Added.
(WebCore::BackForwardController::setCurrentItem): Added.
(WebCore::BackForwardController::count): Added.
(WebCore::BackForwardController::backCount): Added.
(WebCore::BackForwardController::forwardCount): Added.
(WebCore::BackForwardController::itemAtIndex): Added.
(WebCore::BackForwardController::isActive): Added.
(WebCore::BackForwardController::close): Added.

* history/BackForwardController.h: Added functions from Page
and BackForwardList that should be called here instead.
Note that BackForwardList is to be renamed BackForwardClient soon.

* history/BackForwardList.h: Removed many now-unneeded
virtual functions.

* history/BackForwardListImpl.h: Moved BackForwardListClient
in here.

* history/PageCache.cpp:
(WebCore::logCanCachePageDecision): Use backForward().
(WebCore::PageCache::canCache): Ditto.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::transitionToCommitted): Removed unneeded
null check of backFowardList, which is never null.
(WebCore::FrameLoader::checkLoadCompleteForThisFrame): Use backForward.
(WebCore::FrameLoader::didFirstLayout): Ditto.
(WebCore::FrameLoader::continueLoadAfterNavigationPolicy): Ditto.
(WebCore::FrameLoader::checkDidPerformFirstNavigation): Ditto.
* loader/HistoryController.cpp:
(WebCore::HistoryController::goToItem): Ditto.
(WebCore::HistoryController::updateForStandardLoad): Ditto.
(WebCore::HistoryController::updateForRedirectWithLockedBackForwardList): Ditto.
(WebCore::HistoryController::updateBackForwardListClippedAtTarget): Ditto.
(WebCore::HistoryController::pushState): Ditto.
* loader/NavigationScheduler.cpp:
(WebCore::ScheduledHistoryNavigation::fire): Ditto.
(WebCore::NavigationScheduler::scheduleHistoryNavigation): Ditto.
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected): Ditto.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::close): Ditto.
* page/History.cpp:
(WebCore::History::length): Ditto.

* page/Page.cpp:
(WebCore::Page::Page): Use more adoptPtr. Use backForwardClient instead of
backForwardControllerClient.
(WebCore::Page::~Page): Use backForward.
(WebCore::Page::backForwardList): Ditto.
(WebCore::Page::goBack): Ditto.
(WebCore::Page::goForward): Ditto.
(WebCore::Page::canGoBackOrForward): Ditto.
(WebCore::Page::goBackOrForward): Ditto.
(WebCore::Page::getHistoryLength): Ditto.
(WebCore::Page::PageClients::PageClients): Made non-inline.
(WebCore::Page::PageClients::~PageClients): Ditto.

* page/Page.h: Made PageClients constructor and destructor non-inline.
Added backForward function. Marked old functions as deprecated.

* page/Settings.cpp:
(WebCore::Settings::setUsesPageCache): Use backForward.
* platform/ContextMenu.cpp:
(WebCore::ContextMenu::populate): Ditto.
(WebCore::ContextMenu::checkOrEnableIfNeeded): Ditto.
* wml/WMLDoElement.cpp:
(WebCore::WMLDoElement::defaultEventHandler): Ditto.
* wml/WMLDocument.cpp:
(WebCore::WMLDocument::finishedParsing): Ditto.
* wml/WMLPageState.cpp:
(WebCore::WMLPageState::reset): Ditto.
(WebCore::tryAccessHistoryURLs): Ditto.
* wml/WMLPrevElement.cpp:
(WebCore::WMLPrevElement::executeTask): Ditto.

WebKit2: 

* WebKit2.pro: Removed WebBackForwardControllerClient.cpp and .h.
* WebKit2.xcodeproj/project.pbxproj: Ditto.

* WebProcess/WebCoreSupport/WebBackForwardControllerClient.cpp: Removed.
* WebProcess/WebCoreSupport/WebBackForwardControllerClient.h: Removed.

* WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp:
(WebKit::InjectedBundleBackForwardList::itemAtIndex): Use backForward.
(WebKit::InjectedBundleBackForwardList::backListCount): Ditto.
(WebKit::InjectedBundleBackForwardList::forwardListCount): Ditto.
(WebKit::InjectedBundleBackForwardList::clear): Ditto.

* WebProcess/WebPage/WebBackForwardListProxy.h: Added newly-needed include.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Set up backForwardClient.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70960 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 074b7584
2010-10-29 Darin Adler <darin@apple.com>
Reviewed by Sam Weinig.
More back/forward refactoring
* WebCore.exp.in: Updated.
* GNUmakefile.am: Removed BackForwardControllerClient.h.
* WebCore.gypi: Ditto.
* WebCore.pro: Ditto.
* WebCore.vcproj/WebCore.vcproj: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* history/BackForwardControllerClient.h: Removed.
* history/BackForwardController.cpp:
(WebCore::BackForwardController::BackForwardController):
Set up just m_client.
(WebCore::BackForwardController::~BackForwardController):
Removed call to backForwardControllerDestroyed.
(WebCore::BackForwardController::canGoBackOrForward): Added.
(WebCore::BackForwardController::goBackOrForward): Added.
(WebCore::BackForwardController::goBack): Added.
(WebCore::BackForwardController::goForward): Added.
(WebCore::BackForwardController::addItem): Added.
(WebCore::BackForwardController::setCurrentItem): Added.
(WebCore::BackForwardController::count): Added.
(WebCore::BackForwardController::backCount): Added.
(WebCore::BackForwardController::forwardCount): Added.
(WebCore::BackForwardController::itemAtIndex): Added.
(WebCore::BackForwardController::isActive): Added.
(WebCore::BackForwardController::close): Added.
* history/BackForwardController.h: Added functions from Page
and BackForwardList that should be called here instead.
Note that BackForwardList is to be renamed BackForwardClient soon.
* history/BackForwardList.h: Removed many now-unneeded
virtual functions.
* history/BackForwardListImpl.h: Moved BackForwardListClient
in here.
* history/PageCache.cpp:
(WebCore::logCanCachePageDecision): Use backForward().
(WebCore::PageCache::canCache): Ditto.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::transitionToCommitted): Removed unneeded
null check of backFowardList, which is never null.
(WebCore::FrameLoader::checkLoadCompleteForThisFrame): Use backForward.
(WebCore::FrameLoader::didFirstLayout): Ditto.
(WebCore::FrameLoader::continueLoadAfterNavigationPolicy): Ditto.
(WebCore::FrameLoader::checkDidPerformFirstNavigation): Ditto.
* loader/HistoryController.cpp:
(WebCore::HistoryController::goToItem): Ditto.
(WebCore::HistoryController::updateForStandardLoad): Ditto.
(WebCore::HistoryController::updateForRedirectWithLockedBackForwardList): Ditto.
(WebCore::HistoryController::updateBackForwardListClippedAtTarget): Ditto.
(WebCore::HistoryController::pushState): Ditto.
* loader/NavigationScheduler.cpp:
(WebCore::ScheduledHistoryNavigation::fire): Ditto.
(WebCore::NavigationScheduler::scheduleHistoryNavigation): Ditto.
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected): Ditto.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::close): Ditto.
* page/History.cpp:
(WebCore::History::length): Ditto.
* page/Page.cpp:
(WebCore::Page::Page): Use more adoptPtr. Use backForwardClient instead of
backForwardControllerClient.
(WebCore::Page::~Page): Use backForward.
(WebCore::Page::backForwardList): Ditto.
(WebCore::Page::goBack): Ditto.
(WebCore::Page::goForward): Ditto.
(WebCore::Page::canGoBackOrForward): Ditto.
(WebCore::Page::goBackOrForward): Ditto.
(WebCore::Page::getHistoryLength): Ditto.
(WebCore::Page::PageClients::PageClients): Made non-inline.
(WebCore::Page::PageClients::~PageClients): Ditto.
* page/Page.h: Made PageClients constructor and destructor non-inline.
Added backForward function. Marked old functions as deprecated.
* page/Settings.cpp:
(WebCore::Settings::setUsesPageCache): Use backForward.
* platform/ContextMenu.cpp:
(WebCore::ContextMenu::populate): Ditto.
(WebCore::ContextMenu::checkOrEnableIfNeeded): Ditto.
* wml/WMLDoElement.cpp:
(WebCore::WMLDoElement::defaultEventHandler): Ditto.
* wml/WMLDocument.cpp:
(WebCore::WMLDocument::finishedParsing): Ditto.
* wml/WMLPageState.cpp:
(WebCore::WMLPageState::reset): Ditto.
(WebCore::tryAccessHistoryURLs): Ditto.
* wml/WMLPrevElement.cpp:
(WebCore::WMLPrevElement::executeTask): Ditto.
2010-10-29 David Hyatt <hyatt@apple.com>
Reviewed by Sam Weinig.
......@@ -1444,7 +1444,6 @@ webcore_sources += \
WebCore/fileapi/Metadata.h \
WebCore/fileapi/ThreadableBlobRegistry.cpp \
WebCore/fileapi/ThreadableBlobRegistry.h \
WebCore/history/BackForwardControllerClient.h \
WebCore/history/BackForwardController.cpp \
WebCore/history/BackForwardController.h \
WebCore/history/BackForwardList.h \
......
......@@ -435,9 +435,21 @@ __ZN7WebCore19AnimationController16resumeAnimationsEPNS_8DocumentE
__ZN7WebCore19AnimationController17suspendAnimationsEPNS_8DocumentE
__ZN7WebCore19AnimationController20pauseAnimationAtTimeEPNS_12RenderObjectERKN3WTF6StringEd
__ZN7WebCore19AnimationController21pauseTransitionAtTimeEPNS_12RenderObjectERKN3WTF6StringEd
__ZN7WebCore19BackForwardListImpl10removeItemEPNS_11HistoryItemE
__ZN7WebCore19BackForwardListImpl10setEnabledEb
__ZN7WebCore19BackForwardListImpl11currentItemEv
__ZN7WebCore19BackForwardListImpl11forwardItemEv
__ZN7WebCore19BackForwardListImpl11setCapacityEi
__ZN7WebCore19BackForwardListImpl12containsItemEPNS_11HistoryItemE
__ZN7WebCore19BackForwardListImpl17backListWithLimitEiRN3WTF6VectorINS1_6RefPtrINS_11HistoryItemEEELm0EEE
__ZN7WebCore19BackForwardListImpl20forwardListWithLimitEiRN3WTF6VectorINS1_6RefPtrINS_11HistoryItemEEELm0EEE
__ZN7WebCore19BackForwardListImpl6closedEv
__ZN7WebCore19BackForwardListImpl6goBackEv
__ZN7WebCore19BackForwardListImpl7enabledEv
__ZN7WebCore19BackForwardListImpl7entriesEv
__ZN7WebCore19BackForwardListImpl8backItemEv
__ZN7WebCore19BackForwardListImpl8capacityEv
__ZN7WebCore19BackForwardListImpl9goForwardEv
__ZN7WebCore19BackForwardListImplC1EPNS_4PageE
__ZN7WebCore19CSSStyleDeclaration11setPropertyERKN3WTF6StringES4_Ri
__ZN7WebCore19ResourceRequestBase11setHTTPBodyEN3WTF10PassRefPtrINS_8FormDataEEE
......@@ -463,6 +475,7 @@ __ZN7WebCore20ResourceResponseBase24setExpectedContentLengthEx
__ZN7WebCore20ResourceResponseBaseC2Ev
__ZN7WebCore20SpaceSplitStringData12createVectorEv
__ZN7WebCore20protocolIsJavaScriptERKN3WTF6StringE
__ZN7WebCore21BackForwardController11itemAtIndexEi
__ZN7WebCore21PlatformKeyboardEvent24disambiguateKeyDownEventENS0_4TypeEb
__ZN7WebCore21PlatformKeyboardEventC1EP7NSEvent
__ZN7WebCore21SVGDocumentExtensions21sampleAnimationAtTimeERKN3WTF6StringEPNS_14SVGSMILElementEd
......@@ -581,6 +594,8 @@ __ZN7WebCore4Node17stopIgnoringLeaksEv
__ZN7WebCore4Node18startIgnoringLeaksEv
__ZN7WebCore4Node19setNeedsStyleRecalcENS_15StyleChangeTypeE
__ZN7WebCore4Page10findStringERKN3WTF6StringENS1_19TextCaseSensitivityENS_13FindDirectionEb
__ZN7WebCore4Page11PageClientsC1Ev
__ZN7WebCore4Page11PageClientsD1Ev
__ZN7WebCore4Page12setGroupNameERKN3WTF6StringE
__ZN7WebCore4Page13didStopPluginEPNS_14HaltablePluginE
__ZN7WebCore4Page14didStartPluginEPNS_14HaltablePluginE
......@@ -1023,6 +1038,8 @@ __ZNK7WebCore20ResourceResponseBase21expectedContentLengthEv
__ZNK7WebCore20ResourceResponseBase3urlEv
__ZNK7WebCore20ResourceResponseBase6isHTTPEv
__ZNK7WebCore20ResourceResponseBase8mimeTypeEv
__ZNK7WebCore21BackForwardController12forwardCountEv
__ZNK7WebCore21BackForwardController9backCountEv
__ZNK7WebCore21UserContentURLPattern7matchesERKNS_4KURLE
__ZNK7WebCore23FrameLoaderStateMachine15firstLayoutDoneEv
__ZNK7WebCore23FrameLoaderStateMachine23committingFirstRealLoadEv
......
......@@ -1535,7 +1535,6 @@
'history/mac/HistoryItemMac.mm',
'history/BackForwardController.cpp',
'history/BackForwardController.h',
'history/BackForwardControllerClient.h',
'history/BackForwardList.h',
'history/BackForwardListImpl.cpp',
'history/BackForwardListImpl.h',
......
......@@ -1747,7 +1747,6 @@ HEADERS += \
fileapi/FileThread.h \
fileapi/FileThreadTask.h \
history/BackForwardController.h \
history/BackForwardControllerClient.h \
history/BackForwardListImpl.h \
history/BackForwardList.h \
history/CachedFrame.h \
......
......@@ -62991,10 +62991,6 @@
RelativePath="..\history\BackForwardController.h"
>
</File>
<File
RelativePath="..\history\BackForwardControllerClient.h"
>
</File>
<File
RelativePath="..\history\BackForwardList.h"
>
......@@ -5008,7 +5008,6 @@
BCA85A100C3AEAF4006F8308 /* DOMSVGNumberInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA85A0F0C3AEAF4006F8308 /* DOMSVGNumberInternal.h */; };
BCA8C81E11E3D36900812FB7 /* BackForwardController.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA8C81C11E3D36900812FB7 /* BackForwardController.h */; settings = {ATTRIBUTES = (Private, ); }; };
BCA8C81F11E3D36900812FB7 /* BackForwardController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA8C81D11E3D36900812FB7 /* BackForwardController.cpp */; };
BCA8C83111E3D53200812FB7 /* BackForwardControllerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA8C83011E3D53200812FB7 /* BackForwardControllerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
BCA8CA5F11E4E6D100812FB7 /* BackForwardListImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA8CA5D11E4E6D100812FB7 /* BackForwardListImpl.cpp */; };
BCA8CA6011E4E6D100812FB7 /* BackForwardListImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA8CA5E11E4E6D100812FB7 /* BackForwardListImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
BCA979171215D055005C485C /* ImageBufferData.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA979161215D055005C485C /* ImageBufferData.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -11021,7 +11020,6 @@
BCA85A0F0C3AEAF4006F8308 /* DOMSVGNumberInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMSVGNumberInternal.h; sourceTree = "<group>"; };
BCA8C81C11E3D36900812FB7 /* BackForwardController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackForwardController.h; sourceTree = "<group>"; };
BCA8C81D11E3D36900812FB7 /* BackForwardController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BackForwardController.cpp; sourceTree = "<group>"; };
BCA8C83011E3D53200812FB7 /* BackForwardControllerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackForwardControllerClient.h; sourceTree = "<group>"; };
BCA8CA5D11E4E6D100812FB7 /* BackForwardListImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BackForwardListImpl.cpp; sourceTree = "<group>"; };
BCA8CA5E11E4E6D100812FB7 /* BackForwardListImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackForwardListImpl.h; sourceTree = "<group>"; };
BCA979161215D055005C485C /* ImageBufferData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageBufferData.h; sourceTree = "<group>"; };
......@@ -12824,7 +12822,6 @@
5160F4920B0AA71500C1D2AF /* mac */,
BCA8C81D11E3D36900812FB7 /* BackForwardController.cpp */,
BCA8C81C11E3D36900812FB7 /* BackForwardController.h */,
BCA8C83011E3D53200812FB7 /* BackForwardControllerClient.h */,
51741D0B0B07259A00ED442C /* BackForwardList.h */,
BCA8CA5D11E4E6D100812FB7 /* BackForwardListImpl.cpp */,
BCA8CA5E11E4E6D100812FB7 /* BackForwardListImpl.h */,
......@@ -18454,7 +18451,6 @@
A8CFF04E0A154F09000A4234 /* AutoTableLayout.h in Headers */,
29A812380FBB9C1D00510293 /* AXObjectCache.h in Headers */,
BCA8C81E11E3D36900812FB7 /* BackForwardController.h in Headers */,
BCA8C83111E3D53200812FB7 /* BackForwardControllerClient.h in Headers */,
51741D0F0B07259A00ED442C /* BackForwardList.h in Headers */,
BCA8CA6011E4E6D100812FB7 /* BackForwardListImpl.h in Headers */,
BC124EE80C2641CD009E2349 /* BarInfo.h in Headers */,
......@@ -26,26 +26,82 @@
#include "config.h"
#include "BackForwardController.h"
#include "BackForwardControllerClient.h"
#include "BackForwardList.h"
#include "BackForwardListImpl.h"
#include "HistoryItem.h"
#include "Page.h"
namespace WebCore {
BackForwardController::BackForwardController(Page* page, BackForwardControllerClient* client)
BackForwardController::BackForwardController(Page* page, PassRefPtr<BackForwardList> client)
: m_page(page)
, m_client(client)
{
if (!m_client)
m_list = BackForwardListImpl::create(page);
else
m_list = m_client->createBackForwardList(page);
m_client = BackForwardListImpl::create(page);
}
BackForwardController::~BackForwardController()
{
if (m_client)
m_client->backForwardControllerDestroyed();
}
bool BackForwardController::canGoBackOrForward(int distance) const
{
return m_page->canGoBackOrForward(distance);
}
void BackForwardController::goBackOrForward(int distance)
{
m_page->goBackOrForward(distance);
}
bool BackForwardController::goBack()
{
return m_page->goBack();
}
bool BackForwardController::goForward()
{
return m_page->goForward();
}
void BackForwardController::addItem(PassRefPtr<HistoryItem> item)
{
m_client->addItem(item);
}
void BackForwardController::setCurrentItem(HistoryItem* item)
{
m_client->goToItem(item);
}
int BackForwardController::count() const
{
return m_page->getHistoryLength();
}
int BackForwardController::backCount() const
{
return m_client->backListCount();
}
int BackForwardController::forwardCount() const
{
return m_client->forwardListCount();
}
HistoryItem* BackForwardController::itemAtIndex(int i)
{
return m_client->itemAtIndex(i);
}
bool BackForwardController::isActive()
{
return m_client->isActive();
}
void BackForwardController::close()
{
m_client->close();
}
} // namespace WebCore
......@@ -26,27 +26,49 @@
#ifndef BackForwardController_h
#define BackForwardController_h
#include "BackForwardList.h"
#include <wtf/Noncopyable.h>
#include <wtf/Forward.h>
#include <wtf/RefPtr.h>
namespace WebCore {
class BackForwardList;
class HistoryItem;
class Page;
class BackForwardControllerClient;
class BackForwardController : public Noncopyable {
public:
BackForwardController(Page*, BackForwardControllerClient*);
BackForwardController(Page*, PassRefPtr<BackForwardList>);
~BackForwardController();
BackForwardControllerClient* client() const { return m_client; }
BackForwardList* list() const { return m_list.get(); }
BackForwardList* client() const { return m_client.get(); }
bool canGoBackOrForward(int distance) const;
void goBackOrForward(int distance);
bool goBack();
bool goForward();
void addItem(PassRefPtr<HistoryItem>);
void setCurrentItem(HistoryItem*);
int count() const;
int backCount() const;
int forwardCount() const;
HistoryItem* itemAtIndex(int);
bool isActive();
void close();
HistoryItem* backItem() { return itemAtIndex(-1); }
HistoryItem* currentItem() { return itemAtIndex(0); }
HistoryItem* forwardItem() { return itemAtIndex(1); }
private:
Page* m_page;
BackForwardControllerClient* m_client;
RefPtr<BackForwardList> m_list;
RefPtr<BackForwardList> m_client;
};
} // namespace WebCore
......
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BackForwardControllerClient_h
#define BackForwardControllerClient_h
#include "BackForwardList.h"
#include <wtf/PassRefPtr.h>
namespace WebCore {
class Page;
class BackForwardControllerClient {
public:
virtual void backForwardControllerDestroyed() = 0;
virtual PassRefPtr<BackForwardList> createBackForwardList(Page*) = 0;
protected:
virtual ~BackForwardControllerClient() { }
};
} // namespace WebCore
#endif // BackForwardControllerClient_h
......@@ -28,39 +28,13 @@
#ifndef BackForwardList_h
#define BackForwardList_h
#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
#include <wtf/PassRefPtr.h>
#include <wtf/Vector.h>
namespace WebCore {
class HistoryItem;
// FIXME: Remove this and rely on the typedef in BackForwardListImpl
// instead, after removing the virtual functions at the bottom
// of this class.
typedef Vector<RefPtr<HistoryItem> > HistoryItemVector;
// FIXME: Move this class out of this file and into BackForwardListImpl.
// FIXME: Consider replacing this BackForwardListClient concept with a
// function that creates a BackForwardList object. The functions in
// BackForwardList are now almost identical to this, and there is no
// need for the extra level of indirection.
#if PLATFORM(CHROMIUM)
// In the Chromium port, the back/forward list is managed externally.
// See BackForwardListChromium.cpp
class BackForwardListClient {
public:
virtual ~BackForwardListClient() {}
virtual void addItem(PassRefPtr<HistoryItem>) = 0;
virtual void goToItem(HistoryItem*) = 0;
virtual HistoryItem* itemAtIndex(int) = 0;
virtual int backListCount() = 0;
virtual int forwardListCount() = 0;
virtual void close() = 0;
};
#endif
// FIXME: Rename this class to BackForwardClient, and rename the
// getter in Page accordingly.
class BackForwardList : public RefCounted<BackForwardList> {
......@@ -69,13 +43,6 @@ public:
{
}
// FIXME: Move this function to BackForwardListImpl, or eliminate
// it (see comment at definition of BackForwardListClient class).
#if PLATFORM(CHROMIUM)
// Must be called before any other methods.
virtual void setClient(BackForwardListClient*) = 0;
#endif
virtual void addItem(PassRefPtr<HistoryItem>) = 0;
virtual void goToItem(HistoryItem*) = 0;
......@@ -88,42 +55,21 @@ public:
virtual void close() = 0;
#if ENABLE(WML)
// FIXME: Rename this to just "clear" and change it so it's not
// WML-specific. This is the same operation as clearBackForwardList
// in the layout test controller; it would be reasonable to have it
// here even though HTML DOM interfaces don't require it.
#if ENABLE(WML)
virtual void clearWMLPageHistory() = 0;
#endif
// FIXME: Delete these once all callers are using BackForwardController
// instead of calling this directly.
HistoryItem* backItem() { return itemAtIndex(-1); }
HistoryItem* currentItem() { return itemAtIndex(0); }
HistoryItem* forwardItem() { return itemAtIndex(1); }
// FIXME: Remove these functions once all call sites are calling them
// directly on BackForwardListImpl instead of on BackForwardList.
// There is no need for any of these to be virtual functions and no
// need to implement them in classes other than BackForwardListImpl.
// Also remove the HistoryItemVector typedef in this file once this is done.
virtual void goBack() { }
virtual void goForward() { }
virtual void backListWithLimit(int, HistoryItemVector&) { }
virtual void forwardListWithLimit(int, HistoryItemVector&) { }
virtual int capacity() { return 0; }
virtual void setCapacity(int) { }
virtual bool enabled() { return false; }
virtual void setEnabled(bool) { }
virtual bool containsItem(HistoryItem*) { return false; }
virtual bool closed() { return false; }
virtual void removeItem(HistoryItem*) { }
virtual HistoryItemVector& entries() { HistoryItemVector* bogus = 0; return *bogus; }
protected:
BackForwardList()
{
}
};
} // namespace WebCore
#endif // BackForwardList_h
/*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
* Copyright (C) 2009 Google, Inc. All rights reserved.
*
......@@ -30,6 +30,7 @@
#include "BackForwardList.h"
#include <wtf/HashSet.h>
#include <wtf/Vector.h>
namespace WebCore {
......@@ -38,6 +39,25 @@ class Page;
typedef Vector<RefPtr<HistoryItem> > HistoryItemVector;
typedef HashSet<RefPtr<HistoryItem> > HistoryItemHashSet;
// FIXME: Change Chromium to use its own BackForwardList implementation
// and not use BackForwardListImpl at all, then remove this
// BackForwardListClient feature entirely and just don't use this
// class on Chromium.
#if PLATFORM(CHROMIUM)
// In the Chromium port, the back/forward list is managed externally.
// See BackForwardListChromium.cpp
class BackForwardListClient {
public:
virtual ~BackForwardListClient() { }
virtual void addItem(PassRefPtr<HistoryItem>) = 0;
virtual void goToItem(HistoryItem*) = 0;
virtual HistoryItem* itemAtIndex(int) = 0;
virtual int backListCount() = 0;
virtual int forwardListCount() = 0;
virtual void close() = 0;
};
#endif
// FIXME: After renaming BackForwardList to BackForwardClient,
// rename this to BackForwardList.
class BackForwardListImpl : public BackForwardList {
......@@ -47,7 +67,7 @@ public:
#if PLATFORM(CHROMIUM)
// Must be called before any other methods.
virtual void setClient(BackForwardListClient* client) { m_client = client; }
void setClient(BackForwardListClient* client) { m_client = client; }
#endif
Page* page() { return m_page; }
......
......@@ -27,7 +27,7 @@
#include "PageCache.h"
#include "ApplicationCacheHost.h"
#include "BackForwardList.h"
#include "BackForwardController.h"
#include "Cache.h"
#include "CachedPage.h"
#include "DOMWindow.h"
......@@ -192,7 +192,7 @@ static void logCanCachePageDecision(Page* page)
bool cannotCache = !logCanCacheFrameDecision(page->mainFrame(), 1);
FrameLoadType loadType = page->mainFrame()->loader()->loadType();
if (!page->backForwardList()->isActive()) {
if (!page->backForward()->isActive()) {
PCLOG(" -The back/forward list is disabled or has 0 capacity");
cannotCache = true;
}
......@@ -303,7 +303,7 @@ bool PageCache::canCache(Page* page)
FrameLoadType loadType = page->mainFrame()->loader()->loadType();
return canCachePageContainingThisFrame(page->mainFrame())
&& page->backForwardList()->isActive()
&& page->backForward()->isActive()
&& page->settings()->usesPageCache()
#if ENABLE(DEVICE_ORIENTATION)
&& !(page->deviceMotionController() && page->deviceMotionController()->isActive())
......
......@@ -36,14 +36,14 @@
#include "ApplicationCacheHost.h"
#include "Archive.h"
#include "ArchiveFactory.h"
#include "BackForwardList.h"
#include "BackForwardController.h"
#include "BeforeUnloadEvent.h"
#include "Cache.h"
#include "CachedPage.h"
#include "CachedResourceLoader.h"
#include "Chrome.h"
#include "DOMImplementation.h"
#include "DOMWindow.h"
#include "CachedResourceLoader.h"
#include "Document.h"
#include "DocumentLoadTiming.h"
#include "DocumentLoader.h"
......@@ -63,9 +63,6 @@
#include "FrameView.h"
#include "HTMLAnchorElement.h"
#include "HTMLFormElement.h"
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
#include "HTMLMediaElement.h"
#endif
#include "HTMLNames.h"
#include "HTMLObjectElement.h"
#include "HTTPParsers.h"
......@@ -102,6 +99,10 @@
#include <wtf/text/CString.h>
#include <wtf/text/StringConcatenate.h>
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
#include "HTMLMediaElement.h"
#endif
#if ENABLE(SHARED_WORKERS)
#include "SharedWorkerRepository.h"
#endif
......@@ -1952,30 +1953,28 @@ void FrameLoader::transitionToCommitted(PassRefPtr<CachedPage> cachedPage)
case FrameLoadTypeBack:
case FrameLoadTypeBackWMLDeckNotAccessible:
case FrameLoadTypeIndexedBackForward:
if (Page* page = m_frame->page()) {
if (page->backForwardList()) {
// If the first load within a frame is a navigation within a back/forward list that was attached
// without any of the items being loaded then we need to update the history in a similar manner as
// for a standard load with the exception of updating the back/forward list (<rdar://problem/8091103>).
if (!m_stateMachine.committedFirstRealDocumentLoad())
history()->updateForStandardLoad(HistoryController::UpdateAllExceptBackForwardList);
history()->updateForBackForwardNavigation();
// For cached pages, CachedFrame::restore will take care of firing the popstate event with the history item's state object
if (history()->currentItem() && !cachedPage)
m_pendingStateObject = history()->currentItem()->stateObject();
// Create a document view for this document, or used the cached view.
if (cachedPage) {
DocumentLoader* cachedDocumentLoader = cachedPage->documentLoader();
ASSERT(cachedDocumentLoader);
cachedDocumentLoader->setFrame(m_frame);
m_client->transitionToCommittedFromCachedFrame(cachedPage->cachedMainFrame());
} else
m_client->transitionToCommittedForNewPage();
}
if (m_frame->page()) {
// If the first load within a frame is a navigation within a back/forward list that was attached
// without any of the items being loaded then we need to update the history in a similar manner as
// for a standard load with the exception of updating the back/forward list (<rdar://problem/8091103>).
if (!m_stateMachine.committedFirstRealDocumentLoad())
history()->updateForStandardLoad(HistoryController::UpdateAllExceptBackForwardList);
history()->updateForBackForwardNavigation();
// For cached pages, CachedFrame::restore will take care of firing the popstate event with the history item's state object
if (history()->currentItem() && !cachedPage)
m_pendingStateObject = history()->currentItem()->stateObject();
// Create a document view for this document, or used the cached view.
if (cachedPage) {
DocumentLoader* cachedDocumentLoader = cachedPage->documentLoader();
ASSERT(cachedDocumentLoader);
cachedDocumentLoader->setFrame(m_frame);
m_client->transitionToCommittedFromCachedFrame(cachedPage->cachedMainFrame());
} else