summaryrefslogtreecommitdiffstats
path: root/WebCore/history
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-12-15 10:12:09 +0000
committerSteve Block <steveblock@google.com>2009-12-17 17:41:10 +0000
commit643ca7872b450ea4efacab6188849e5aac2ba161 (patch)
tree6982576c228bcd1a7efe98afed544d840751094c /WebCore/history
parentd026980fde6eb3b01c1fe49441174e89cd1be298 (diff)
downloadexternal_webkit-643ca7872b450ea4efacab6188849e5aac2ba161.zip
external_webkit-643ca7872b450ea4efacab6188849e5aac2ba161.tar.gz
external_webkit-643ca7872b450ea4efacab6188849e5aac2ba161.tar.bz2
Merge webkit.org at r51976 : Initial merge by git.
Change-Id: Ib0e7e2f0fb4bee5a186610272edf3186f0986b43
Diffstat (limited to 'WebCore/history')
-rw-r--r--WebCore/history/BackForwardList.cpp38
-rw-r--r--WebCore/history/BackForwardList.h7
-rw-r--r--WebCore/history/BackForwardListChromium.cpp5
-rw-r--r--WebCore/history/CachedFrame.cpp3
-rw-r--r--WebCore/history/HistoryItem.cpp37
-rw-r--r--WebCore/history/HistoryItem.h13
-rw-r--r--WebCore/history/android/AndroidWebHistoryBridge.h11
7 files changed, 107 insertions, 7 deletions
diff --git a/WebCore/history/BackForwardList.cpp b/WebCore/history/BackForwardList.cpp
index 0aad98b..3550e37 100644
--- a/WebCore/history/BackForwardList.cpp
+++ b/WebCore/history/BackForwardList.cpp
@@ -34,6 +34,7 @@
#include "Logging.h"
#include "Page.h"
#include "PageCache.h"
+#include "SerializedScriptValue.h"
using namespace std;
@@ -58,12 +59,17 @@ BackForwardList::~BackForwardList()
void BackForwardList::addItem(PassRefPtr<HistoryItem> prpItem)
{
+ insertItemAfterCurrent(prpItem, true);
+}
+
+void BackForwardList::insertItemAfterCurrent(PassRefPtr<HistoryItem> prpItem, bool removeForwardList)
+{
ASSERT(prpItem);
if (m_capacity == 0 || !m_enabled)
return;
// Toss anything in the forward list
- if (m_current != NoCurrentItemIndex) {
+ if (removeForwardList && m_current != NoCurrentItemIndex) {
unsigned targetSize = m_current + 1;
while (m_entries.size() > targetSize) {
RefPtr<HistoryItem> item = m_entries.last();
@@ -84,8 +90,8 @@ void BackForwardList::addItem(PassRefPtr<HistoryItem> prpItem)
m_page->mainFrame()->loader()->client()->dispatchDidRemoveBackForwardItem(item.get());
}
- m_entries.append(prpItem);
- m_entryHash.add(m_entries.last());
+ m_entryHash.add(prpItem.get());
+ m_entries.insert(m_current + 1, prpItem);
m_current++;
m_page->mainFrame()->loader()->client()->dispatchDidAddBackForwardItem(currentItem());
}
@@ -235,6 +241,30 @@ HistoryItemVector& BackForwardList::entries()
return m_entries;
}
+void BackForwardList::pushStateItem(PassRefPtr<HistoryItem> newItem)
+{
+ ASSERT(newItem);
+ ASSERT(newItem->document());
+ ASSERT(newItem->stateObject());
+
+ RefPtr<HistoryItem> current = currentItem();
+ ASSERT(current);
+
+ Document* newItemDocument = newItem->document();
+ while (HistoryItem* item = forwardItem()) {
+ if (item->document() != newItemDocument)
+ break;
+ removeItem(item);
+ }
+
+ insertItemAfterCurrent(newItem, false);
+
+ if (!current->document()) {
+ current->setDocument(newItemDocument);
+ current->setStateObject(SerializedScriptValue::create());
+ }
+}
+
void BackForwardList::close()
{
int size = m_entries.size();
@@ -267,7 +297,7 @@ void BackForwardList::removeItem(HistoryItem* item)
else {
size_t count = m_entries.size();
if (m_current >= count)
- m_current = count ? count-1 : NoCurrentItemIndex;
+ m_current = count ? count - 1 : NoCurrentItemIndex;
}
break;
}
diff --git a/WebCore/history/BackForwardList.h b/WebCore/history/BackForwardList.h
index fdc3360..88398a5 100644
--- a/WebCore/history/BackForwardList.h
+++ b/WebCore/history/BackForwardList.h
@@ -35,8 +35,11 @@
namespace WebCore {
+class Document;
class HistoryItem;
class Page;
+class SerializedScriptValue;
+class String;
typedef Vector<RefPtr<HistoryItem> > HistoryItemVector;
typedef HashSet<RefPtr<HistoryItem> > HistoryItemHashSet;
@@ -96,12 +99,16 @@ public:
void removeItem(HistoryItem*);
HistoryItemVector& entries();
+ void pushStateItem(PassRefPtr<HistoryItem>);
+
#if ENABLE(WML)
void clearWMLPageHistory();
#endif
private:
BackForwardList(Page*);
+
+ void insertItemAfterCurrent(PassRefPtr<HistoryItem>, bool removeForwardList);
Page* m_page;
#if PLATFORM(CHROMIUM)
diff --git a/WebCore/history/BackForwardListChromium.cpp b/WebCore/history/BackForwardListChromium.cpp
index 34f294c..f539e80 100644
--- a/WebCore/history/BackForwardListChromium.cpp
+++ b/WebCore/history/BackForwardListChromium.cpp
@@ -121,6 +121,11 @@ HistoryItem* BackForwardList::itemAtIndex(int index)
return m_client->itemAtIndex(index);
}
+void BackForwardList::pushStateItem(PassRefPtr<HistoryItem> newItem)
+{
+ // FIXME: Need to implement state support for chromium.
+}
+
HistoryItemVector& BackForwardList::entries()
{
static HistoryItemVector noEntries;
diff --git a/WebCore/history/CachedFrame.cpp b/WebCore/history/CachedFrame.cpp
index a868134..227c437 100644
--- a/WebCore/history/CachedFrame.cpp
+++ b/WebCore/history/CachedFrame.cpp
@@ -99,10 +99,13 @@ void CachedFrameBase::restore()
for (unsigned i = 0; i < m_childFrames.size(); ++i)
m_childFrames[i]->open();
+<<<<<<< HEAD:WebCore/history/CachedFrame.cpp
#ifdef ANDROID_PAGE_CACHE_UNLOAD
// matches pageshowEvent as in Document::implicitClose()
m_document->dispatchWindowLoadEvent();
#endif
+=======
+>>>>>>> webkit.org at r51976:WebCore/history/CachedFrame.cpp
m_document->dispatchWindowEvent(PageTransitionEvent::create(eventNames().pageshowEvent, true), m_document);
}
diff --git a/WebCore/history/HistoryItem.cpp b/WebCore/history/HistoryItem.cpp
index ba0764c..f6fbd59 100644
--- a/WebCore/history/HistoryItem.cpp
+++ b/WebCore/history/HistoryItem.cpp
@@ -48,6 +48,7 @@ HistoryItem::HistoryItem()
, m_lastVisitWasFailure(false)
, m_isTargetItem(false)
, m_visitCount(0)
+ , m_document(0)
{
}
@@ -60,6 +61,7 @@ HistoryItem::HistoryItem(const String& urlString, const String& title, double ti
, m_lastVisitWasFailure(false)
, m_isTargetItem(false)
, m_visitCount(0)
+ , m_document(0)
{
iconDatabase()->retainIconForPageURL(m_urlString);
}
@@ -74,6 +76,7 @@ HistoryItem::HistoryItem(const String& urlString, const String& title, const Str
, m_lastVisitWasFailure(false)
, m_isTargetItem(false)
, m_visitCount(0)
+ , m_document(0)
{
iconDatabase()->retainIconForPageURL(m_urlString);
}
@@ -89,6 +92,7 @@ HistoryItem::HistoryItem(const KURL& url, const String& target, const String& pa
, m_lastVisitWasFailure(false)
, m_isTargetItem(false)
, m_visitCount(0)
+ , m_document(0)
{
iconDatabase()->retainIconForPageURL(m_urlString);
}
@@ -96,6 +100,7 @@ HistoryItem::HistoryItem(const KURL& url, const String& target, const String& pa
HistoryItem::~HistoryItem()
{
ASSERT(!m_cachedPage);
+ ASSERT(!m_document);
iconDatabase()->releaseIconForPageURL(m_urlString);
#if PLATFORM(ANDROID)
if (m_bridge)
@@ -120,10 +125,9 @@ inline HistoryItem::HistoryItem(const HistoryItem& item)
, m_visitCount(item.m_visitCount)
, m_dailyVisitCounts(item.m_dailyVisitCounts)
, m_weeklyVisitCounts(item.m_weeklyVisitCounts)
+ , m_document(0)
, m_formContentType(item.m_formContentType)
{
- ASSERT(!item.m_cachedPage);
-
if (item.m_formData)
m_formData = item.m_formData->copy();
@@ -389,6 +393,35 @@ void HistoryItem::setIsTargetItem(bool flag)
#if PLATFORM(ANDROID)
notifyHistoryItemChanged(this);
#endif
+<<<<<<< HEAD:WebCore/history/HistoryItem.cpp
+=======
+}
+
+void HistoryItem::setStateObject(PassRefPtr<SerializedScriptValue> object)
+{
+ ASSERT(m_document);
+ m_stateObject = object;
+}
+
+void HistoryItem::setDocument(Document* document)
+{
+ if (m_document == document)
+ return;
+
+ if (m_document)
+ m_document->unregisterHistoryItem(this);
+ if (document)
+ document->registerHistoryItem(this);
+
+ m_document = document;
+}
+
+void HistoryItem::documentDetached(Document* document)
+{
+ ASSERT_UNUSED(document, m_document == document);
+ m_document = 0;
+ m_stateObject = 0;
+>>>>>>> webkit.org at r51976:WebCore/history/HistoryItem.cpp
}
void HistoryItem::addChildItem(PassRefPtr<HistoryItem> child)
diff --git a/WebCore/history/HistoryItem.h b/WebCore/history/HistoryItem.h
index e0cade0..4c91e76 100644
--- a/WebCore/history/HistoryItem.h
+++ b/WebCore/history/HistoryItem.h
@@ -28,6 +28,7 @@
#include "IntPoint.h"
#include "PlatformString.h"
+#include "SerializedScriptValue.h"
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
@@ -54,7 +55,7 @@ class FormData;
class HistoryItem;
class Image;
class KURL;
-struct ResourceRequest;
+class ResourceRequest;
typedef Vector<RefPtr<HistoryItem> > HistoryItemVector;
@@ -132,6 +133,12 @@ public:
void setTitle(const String&);
void setIsTargetItem(bool);
+ void setStateObject(PassRefPtr<SerializedScriptValue> object);
+ SerializedScriptValue* stateObject() const { return m_stateObject.get(); }
+ void setDocument(Document* document);
+ Document* document() const { return m_document; }
+ void documentDetached(Document*);
+
void setFormInfoFromRequest(const ResourceRequest&);
void setFormData(PassRefPtr<FormData>);
void setFormContentType(const String&);
@@ -235,6 +242,10 @@ private:
OwnPtr<Vector<String> > m_redirectURLs;
+ // Support for HTML5 History
+ RefPtr<SerializedScriptValue> m_stateObject;
+ Document* m_document;
+
// info used to repost form data
RefPtr<FormData> m_formData;
String m_formContentType;
diff --git a/WebCore/history/android/AndroidWebHistoryBridge.h b/WebCore/history/android/AndroidWebHistoryBridge.h
index b401933..c6d5147 100644
--- a/WebCore/history/android/AndroidWebHistoryBridge.h
+++ b/WebCore/history/android/AndroidWebHistoryBridge.h
@@ -34,11 +34,19 @@ class HistoryItem;
class AndroidWebHistoryBridge : public RefCounted<AndroidWebHistoryBridge> {
public:
+<<<<<<< HEAD:WebCore/history/android/AndroidWebHistoryBridge.h
AndroidWebHistoryBridge(HistoryItem* item)
+=======
+ AndroidWebHistoryBridge()
+>>>>>>> webkit.org at r51976:WebCore/history/android/AndroidWebHistoryBridge.h
: m_scale(100)
, m_screenWidthScale(100)
, m_active(false)
+<<<<<<< HEAD:WebCore/history/android/AndroidWebHistoryBridge.h
, m_historyItem(item) { }
+=======
+ , m_historyItem(0) { }
+>>>>>>> webkit.org at r51976:WebCore/history/android/AndroidWebHistoryBridge.h
virtual ~AndroidWebHistoryBridge() { }
virtual void updateHistoryItem(HistoryItem* item) = 0;
@@ -46,7 +54,10 @@ public:
void setScreenWidthScale(int s) { m_screenWidthScale = s; }
int scale() const { return m_scale; }
int screenWidthScale() const { return m_screenWidthScale; }
+<<<<<<< HEAD:WebCore/history/android/AndroidWebHistoryBridge.h
void detachHistoryItem() { m_historyItem = 0; }
+=======
+>>>>>>> webkit.org at r51976:WebCore/history/android/AndroidWebHistoryBridge.h
HistoryItem* historyItem() const { return m_historyItem; }
void setActive() { m_active = true; }