Changeset 127221 in webkit
- Timestamp:
- Aug 30, 2012, 6:14:53 PM (14 years ago)
- Location:
- branches/chromium/1229
- Files:
-
- 3 edited
- 3 copied
-
LayoutTests/fast/loader/form-state-restore-with-frames-expected.txt (copied) (copied from trunk/LayoutTests/fast/loader/form-state-restore-with-frames-expected.txt )
-
LayoutTests/fast/loader/form-state-restore-with-frames.html (copied) (copied from trunk/LayoutTests/fast/loader/form-state-restore-with-frames.html )
-
LayoutTests/fast/loader/resources/form-state-restore-with-frames-1.html (copied) (copied from trunk/LayoutTests/fast/loader/resources/form-state-restore-with-frames-1.html )
-
Source/WebCore/history/HistoryItem.cpp (modified) (1 diff)
-
Source/WebCore/history/HistoryItem.h (modified) (1 diff)
-
Source/WebCore/loader/HistoryController.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/chromium/1229/Source/WebCore/history/HistoryItem.cpp
r116617 r127221 533 533 } 534 534 535 bool HistoryItem::isAncestorOf(const HistoryItem* item) const 536 { 537 for (size_t i = 0; i < m_children.size(); ++i) { 538 HistoryItem* child = m_children[i].get(); 539 if (child == item) 540 return true; 541 if (child->isAncestorOf(item)) 542 return true; 543 } 544 return false; 545 } 546 535 547 // We do same-document navigation if going to a different item and if either of the following is true: 536 548 // - The other item corresponds to the same document (for history entries created via pushState or fragment changes). -
branches/chromium/1229/Source/WebCore/history/HistoryItem.h
r123438 r127221 172 172 bool hasChildren() const; 173 173 void clearChildren(); 174 bool isAncestorOf(const HistoryItem*) const; 174 175 175 176 bool shouldDoSameDocumentNavigationTo(HistoryItem* otherItem) const; -
branches/chromium/1229/Source/WebCore/loader/HistoryController.cpp
r123823 r127221 164 164 ASSERT(document); 165 165 166 if (item->isCurrentDocument(document) ) {166 if (item->isCurrentDocument(document) && document->attached()) { 167 167 LOG(Loading, "WebCoreLoading %s: saving form state to %p", m_frame->tree()->uniqueName().string().utf8().data(), item); 168 168 item->setDocumentState(document->formElementsState()); … … 178 178 frame->loader()->history()->saveScrollPositionAndViewStateToItem(frame->loader()->history()->currentItem()); 179 179 } 180 } 181 182 static inline bool isAssociatedToRequestedHistoryItem(const HistoryItem* current, Frame* frame, const HistoryItem* requested) 183 { 184 if (requested == current) 185 return true; 186 if (requested) 187 return false; 188 while ((frame = frame->tree()->parent())) { 189 requested = frame->loader()->requestedHistoryItem(); 190 if (!requested) 191 continue; 192 if (requested->isAncestorOf(current)) 193 return true; 194 } 195 return false; 180 196 } 181 197 … … 202 218 if (!itemToRestore) 203 219 return; 204 if ( m_frame->loader()->requestedHistoryItem() == m_currentItem.get() && !m_frame->loader()->documentLoader()->isClientRedirect()) {220 if (isAssociatedToRequestedHistoryItem(itemToRestore, m_frame, m_frame->loader()->requestedHistoryItem()) && !m_frame->loader()->documentLoader()->isClientRedirect()) { 205 221 LOG(Loading, "WebCoreLoading %s: restoring form state from %p", m_frame->tree()->uniqueName().string().utf8().data(), itemToRestore); 206 222 doc->setStateForNewFormElements(itemToRestore->documentState());
Note:
See TracChangeset
for help on using the changeset viewer.