Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: WebCore/history/HistoryItem.cpp

Issue 3573012: Merge 68742... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/517/
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « WebCore/history/HistoryItem.h ('k') | WebCore/loader/FrameLoader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: WebCore/history/HistoryItem.cpp
===================================================================
--- WebCore/history/HistoryItem.cpp (revision 69221)
+++ WebCore/history/HistoryItem.cpp (working copy)
@@ -490,9 +490,26 @@
m_children.clear();
}
+// We do same-document navigation if going to a different item and if either of the following is true:
+// - The other item corresponds to the same document (for history entries created via pushState or fragment changes).
+// - The other item corresponds to the same set of documents, including frames (for history entries created via regular navigation)
+bool HistoryItem::shouldDoSameDocumentNavigationTo(HistoryItem* otherItem) const
+{
+ if (this == otherItem)
+ return false;
+
+ if (stateObject() || otherItem->stateObject())
+ return documentSequenceNumber() == otherItem->documentSequenceNumber();
+
+ if ((url().hasFragmentIdentifier() || otherItem->url().hasFragmentIdentifier()) && equalIgnoringFragmentIdentifier(url(), otherItem->url()))
+ return documentSequenceNumber() == otherItem->documentSequenceNumber();
+
+ return hasSameDocumentTree(otherItem);
+}
+
// Does a recursive check that this item and its descendants have the same
// document sequence numbers as the other item.
-bool HistoryItem::hasSameDocuments(HistoryItem* otherItem)
+bool HistoryItem::hasSameDocumentTree(HistoryItem* otherItem) const
{
if (documentSequenceNumber() != otherItem->documentSequenceNumber())
return false;
@@ -503,7 +520,7 @@
for (size_t i = 0; i < children().size(); i++) {
HistoryItem* child = children()[i].get();
HistoryItem* otherChild = otherItem->childItemWithDocumentSequenceNumber(child->documentSequenceNumber());
- if (!otherChild || !child->hasSameDocuments(otherChild))
+ if (!otherChild || !child->hasSameDocumentTree(otherChild))
return false;
}
@@ -512,7 +529,7 @@
// Does a non-recursive check that this item and its immediate children have the
// same frames as the other item.
-bool HistoryItem::hasSameFrames(HistoryItem* otherItem)
+bool HistoryItem::hasSameFrames(HistoryItem* otherItem) const
{
if (target() != otherItem->target())
return false;
« no previous file with comments | « WebCore/history/HistoryItem.h ('k') | WebCore/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698