From ed3dcbaa89ede50bb054f63aa1847ae6240fa70d Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Thu, 26 Nov 2009 14:49:53 +0000 Subject: Android History unforking pt2: BackForwardList changes. Fire a notification to the FrameLoaderClient that the BackForwardList has been modified. This needs to be upstreamed to webkit.org. Change-Id: I14633c51276bd92ed56139b4c473cc8ac9bacb72 --- WebCore/history/BackForwardList.cpp | 45 +++++----------------- WebCore/loader/EmptyClients.h | 8 ++-- WebCore/loader/FrameLoaderClient.h | 12 ++---- WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp | 12 ++++++ WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h | 3 ++ .../WebCoreSupport/FrameLoaderClientHaiku.cpp | 12 ++++++ .../haiku/WebCoreSupport/FrameLoaderClientHaiku.h | 3 ++ WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h | 3 ++ WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm | 12 ++++++ WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp | 12 ++++++ WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h | 4 +- WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp | 12 ++++++ WebKit/win/WebCoreSupport/WebFrameLoaderClient.h | 3 ++ WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp | 12 ++++++ WebKit/wx/WebKitSupport/FrameLoaderClientWx.h | 3 ++ 15 files changed, 105 insertions(+), 51 deletions(-) diff --git a/WebCore/history/BackForwardList.cpp b/WebCore/history/BackForwardList.cpp index 99827e3..0aad98b 100644 --- a/WebCore/history/BackForwardList.cpp +++ b/WebCore/history/BackForwardList.cpp @@ -27,15 +27,13 @@ #include "config.h" #include "BackForwardList.h" -#include "HistoryItem.h" -#include "Logging.h" -#include "PageCache.h" -#ifdef ANDROID_HISTORY_CLIENT #include "Frame.h" #include "FrameLoader.h" #include "FrameLoaderClient.h" +#include "HistoryItem.h" +#include "Logging.h" #include "Page.h" -#endif +#include "PageCache.h" using namespace std; @@ -83,45 +81,31 @@ void BackForwardList::addItem(PassRefPtr prpItem) m_entryHash.remove(item); pageCache()->remove(item.get()); m_current--; -#ifdef ANDROID_HISTORY_CLIENT - m_page->mainFrame()->loader()->client()->dispatchDidRemoveHistoryItem(item.get(), 0); -#endif + m_page->mainFrame()->loader()->client()->dispatchDidRemoveBackForwardItem(item.get()); } m_entries.append(prpItem); m_entryHash.add(m_entries.last()); m_current++; -#ifdef ANDROID_HISTORY_CLIENT - m_page->mainFrame()->loader()->client()->dispatchDidAddHistoryItem(currentItem()); -#endif + m_page->mainFrame()->loader()->client()->dispatchDidAddBackForwardItem(currentItem()); } void BackForwardList::goBack() { ASSERT(m_current > 0); -#ifdef ANDROID_HISTORY_CLIENT if (m_current > 0) { m_current--; - m_page->mainFrame()->loader()->client()->dispatchDidChangeHistoryIndex(this); + m_page->mainFrame()->loader()->client()->dispatchDidChangeBackForwardIndex(); } -#else - if (m_current > 0) - m_current--; -#endif } void BackForwardList::goForward() { ASSERT(m_current < m_entries.size() - 1); -#ifdef ANDROID_HISTORY_CLIENT if (m_current < m_entries.size() - 1) { m_current++; - m_page->mainFrame()->loader()->client()->dispatchDidChangeHistoryIndex(this); + m_page->mainFrame()->loader()->client()->dispatchDidChangeBackForwardIndex(); } -#else - if (m_current < m_entries.size() - 1) - m_current++; -#endif } void BackForwardList::goToItem(HistoryItem* item) @@ -133,15 +117,10 @@ void BackForwardList::goToItem(HistoryItem* item) for (; index < m_entries.size(); ++index) if (m_entries[index] == item) break; -#ifdef ANDROID_HISTORY_CLIENT if (index < m_entries.size()) { m_current = index; - m_page->mainFrame()->loader()->client()->dispatchDidChangeHistoryIndex(this); + m_page->mainFrame()->loader()->client()->dispatchDidChangeBackForwardIndex(); } -#else - if (index < m_entries.size()) - m_current = index; -#endif } HistoryItem* BackForwardList::backItem() @@ -207,16 +186,10 @@ void BackForwardList::setCapacity(int size) if (!size) m_current = NoCurrentItemIndex; -#ifdef ANDROID_HISTORY_CLIENT else if (m_current > m_entries.size() - 1) { m_current = m_entries.size() - 1; - m_page->mainFrame()->loader()->client()->dispatchDidChangeHistoryIndex(this); + m_page->mainFrame()->loader()->client()->dispatchDidChangeBackForwardIndex(); } -#else - else if (m_current > m_entries.size() - 1) - m_current = m_entries.size() - 1; -#endif - m_capacity = size; } diff --git a/WebCore/loader/EmptyClients.h b/WebCore/loader/EmptyClients.h index b4952b1..5fcd4cd 100644 --- a/WebCore/loader/EmptyClients.h +++ b/WebCore/loader/EmptyClients.h @@ -283,11 +283,9 @@ public: virtual void updateGlobalHistory() { } virtual void updateGlobalHistoryRedirectLinks() { } virtual bool shouldGoToHistoryItem(HistoryItem*) const { return false; } -#ifdef ANDROID_HISTORY_CLIENT - virtual void dispatchDidAddHistoryItem(HistoryItem*) const {} - virtual void dispatchDidRemoveHistoryItem(HistoryItem*, int) const {} - virtual void dispatchDidChangeHistoryIndex(BackForwardList*) const {} -#endif + virtual void dispatchDidAddBackForwardItem(HistoryItem*) const { } + virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const { } + virtual void dispatchDidChangeBackForwardIndex() const { } virtual void saveViewStateToItem(HistoryItem*) { } virtual bool canCachePage() const { return false; } virtual void didDisplayInsecureContent() { } diff --git a/WebCore/loader/FrameLoaderClient.h b/WebCore/loader/FrameLoaderClient.h index a20bd43..7d988f1 100644 --- a/WebCore/loader/FrameLoaderClient.h +++ b/WebCore/loader/FrameLoaderClient.h @@ -73,10 +73,6 @@ namespace WebCore { class String; class Widget; -#ifdef ANDROID_HISTORY_CLIENT - class BackForwardList; -#endif - typedef void (PolicyChecker::*FramePolicyFunction)(PolicyAction); class FrameLoaderClient { @@ -169,11 +165,9 @@ namespace WebCore { virtual void updateGlobalHistoryRedirectLinks() = 0; virtual bool shouldGoToHistoryItem(HistoryItem*) const = 0; -#ifdef ANDROID_HISTORY_CLIENT - virtual void dispatchDidAddHistoryItem(HistoryItem*) const = 0; - virtual void dispatchDidRemoveHistoryItem(HistoryItem*, int) const = 0; - virtual void dispatchDidChangeHistoryIndex(BackForwardList*) const = 0; -#endif + virtual void dispatchDidAddBackForwardItem(HistoryItem*) const = 0; + virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const = 0; + virtual void dispatchDidChangeBackForwardIndex() const = 0; // This frame has displayed inactive content (such as an image) from an // insecure source. Inactive content cannot spread to other frames. diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp index d53df88..7286625 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp @@ -577,6 +577,18 @@ bool FrameLoaderClient::shouldGoToHistoryItem(HistoryItem* item) const return item != 0; } +void FrameLoaderClient::dispatchDidAddBackForwardItem(HistoryItem*) const +{ +} + +void FrameLoaderClient::dispatchDidRemoveBackForwardItem(HistoryItem*) const +{ +} + +void FrameLoaderClient::dispatchDidChangeBackForwardIndex() const +{ +} + void FrameLoaderClient::didDisplayInsecureContent() { notImplemented(); diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h index c820135..997ea64 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h @@ -135,6 +135,9 @@ namespace WebKit { virtual void updateGlobalHistory(); virtual void updateGlobalHistoryRedirectLinks(); virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const; + virtual void dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const; + virtual void dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const; + virtual void dispatchDidChangeBackForwardIndex() const; virtual void didDisplayInsecureContent(); virtual void didRunInsecureContent(WebCore::SecurityOrigin*); diff --git a/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp b/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp index a8ba16f..9ade67b 100644 --- a/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp +++ b/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp @@ -461,6 +461,18 @@ bool FrameLoaderClientHaiku::shouldGoToHistoryItem(WebCore::HistoryItem*) const return true; } +void FrameLoaderClientHaiku::dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const +{ +} + +void FrameLoaderClientHaiku::dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const +{ +} + +void FrameLoaderClientHaiku::dispatchDidChangeBackForwardIndex() const +{ +} + void FrameLoaderClientHaiku::saveScrollPositionAndViewStateToItem(WebCore::HistoryItem*) { notImplemented(); diff --git a/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.h b/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.h index 33af321..d91320c 100644 --- a/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.h +++ b/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.h @@ -150,6 +150,9 @@ namespace WebCore { virtual void updateGlobalHistory(); virtual void updateGlobalHistoryRedirectLinks(); virtual bool shouldGoToHistoryItem(HistoryItem*) const; + virtual void dispatchDidAddBackForwardItem(HistoryItem*) const; + virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const; + virtual void dispatchDidChangeBackForwardIndex() const; virtual void saveScrollPositionAndViewStateToItem(HistoryItem*); virtual bool canCachePage() const; diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h index 6d365dd..cf6eb0b 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h @@ -143,6 +143,9 @@ private: virtual void updateGlobalHistoryRedirectLinks(); virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const; + virtual void dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const; + virtual void dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const; + virtual void dispatchDidChangeBackForwardIndex() const; virtual void didDisplayInsecureContent(); virtual void didRunInsecureContent(WebCore::SecurityOrigin*); diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index bc6c8f4..efd1f68 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -875,6 +875,18 @@ bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem* item) const return [[view _policyDelegateForwarder] webView:view shouldGoToHistoryItem:webItem]; } +void WebFrameLoaderClient::dispatchDidAddBackForwardItem(HistoryItem*) const +{ +} + +void WebFrameLoaderClient::dispatchDidRemoveBackForwardItem(HistoryItem*) const +{ +} + +void WebFrameLoaderClient::dispatchDidChangeBackForwardIndex() const +{ +} + void WebFrameLoaderClient::didDisplayInsecureContent() { WebView *webView = getWebView(m_webFrame.get()); diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 81ccbe8..8749ada 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -642,6 +642,18 @@ bool FrameLoaderClientQt::shouldGoToHistoryItem(WebCore::HistoryItem *) const return true; } +void FrameLoaderClientQt::dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const +{ +} + +void FrameLoaderClientQt::dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const +{ +} + +void FrameLoaderClientQt::dispatchDidChangeBackForwardIndex() const +{ +} + void FrameLoaderClientQt::didDisplayInsecureContent() { notImplemented(); diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index 66c4252..fe7590d 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -148,7 +148,9 @@ namespace WebCore { virtual void updateGlobalHistory(); virtual void updateGlobalHistoryRedirectLinks(); virtual bool shouldGoToHistoryItem(HistoryItem*) const; - + virtual void dispatchDidAddBackForwardItem(HistoryItem*) const; + virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const; + virtual void dispatchDidChangeBackForwardIndex() const; virtual void didDisplayInsecureContent(); virtual void didRunInsecureContent(SecurityOrigin*); diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp index 2a3bf3c..cb3aed0 100644 --- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp @@ -567,6 +567,18 @@ bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem*) const return true; } +void WebFrameLoaderClient::dispatchDidAddBackForwardItem(HistoryItem*) const +{ +} + +void WebFrameLoaderClient::dispatchDidRemoveBackForwardItem(HistoryItem*) const +{ +} + +void WebFrameLoaderClient::dispatchDidChangeBackForwardIndex() const +{ +} + void WebFrameLoaderClient::didDisplayInsecureContent() { WebView* webView = m_webFrame->webView(); diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h index 921ae91..21599bc 100644 --- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h +++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h @@ -91,6 +91,9 @@ public: virtual void updateGlobalHistory(); virtual void updateGlobalHistoryRedirectLinks(); virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const; + virtual void dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const; + virtual void dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const; + virtual void dispatchDidChangeBackForwardIndex() const; virtual void didDisplayInsecureContent(); virtual void didRunInsecureContent(WebCore::SecurityOrigin*); diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp index 9d12ca7..568cf42 100644 --- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp @@ -538,6 +538,18 @@ bool FrameLoaderClientWx::shouldGoToHistoryItem(WebCore::HistoryItem*) const return true; } +void FrameLoaderClientWx::dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const +{ +} + +void FrameLoaderClientWx::dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const +{ +} + +void FrameLoaderClientWx::dispatchDidChangeBackForwardIndex() const +{ +} + void FrameLoaderClientWx::didDisplayInsecureContent() { notImplemented(); diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h index bfa162f..ed11974 100644 --- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h @@ -147,6 +147,9 @@ namespace WebCore { virtual void updateGlobalHistory(); virtual void updateGlobalHistoryRedirectLinks(); virtual bool shouldGoToHistoryItem(HistoryItem*) const; + virtual void dispatchDidAddBackForwardItem(HistoryItem*) const; + virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const; + virtual void dispatchDidChangeBackForwardIndex() const; virtual void saveScrollPositionAndViewStateToItem(HistoryItem*); virtual bool canCachePage() const; -- cgit v1.1