Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 HistoryController::~HistoryController() | 146 HistoryController::~HistoryController() |
| 147 { | 147 { |
| 148 } | 148 } |
| 149 | 149 |
| 150 void HistoryController::updateBackForwardListForFragmentScroll(Frame* frame, His toryItem* item) | 150 void HistoryController::updateBackForwardListForFragmentScroll(Frame* frame, His toryItem* item) |
| 151 { | 151 { |
| 152 m_provisionalEntry.clear(); | 152 m_provisionalEntry.clear(); |
| 153 createNewBackForwardItem(frame, item, false); | 153 createNewBackForwardItem(frame, item, false); |
| 154 } | 154 } |
| 155 | 155 |
| 156 class HistoryController::HistoryFrameLoad { | |
| 157 public: | |
| 158 HistoryFrameLoad(Frame* frame, HistoryItem* item) | |
| 159 : m_frame(frame) | |
| 160 , m_item(item) | |
| 161 { | |
| 162 } | |
| 163 | |
| 164 Frame* frame() { return m_frame.get(); } | |
| 165 HistoryItem* item() { return m_item; } | |
| 166 | |
| 167 private: | |
| 168 RefPtr<Frame> m_frame; | |
| 169 HistoryItem* m_item; | |
| 170 }; | |
| 171 | |
| 156 void HistoryController::goToEntry(PassOwnPtr<HistoryEntry> targetEntry, Resource RequestCachePolicy cachePolicy) | 172 void HistoryController::goToEntry(PassOwnPtr<HistoryEntry> targetEntry, Resource RequestCachePolicy cachePolicy) |
| 157 { | 173 { |
| 158 HistoryFrameLoadSet sameDocumentLoads; | 174 HistoryFrameLoadSet sameDocumentLoads; |
| 159 HistoryFrameLoadSet differentDocumentLoads; | 175 HistoryFrameLoadSet differentDocumentLoads; |
| 160 | 176 |
| 161 m_provisionalEntry = targetEntry; | 177 m_provisionalEntry = targetEntry; |
| 162 if (m_currentEntry) | 178 if (m_currentEntry) |
| 163 recursiveGoToEntry(m_page->mainFrame(), sameDocumentLoads, differentDocu mentLoads); | 179 recursiveGoToEntry(m_page->mainFrame(), sameDocumentLoads, differentDocu mentLoads); |
| 164 else | 180 else |
| 165 differentDocumentLoads.set(m_page->mainFrame(), m_provisionalEntry->root ()); | 181 differentDocumentLoads.set(m_page->mainFrame(), adoptPtr(new HistoryFram eLoad(m_page->mainFrame(), m_provisionalEntry->root()))); |
| 166 | 182 |
| 167 if (sameDocumentLoads.isEmpty() && differentDocumentLoads.isEmpty()) | 183 if (sameDocumentLoads.isEmpty() && differentDocumentLoads.isEmpty()) |
| 168 sameDocumentLoads.set(m_page->mainFrame(), m_provisionalEntry->root()); | 184 sameDocumentLoads.set(m_page->mainFrame(), adoptPtr(new HistoryFrameLoad (m_page->mainFrame(), m_provisionalEntry->root()))); |
| 169 | 185 |
| 170 if (differentDocumentLoads.isEmpty()) { | 186 if (differentDocumentLoads.isEmpty()) { |
| 171 m_previousEntry = m_currentEntry.release(); | 187 m_previousEntry = m_currentEntry.release(); |
| 172 m_currentEntry = m_provisionalEntry.release(); | 188 m_currentEntry = m_provisionalEntry.release(); |
| 173 } | 189 } |
| 174 | 190 |
| 175 for (HistoryFrameLoadSet::iterator it = sameDocumentLoads.begin(); it != sam eDocumentLoads.end(); ++it) | 191 for (HistoryFrameLoadSet::iterator it = sameDocumentLoads.begin(); it != sam eDocumentLoads.end(); ++it) |
| 176 it->key->loader().loadHistoryItem(it->value, HistorySameDocumentLoad, ca chePolicy); | 192 it->key->loader().loadHistoryItem(it->value->item(), HistorySameDocument Load, cachePolicy); |
|
Nate Chapin
2014/01/23 18:19:11
Rather than checking m_client in loadHistoryItem()
| |
| 177 for (HistoryFrameLoadSet::iterator it = differentDocumentLoads.begin(); it ! = differentDocumentLoads.end(); ++it) | 193 for (HistoryFrameLoadSet::iterator it = differentDocumentLoads.begin(); it ! = differentDocumentLoads.end(); ++it) |
| 178 it->key->loader().loadHistoryItem(it->value, HistoryDifferentDocumentLoa d, cachePolicy); | 194 it->key->loader().loadHistoryItem(it->value->item(), HistoryDifferentDoc umentLoad, cachePolicy); |
| 179 } | 195 } |
| 180 | 196 |
| 181 void HistoryController::recursiveGoToEntry(Frame* frame, HistoryFrameLoadSet& sa meDocumentLoads, HistoryFrameLoadSet& differentDocumentLoads) | 197 void HistoryController::recursiveGoToEntry(Frame* frame, HistoryFrameLoadSet& sa meDocumentLoads, HistoryFrameLoadSet& differentDocumentLoads) |
| 182 { | 198 { |
| 183 ASSERT(m_provisionalEntry); | 199 ASSERT(m_provisionalEntry); |
| 184 ASSERT(m_currentEntry); | 200 ASSERT(m_currentEntry); |
| 185 HistoryItem* newItem = m_provisionalEntry->itemForFrame(frame); | 201 HistoryItem* newItem = m_provisionalEntry->itemForFrame(frame); |
| 186 HistoryItem* oldItem = m_currentEntry->itemForFrame(frame); | 202 HistoryItem* oldItem = m_currentEntry->itemForFrame(frame); |
| 187 if (!newItem) | 203 if (!newItem) |
| 188 return; | 204 return; |
| 189 | 205 |
| 190 if (!oldItem || (newItem != oldItem && newItem->itemSequenceNumber() != oldI tem->itemSequenceNumber())) { | 206 if (!oldItem || (newItem != oldItem && newItem->itemSequenceNumber() != oldI tem->itemSequenceNumber())) { |
| 191 if (oldItem && newItem->documentSequenceNumber() == oldItem->documentSeq uenceNumber()) | 207 if (oldItem && newItem->documentSequenceNumber() == oldItem->documentSeq uenceNumber()) |
| 192 sameDocumentLoads.set(frame, newItem); | 208 sameDocumentLoads.set(frame, adoptPtr(new HistoryFrameLoad(frame, ne wItem))); |
| 193 else | 209 else |
| 194 differentDocumentLoads.set(frame, newItem); | 210 differentDocumentLoads.set(frame, adoptPtr(new HistoryFrameLoad(fram e, newItem))); |
| 195 return; | 211 return; |
| 196 } | 212 } |
| 197 | 213 |
| 198 for (Frame* child = frame->tree().firstChild(); child; child = child->tree() .nextSibling()) | 214 for (Frame* child = frame->tree().firstChild(); child; child = child->tree() .nextSibling()) |
| 199 recursiveGoToEntry(child, sameDocumentLoads, differentDocumentLoads); | 215 recursiveGoToEntry(child, sameDocumentLoads, differentDocumentLoads); |
| 200 } | 216 } |
| 201 | 217 |
| 202 void HistoryController::goToItem(HistoryItem* targetItem, ResourceRequestCachePo licy cachePolicy) | 218 void HistoryController::goToItem(HistoryItem* targetItem, ResourceRequestCachePo licy cachePolicy) |
| 203 { | 219 { |
| 204 if (m_defersLoading) { | 220 if (m_defersLoading) { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 } else { | 329 } else { |
| 314 HistoryItem* oldItem = m_currentEntry->itemForFrame(targetFrame); | 330 HistoryItem* oldItem = m_currentEntry->itemForFrame(targetFrame); |
| 315 if (!clipAtTarget && oldItem) | 331 if (!clipAtTarget && oldItem) |
| 316 newItem->setDocumentSequenceNumber(oldItem->documentSequenceNumber() ); | 332 newItem->setDocumentSequenceNumber(oldItem->documentSequenceNumber() ); |
| 317 m_previousEntry = m_currentEntry.release(); | 333 m_previousEntry = m_currentEntry.release(); |
| 318 m_currentEntry = m_previousEntry->cloneAndReplace(newItem.get(), clipAtT arget, targetFrame, m_page); | 334 m_currentEntry = m_previousEntry->cloneAndReplace(newItem.get(), clipAtT arget, targetFrame, m_page); |
| 319 } | 335 } |
| 320 } | 336 } |
| 321 | 337 |
| 322 } // namespace WebCore | 338 } // namespace WebCore |
| OLD | NEW |