summaryrefslogtreecommitdiffstats
path: root/WebCore/loader/HistoryController.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/loader/HistoryController.cpp')
-rw-r--r--WebCore/loader/HistoryController.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/WebCore/loader/HistoryController.cpp b/WebCore/loader/HistoryController.cpp
index 144faa5..32a6a91 100644
--- a/WebCore/loader/HistoryController.cpp
+++ b/WebCore/loader/HistoryController.cpp
@@ -558,9 +558,10 @@ void HistoryController::recursiveGoToItem(HistoryItem* item, HistoryItem* fromIt
// to match.
// Note: If item and fromItem are the same, then we need to create a new
// document.
- if (item != fromItem && item->itemSequenceNumber() == fromItem->itemSequenceNumber()
- && ((m_frame->tree()->name().isEmpty() && item->target().isEmpty()) || m_frame->tree()->name() == item->target())
- && childFramesMatchItem(item))
+ if (item != fromItem
+ && item->itemSequenceNumber() == fromItem->itemSequenceNumber()
+ && currentFramesMatchItem(item)
+ && fromItem->hasSameFrames(item))
{
// This content is good, so leave it alone and look for children that need reloading
// Save form state (works from currentItem, since prevItem is nil)
@@ -585,7 +586,7 @@ void HistoryController::recursiveGoToItem(HistoryItem* item, HistoryItem* fromIt
for (int i = 0; i < size; ++i) {
String childFrameName = childItems[i]->target();
HistoryItem* fromChildItem = fromItem->childItemWithTarget(childFrameName);
- ASSERT(fromChildItem || fromItem->isTargetItem());
+ ASSERT(fromChildItem);
Frame* childFrame = m_frame->tree()->child(childFrameName);
ASSERT(childFrame);
childFrame->loader()->history()->recursiveGoToItem(childItems[i].get(), fromChildItem, type);
@@ -595,10 +596,12 @@ void HistoryController::recursiveGoToItem(HistoryItem* item, HistoryItem* fromIt
}
}
-// helper method that determines whether the subframes described by the item's subitems
-// match our own current frameset
-bool HistoryController::childFramesMatchItem(HistoryItem* item) const
+// Helper method that determines whether the current frame tree matches given history item's.
+bool HistoryController::currentFramesMatchItem(HistoryItem* item) const
{
+ if ((!m_frame->tree()->name().isEmpty() || !item->target().isEmpty()) && m_frame->tree()->name() != item->target())
+ return false;
+
const HistoryItemVector& childItems = item->children();
if (childItems.size() != m_frame->tree()->childCount())
return false;
@@ -609,7 +612,6 @@ bool HistoryController::childFramesMatchItem(HistoryItem* item) const
return false;
}
- // Found matches for all item targets
return true;
}
@@ -655,12 +657,6 @@ void HistoryController::pushState(PassRefPtr<SerializedScriptValue> stateObject,
m_currentItem->setStateObject(stateObject);
m_currentItem->setURLString(urlString);
- // Create a null state object for the previous HistoryItem so that we will
- // generate a popstate event when navigating back to it.
- // FIXME: http://webkit.org/b/41372 implies that we shouldn't need this.
- if (!m_previousItem->stateObject())
- m_previousItem->setStateObject(SerializedScriptValue::create());
-
page->backForwardList()->addItem(topItem.release());
}