WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
HistoryController back pointer
bug-30274-20091010024206.patch (text/plain), 29.59 KB, created by
Adam Barth
on 2009-10-10 02:42:08 PDT
(
hide
)
Description:
HistoryController back pointer
Filename:
MIME Type:
Creator:
Adam Barth
Created:
2009-10-10 02:42:08 PDT
Size:
29.59 KB
patch
obsolete
>diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog >index e11dd38..f595c17 100644 >--- a/WebCore/ChangeLog >+++ b/WebCore/ChangeLog >@@ -1,3 +1,40 @@ >+2009-10-11 Adam Barth <abarth@webkit.org> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ HistoryController should point back to FrameLoader not Frame >+ https://bugs.webkit.org/show_bug.cgi?id=30274 >+ >+ HistoryController is a "subcontroller" of FrameLoader. Instead of >+ pointing back directly to Frame, HistoryController should hold a back >+ pointer to FrameLoader. >+ >+ * loader/FrameLoader.cpp: >+ (WebCore::FrameLoader::FrameLoader): >+ * loader/HistoryController.cpp: >+ (WebCore::HistoryController::HistoryController): >+ (WebCore::HistoryController::saveScrollPositionAndViewStateToItem): >+ (WebCore::HistoryController::restoreScrollPositionAndViewState): >+ (WebCore::HistoryController::saveDocumentState): >+ (WebCore::HistoryController::saveDocumentAndScrollState): >+ (WebCore::HistoryController::restoreDocumentState): >+ (WebCore::HistoryController::invalidateCurrentItemCachedPage): >+ (WebCore::HistoryController::goToItem): >+ (WebCore::HistoryController::urlsMatchItem): >+ (WebCore::HistoryController::updateForBackForwardNavigation): >+ (WebCore::HistoryController::updateForReload): >+ (WebCore::HistoryController::updateForStandardLoad): >+ (WebCore::HistoryController::updateForRedirectWithLockedBackForwardList): >+ (WebCore::HistoryController::updateForClientRedirect): >+ (WebCore::HistoryController::updateForCommit): >+ (WebCore::HistoryController::updateForAnchorScroll): >+ (WebCore::HistoryController::createItem): >+ (WebCore::HistoryController::createItemTree): >+ (WebCore::HistoryController::recursiveGoToItem): >+ (WebCore::HistoryController::childFramesMatchItem): >+ (WebCore::HistoryController::updateBackForwardListClippedAtTarget): >+ * loader/HistoryController.h: >+ > 2009-10-10 Adam Barth <abarth@webkit.org> > > Reviewed by Oliver Hunt. >diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp >index 59928e4..9cc19d7 100644 >--- a/WebCore/loader/FrameLoader.cpp >+++ b/WebCore/loader/FrameLoader.cpp >@@ -167,7 +167,7 @@ FrameLoader::FrameLoader(Frame* frame, FrameLoaderClient* client) > : m_frame(frame) > , m_client(client) > , m_policyChecker(frame) >- , m_history(frame) >+ , m_history(this) > , m_state(FrameStateCommittedPage) > , m_loadType(FrameLoadTypeStandard) > , m_delegateIsHandlingProvisionalLoadError(false) >diff --git a/WebCore/loader/HistoryController.cpp b/WebCore/loader/HistoryController.cpp >index 501640a..892ccf2 100644 >--- a/WebCore/loader/HistoryController.cpp >+++ b/WebCore/loader/HistoryController.cpp >@@ -48,8 +48,8 @@ > > namespace WebCore { > >-HistoryController::HistoryController(Frame* frame) >- : m_frame(frame) >+HistoryController::HistoryController(FrameLoader* frameLoader) >+ : m_frameLoader(frameLoader) > { > } > >@@ -59,12 +59,12 @@ HistoryController::~HistoryController() > > void HistoryController::saveScrollPositionAndViewStateToItem(HistoryItem* item) > { >- if (!item || !m_frame->view()) >+ if (!item || !m_frameLoader->frame()->view()) > return; > >- item->setScrollPoint(m_frame->view()->scrollPosition()); >+ item->setScrollPoint(m_frameLoader->frame()->view()->scrollPosition()); > // FIXME: It would be great to work out a way to put this code in WebCore instead of calling through to the client. >- m_frame->loader()->client()->saveViewStateToItem(item); >+ m_frameLoader->client()->saveViewStateToItem(item); > } > > /* >@@ -80,7 +80,7 @@ void HistoryController::saveScrollPositionAndViewStateToItem(HistoryItem* item) > */ > void HistoryController::restoreScrollPositionAndViewState() > { >- if (!m_frame->loader()->committedFirstRealDocumentLoad()) >+ if (!m_frameLoader->committedFirstRealDocumentLoad()) > return; > > ASSERT(m_currentItem); >@@ -95,9 +95,9 @@ void HistoryController::restoreScrollPositionAndViewState() > > // FIXME: It would be great to work out a way to put this code in WebCore instead of calling > // through to the client. It's currently used only for the PDF view on Mac. >- m_frame->loader()->client()->restoreViewState(); >+ m_frameLoader->client()->restoreViewState(); > >- if (FrameView* view = m_frame->view()) >+ if (FrameView* view = m_frameLoader->frame()->view()) > if (!view->wasScrolledByUser()) > view->setScrollPosition(m_currentItem->scrollPoint()); > } >@@ -111,7 +111,7 @@ void HistoryController::saveDocumentState() > { > // FIXME: Reading this bit of FrameLoader state here is unfortunate. I need to study > // this more to see if we can remove this dependency. >- if (m_frame->loader()->creatingInitialEmptyDocument()) >+ if (m_frameLoader->creatingInitialEmptyDocument()) > return; > > // For a standard page load, we will have a previous item set, which will be used to >@@ -129,11 +129,11 @@ void HistoryController::saveDocumentState() > if (!item) > return; > >- Document* document = m_frame->document(); >+ Document* document = m_frameLoader->frame()->document(); > ASSERT(document); > > if (item->isCurrentDocument(document)) { >- LOG(Loading, "WebCoreLoading %s: saving form state to %p", m_frame->tree()->name().string().utf8().data(), item); >+ LOG(Loading, "WebCoreLoading %s: saving form state to %p", m_frameLoader->frame()->tree()->name().string().utf8().data(), item); > item->setDocumentState(document->formElementsState()); > } > } >@@ -142,7 +142,7 @@ void HistoryController::saveDocumentState() > // history item. > void HistoryController::saveDocumentAndScrollState() > { >- for (Frame* frame = m_frame; frame; frame = frame->tree()->traverseNext(m_frame)) { >+ for (Frame* frame = m_frameLoader->frame(); frame; frame = frame->tree()->traverseNext(m_frameLoader->frame())) { > frame->loader()->history()->saveDocumentState(); > frame->loader()->history()->saveScrollPositionAndViewStateToItem(frame->loader()->history()->currentItem()); > } >@@ -150,11 +150,11 @@ void HistoryController::saveDocumentAndScrollState() > > void HistoryController::restoreDocumentState() > { >- Document* doc = m_frame->document(); >+ Document* doc = m_frameLoader->frame()->document(); > > HistoryItem* itemToRestore = 0; > >- switch (m_frame->loader()->loadType()) { >+ switch (m_frameLoader->loadType()) { > case FrameLoadTypeReload: > case FrameLoadTypeReloadFromOrigin: > case FrameLoadTypeSame: >@@ -172,7 +172,7 @@ void HistoryController::restoreDocumentState() > if (!itemToRestore) > return; > >- LOG(Loading, "WebCoreLoading %s: restoring form state from %p", m_frame->tree()->name().string().utf8().data(), itemToRestore); >+ LOG(Loading, "WebCoreLoading %s: restoring form state from %p", m_frameLoader->frame()->tree()->name().string().utf8().data(), itemToRestore); > doc->setStateForNewFormElements(itemToRestore->documentState()); > } > >@@ -185,8 +185,8 @@ void HistoryController::invalidateCurrentItemCachedPage() > // Somehow the PageState object is not properly updated, and is holding onto a stale document. > // Both Xcode and FileMaker see this crash, Safari does not. > >- ASSERT(!cachedPage || cachedPage->document() == m_frame->document()); >- if (cachedPage && cachedPage->document() == m_frame->document()) { >+ ASSERT(!cachedPage || cachedPage->document() == m_frameLoader->frame()->document()); >+ if (cachedPage && cachedPage->document() == m_frameLoader->frame()->document()) { > cachedPage->document()->setInPageCache(false); > cachedPage->clear(); > } >@@ -199,16 +199,16 @@ void HistoryController::invalidateCurrentItemCachedPage() > // This includes recursion to handle loading into framesets properly > void HistoryController::goToItem(HistoryItem* targetItem, FrameLoadType type) > { >- ASSERT(!m_frame->tree()->parent()); >+ ASSERT(!m_frameLoader->frame()->tree()->parent()); > > // shouldGoToHistoryItem is a private delegate method. This is needed to fix: > // <rdar://problem/3951283> can view pages from the back/forward cache that should be disallowed by Parental Controls > // Ultimately, history item navigations should go through the policy delegate. That's covered in: > // <rdar://problem/3979539> back/forward cache navigations should consult policy delegate >- Page* page = m_frame->page(); >+ Page* page = m_frameLoader->frame()->page(); > if (!page) > return; >- if (!m_frame->loader()->client()->shouldGoToHistoryItem(targetItem)) >+ if (!m_frameLoader->client()->shouldGoToHistoryItem(targetItem)) > return; > > // Set the BF cursor before commit, which lets the user quickly click back/forward again. >@@ -217,7 +217,7 @@ void HistoryController::goToItem(HistoryItem* targetItem, FrameLoadType type) > BackForwardList* bfList = page->backForwardList(); > HistoryItem* currentItem = bfList->currentItem(); > bfList->goToItem(targetItem); >- Settings* settings = m_frame->settings(); >+ Settings* settings = m_frameLoader->frame()->settings(); > page->setGlobalHistoryItem((!settings || settings->privateBrowsingEnabled()) ? 0 : targetItem); > recursiveGoToItem(targetItem, currentItem, type); > } >@@ -225,7 +225,7 @@ void HistoryController::goToItem(HistoryItem* targetItem, FrameLoadType type) > // Walk the frame tree and ensure that the URLs match the URLs in the item. > bool HistoryController::urlsMatchItem(HistoryItem* item) const > { >- const KURL& currentURL = m_frame->loader()->documentLoader()->url(); >+ const KURL& currentURL = m_frameLoader->documentLoader()->url(); > if (!equalIgnoringFragmentIdentifier(currentURL, item->url())) > return false; > >@@ -233,7 +233,7 @@ bool HistoryController::urlsMatchItem(HistoryItem* item) const > > unsigned size = childItems.size(); > for (unsigned i = 0; i < size; ++i) { >- Frame* childFrame = m_frame->tree()->child(childItems[i]->target()); >+ Frame* childFrame = m_frameLoader->frame()->tree()->child(childItems[i]->target()); > if (childFrame && !childFrame->loader()->history()->urlsMatchItem(childItems[i].get())) > return false; > } >@@ -244,8 +244,8 @@ bool HistoryController::urlsMatchItem(HistoryItem* item) const > void HistoryController::updateForBackForwardNavigation() > { > #if !LOG_DISABLED >- if (m_frame->loader()->documentLoader()) >- LOG(History, "WebCoreHistory: Updating History for back/forward navigation in frame %s", m_frame->loader()->documentLoader()->title().utf8().data()); >+ if (m_frameLoader->documentLoader()) >+ LOG(History, "WebCoreHistory: Updating History for back/forward navigation in frame %s", m_frameLoader->documentLoader()->title().utf8().data()); > #endif > > // Must grab the current scroll position before disturbing it >@@ -255,19 +255,19 @@ void HistoryController::updateForBackForwardNavigation() > void HistoryController::updateForReload() > { > #if !LOG_DISABLED >- if (m_frame->loader()->documentLoader()) >- LOG(History, "WebCoreHistory: Updating History for reload in frame %s", m_frame->loader()->documentLoader()->title().utf8().data()); >+ if (m_frameLoader->documentLoader()) >+ LOG(History, "WebCoreHistory: Updating History for reload in frame %s", m_frameLoader->documentLoader()->title().utf8().data()); > #endif > > if (m_currentItem) { > pageCache()->remove(m_currentItem.get()); > >- if (m_frame->loader()->loadType() == FrameLoadTypeReload || m_frame->loader()->loadType() == FrameLoadTypeReloadFromOrigin) >+ if (m_frameLoader->loadType() == FrameLoadTypeReload || m_frameLoader->loadType() == FrameLoadTypeReloadFromOrigin) > saveScrollPositionAndViewStateToItem(m_currentItem.get()); > > // Sometimes loading a page again leads to a different result because of cookies. Bugzilla 4072 >- if (m_frame->loader()->documentLoader()->unreachableURL().isEmpty()) >- m_currentItem->setURL(m_frame->loader()->documentLoader()->requestURL()); >+ if (m_frameLoader->documentLoader()->unreachableURL().isEmpty()) >+ m_currentItem->setURL(m_frameLoader->documentLoader()->requestURL()); > } > } > >@@ -279,89 +279,87 @@ void HistoryController::updateForReload() > > void HistoryController::updateForStandardLoad() > { >- LOG(History, "WebCoreHistory: Updating History for Standard Load in frame %s", m_frame->loader()->documentLoader()->url().string().ascii().data()); >+ LOG(History, "WebCoreHistory: Updating History for Standard Load in frame %s", m_frameLoader->documentLoader()->url().string().ascii().data()); > >- FrameLoader* frameLoader = m_frame->loader(); >- >- Settings* settings = m_frame->settings(); >+ Settings* settings = m_frameLoader->frame()->settings(); > bool needPrivacy = !settings || settings->privateBrowsingEnabled(); >- const KURL& historyURL = frameLoader->documentLoader()->urlForHistory(); >+ const KURL& historyURL = m_frameLoader->documentLoader()->urlForHistory(); > >- if (!frameLoader->documentLoader()->isClientRedirect()) { >+ if (!m_frameLoader->documentLoader()->isClientRedirect()) { > if (!historyURL.isEmpty()) { > updateBackForwardListClippedAtTarget(true); > if (!needPrivacy) { >- frameLoader->client()->updateGlobalHistory(); >- frameLoader->documentLoader()->setDidCreateGlobalHistoryEntry(true); >- if (frameLoader->documentLoader()->unreachableURL().isEmpty()) >- frameLoader->client()->updateGlobalHistoryRedirectLinks(); >+ m_frameLoader->client()->updateGlobalHistory(); >+ m_frameLoader->documentLoader()->setDidCreateGlobalHistoryEntry(true); >+ if (m_frameLoader->documentLoader()->unreachableURL().isEmpty()) >+ m_frameLoader->client()->updateGlobalHistoryRedirectLinks(); > } >- if (Page* page = m_frame->page()) >+ if (Page* page = m_frameLoader->frame()->page()) > page->setGlobalHistoryItem(needPrivacy ? 0 : page->backForwardList()->currentItem()); > } >- } else if (frameLoader->documentLoader()->unreachableURL().isEmpty() && m_currentItem) { >- m_currentItem->setURL(frameLoader->documentLoader()->url()); >- m_currentItem->setFormInfoFromRequest(frameLoader->documentLoader()->request()); >+ } else if (m_frameLoader->documentLoader()->unreachableURL().isEmpty() && m_currentItem) { >+ m_currentItem->setURL(m_frameLoader->documentLoader()->url()); >+ m_currentItem->setFormInfoFromRequest(m_frameLoader->documentLoader()->request()); > } > > if (!historyURL.isEmpty() && !needPrivacy) { >- if (Page* page = m_frame->page()) >+ if (Page* page = m_frameLoader->frame()->page()) > page->group().addVisitedLink(historyURL); > >- if (!frameLoader->documentLoader()->didCreateGlobalHistoryEntry() && frameLoader->documentLoader()->unreachableURL().isEmpty() && !frameLoader->url().isEmpty()) >- frameLoader->client()->updateGlobalHistoryRedirectLinks(); >+ if (!m_frameLoader->documentLoader()->didCreateGlobalHistoryEntry() && m_frameLoader->documentLoader()->unreachableURL().isEmpty() && !m_frameLoader->url().isEmpty()) >+ m_frameLoader->client()->updateGlobalHistoryRedirectLinks(); > } > } > > void HistoryController::updateForRedirectWithLockedBackForwardList() > { > #if !LOG_DISABLED >- if (m_frame->loader()->documentLoader()) >- LOG(History, "WebCoreHistory: Updating History for redirect load in frame %s", m_frame->loader()->documentLoader()->title().utf8().data()); >+ if (m_frameLoader->documentLoader()) >+ LOG(History, "WebCoreHistory: Updating History for redirect load in frame %s", m_frameLoader->documentLoader()->title().utf8().data()); > #endif > >- Settings* settings = m_frame->settings(); >+ Settings* settings = m_frameLoader->frame()->settings(); > bool needPrivacy = !settings || settings->privateBrowsingEnabled(); >- const KURL& historyURL = m_frame->loader()->documentLoader()->urlForHistory(); >+ const KURL& historyURL = m_frameLoader->documentLoader()->urlForHistory(); > >- if (m_frame->loader()->documentLoader()->isClientRedirect()) { >- if (!m_currentItem && !m_frame->tree()->parent()) { >+ if (m_frameLoader->documentLoader()->isClientRedirect()) { >+ if (!m_currentItem && !m_frameLoader->frame()->tree()->parent()) { > if (!historyURL.isEmpty()) { > updateBackForwardListClippedAtTarget(true); > if (!needPrivacy) { >- m_frame->loader()->client()->updateGlobalHistory(); >- m_frame->loader()->documentLoader()->setDidCreateGlobalHistoryEntry(true); >- if (m_frame->loader()->documentLoader()->unreachableURL().isEmpty()) >- m_frame->loader()->client()->updateGlobalHistoryRedirectLinks(); >+ m_frameLoader->client()->updateGlobalHistory(); >+ m_frameLoader->documentLoader()->setDidCreateGlobalHistoryEntry(true); >+ if (m_frameLoader->documentLoader()->unreachableURL().isEmpty()) >+ m_frameLoader->client()->updateGlobalHistoryRedirectLinks(); > } >- if (Page* page = m_frame->page()) >+ if (Page* page = m_frameLoader->frame()->page()) > page->setGlobalHistoryItem(needPrivacy ? 0 : page->backForwardList()->currentItem()); > } > } > if (m_currentItem) { >- m_currentItem->setURL(m_frame->loader()->documentLoader()->url()); >- m_currentItem->setFormInfoFromRequest(m_frame->loader()->documentLoader()->request()); >+ m_currentItem->setURL(m_frameLoader->documentLoader()->url()); >+ m_currentItem->setFormInfoFromRequest(m_frameLoader->documentLoader()->request()); > } > } else { >- Frame* parentFrame = m_frame->tree()->parent(); >+ Frame* parentFrame = m_frameLoader->frame()->tree()->parent(); > if (parentFrame && parentFrame->loader()->history()->m_currentItem) > parentFrame->loader()->history()->m_currentItem->setChildItem(createItem(true)); > } > > if (!historyURL.isEmpty() && !needPrivacy) { >- if (Page* page = m_frame->page()) >+ if (Page* page = m_frameLoader->frame()->page()) > page->group().addVisitedLink(historyURL); > >- if (!m_frame->loader()->documentLoader()->didCreateGlobalHistoryEntry() && m_frame->loader()->documentLoader()->unreachableURL().isEmpty() && !m_frame->loader()->url().isEmpty()) >- m_frame->loader()->client()->updateGlobalHistoryRedirectLinks(); >+ if (!m_frameLoader->documentLoader()->didCreateGlobalHistoryEntry() && m_frameLoader->documentLoader()->unreachableURL().isEmpty() && !m_frameLoader->url().isEmpty()) >+ m_frameLoader->client()->updateGlobalHistoryRedirectLinks(); > } > } > > void HistoryController::updateForClientRedirect() > { > #if !LOG_DISABLED >- if (m_frame->loader()->documentLoader()) >- LOG(History, "WebCoreHistory: Updating History for client redirect in frame %s", m_frame->loader()->documentLoader()->title().utf8().data()); >+ if (m_frameLoader->documentLoader()) >+ LOG(History, "WebCoreHistory: Updating History for client redirect in frame %s", m_frameLoader->documentLoader()->title().utf8().data()); > #endif > > // Clear out form data so we don't try to restore it into the incoming page. Must happen after >@@ -371,26 +369,25 @@ void HistoryController::updateForClientRedirect() > m_currentItem->clearScrollPoint(); > } > >- Settings* settings = m_frame->settings(); >+ Settings* settings = m_frameLoader->frame()->settings(); > bool needPrivacy = !settings || settings->privateBrowsingEnabled(); >- const KURL& historyURL = m_frame->loader()->documentLoader()->urlForHistory(); >+ const KURL& historyURL = m_frameLoader->documentLoader()->urlForHistory(); > > if (!historyURL.isEmpty() && !needPrivacy) { >- if (Page* page = m_frame->page()) >+ if (Page* page = m_frameLoader->frame()->page()) > page->group().addVisitedLink(historyURL); > } > } > > void HistoryController::updateForCommit() > { >- FrameLoader* frameLoader = m_frame->loader(); > #if !LOG_DISABLED >- if (frameLoader->documentLoader()) >- LOG(History, "WebCoreHistory: Updating History for commit in frame %s", frameLoader->documentLoader()->title().utf8().data()); >+ if (m_frameLoader->documentLoader()) >+ LOG(History, "WebCoreHistory: Updating History for commit in frame %s", m_frameLoader->documentLoader()->title().utf8().data()); > #endif >- FrameLoadType type = frameLoader->loadType(); >+ FrameLoadType type = m_frameLoader->loadType(); > if (isBackForwardLoadType(type) || >- ((type == FrameLoadTypeReload || type == FrameLoadTypeReloadFromOrigin) && !frameLoader->provisionalDocumentLoader()->unreachableURL().isEmpty())) { >+ ((type == FrameLoadTypeReload || type == FrameLoadTypeReloadFromOrigin) && !m_frameLoader->provisionalDocumentLoader()->unreachableURL().isEmpty())) { > // Once committed, we want to use current item for saving DocState, and > // the provisional item for restoring state. > // Note previousItem must be set before we close the URL, which will >@@ -404,18 +401,18 @@ void HistoryController::updateForCommit() > > void HistoryController::updateForAnchorScroll() > { >- if (m_frame->loader()->url().isEmpty()) >+ if (m_frameLoader->url().isEmpty()) > return; > >- Settings* settings = m_frame->settings(); >+ Settings* settings = m_frameLoader->frame()->settings(); > if (!settings || settings->privateBrowsingEnabled()) > return; > >- Page* page = m_frame->page(); >+ Page* page = m_frameLoader->frame()->page(); > if (!page) > return; > >- page->group().addVisitedLink(m_frame->loader()->url()); >+ page->group().addVisitedLink(m_frameLoader->url()); > } > > void HistoryController::updateForFrameLoadCompleted() >@@ -443,7 +440,7 @@ void HistoryController::setProvisionalItem(HistoryItem* item) > > PassRefPtr<HistoryItem> HistoryController::createItem(bool useOriginal) > { >- DocumentLoader* docLoader = m_frame->loader()->documentLoader(); >+ DocumentLoader* docLoader = m_frameLoader->documentLoader(); > > KURL unreachableURL = docLoader ? docLoader->unreachableURL() : KURL(); > >@@ -473,11 +470,11 @@ PassRefPtr<HistoryItem> HistoryController::createItem(bool useOriginal) > if (originalURL.isEmpty()) > originalURL = blankURL(); > >- Frame* parentFrame = m_frame->tree()->parent(); >+ Frame* parentFrame = m_frameLoader->frame()->tree()->parent(); > String parent = parentFrame ? parentFrame->tree()->name() : ""; > String title = docLoader ? docLoader->title() : ""; > >- RefPtr<HistoryItem> item = HistoryItem::create(url, m_frame->tree()->name(), parent, title); >+ RefPtr<HistoryItem> item = HistoryItem::create(url, m_frameLoader->frame()->tree()->name(), parent, title); > item->setOriginalURLString(originalURL.string()); > > if (!unreachableURL.isEmpty() || !docLoader || docLoader->response().httpStatusCode() >= 400) >@@ -500,13 +497,13 @@ PassRefPtr<HistoryItem> HistoryController::createItem(bool useOriginal) > > PassRefPtr<HistoryItem> HistoryController::createItemTree(Frame* targetFrame, bool clipAtTarget) > { >- RefPtr<HistoryItem> bfItem = createItem(m_frame->tree()->parent() ? true : false); >+ RefPtr<HistoryItem> bfItem = createItem(m_frameLoader->frame()->tree()->parent() ? true : false); > if (m_previousItem) > saveScrollPositionAndViewStateToItem(m_previousItem.get()); >- if (!(clipAtTarget && m_frame == targetFrame)) { >+ if (!(clipAtTarget && m_frameLoader->frame() == targetFrame)) { > // save frame state for items that aren't loading (khtml doesn't save those) > saveDocumentState(); >- for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) { >+ for (Frame* child = m_frameLoader->frame()->tree()->firstChild(); child; child = child->tree()->nextSibling()) { > FrameLoader* childLoader = child->loader(); > bool hasChildLoaded = childLoader->frameHasLoaded(); > >@@ -518,7 +515,7 @@ PassRefPtr<HistoryItem> HistoryController::createItemTree(Frame* targetFrame, bo > bfItem->addChildItem(childLoader->history()->createItemTree(targetFrame, clipAtTarget)); > } > } >- if (m_frame == targetFrame) >+ if (m_frameLoader->frame() == targetFrame) > bfItem->setIsTargetItem(true); > return bfItem; > } >@@ -534,8 +531,8 @@ void HistoryController::recursiveGoToItem(HistoryItem* item, HistoryItem* fromIt > > KURL itemURL = item->url(); > KURL currentURL; >- if (m_frame->loader()->documentLoader()) >- currentURL = m_frame->loader()->documentLoader()->url(); >+ if (m_frameLoader->documentLoader()) >+ currentURL = m_frameLoader->documentLoader()->url(); > > // Always reload the target frame of the item we're going to. This ensures that we will > // do -some- load for the transition, which means a proper notification will be posted >@@ -545,7 +542,7 @@ void HistoryController::recursiveGoToItem(HistoryItem* item, HistoryItem* fromIt > // The current frame tree and the frame tree snapshot in the item have to match. > if (!item->isTargetItem() && > itemURL == currentURL && >- ((m_frame->tree()->name().isEmpty() && item->target().isEmpty()) || m_frame->tree()->name() == item->target()) && >+ ((m_frameLoader->frame()->tree()->name().isEmpty() && item->target().isEmpty()) || m_frameLoader->frame()->tree()->name() == item->target()) && > childFramesMatchItem(item)) > { > // This content is good, so leave it alone and look for children that need reloading >@@ -554,7 +551,7 @@ void HistoryController::recursiveGoToItem(HistoryItem* item, HistoryItem* fromIt > saveDocumentState(); > saveScrollPositionAndViewStateToItem(m_currentItem.get()); > >- if (FrameView* view = m_frame->view()) >+ if (FrameView* view = m_frameLoader->frame()->view()) > view->setWasScrolledByUser(false); > > m_currentItem = item; >@@ -572,12 +569,12 @@ void HistoryController::recursiveGoToItem(HistoryItem* item, HistoryItem* fromIt > String childFrameName = childItems[i]->target(); > HistoryItem* fromChildItem = fromItem->childItemWithTarget(childFrameName); > ASSERT(fromChildItem || fromItem->isTargetItem()); >- Frame* childFrame = m_frame->tree()->child(childFrameName); >+ Frame* childFrame = m_frameLoader->frame()->tree()->child(childFrameName); > ASSERT(childFrame); > childFrame->loader()->history()->recursiveGoToItem(childItems[i].get(), fromChildItem, type); > } > } else { >- m_frame->loader()->loadItem(item, type); >+ m_frameLoader->loadItem(item, type); > } > } > >@@ -586,12 +583,12 @@ void HistoryController::recursiveGoToItem(HistoryItem* item, HistoryItem* fromIt > bool HistoryController::childFramesMatchItem(HistoryItem* item) const > { > const HistoryItemVector& childItems = item->children(); >- if (childItems.size() != m_frame->tree()->childCount()) >+ if (childItems.size() != m_frameLoader->frame()->tree()->childCount()) > return false; > > unsigned size = childItems.size(); > for (unsigned i = 0; i < size; ++i) { >- if (!m_frame->tree()->child(childItems[i]->target())) >+ if (!m_frameLoader->frame()->tree()->child(childItems[i]->target())) > return false; > } > >@@ -606,11 +603,11 @@ void HistoryController::updateBackForwardListClippedAtTarget(bool doClip) > // When this function is called with doClip=true we're able to create the whole tree except for the target's children, > // which will be loaded in the future. That part of the tree will be filled out as the child loads are committed. > >- Page* page = m_frame->page(); >+ Page* page = m_frameLoader->frame()->page(); > if (!page) > return; > >- if (m_frame->loader()->documentLoader()->urlForHistory().isEmpty()) >+ if (m_frameLoader->documentLoader()->urlForHistory().isEmpty()) > return; > > Frame* mainFrame = page->mainFrame(); >@@ -619,8 +616,8 @@ void HistoryController::updateBackForwardListClippedAtTarget(bool doClip) > > frameLoader->checkDidPerformFirstNavigation(); > >- RefPtr<HistoryItem> item = frameLoader->history()->createItemTree(m_frame, doClip); >- LOG(BackForward, "WebCoreBackForward - Adding backforward item %p for frame %s", item.get(), m_frame->loader()->documentLoader()->url().string().ascii().data()); >+ RefPtr<HistoryItem> item = frameLoader->history()->createItemTree(m_frameLoader->frame(), doClip); >+ LOG(BackForward, "WebCoreBackForward - Adding backforward item %p for frame %s", item.get(), m_frameLoader->documentLoader()->url().string().ascii().data()); > page->backForwardList()->addItem(item); > } > >diff --git a/WebCore/loader/HistoryController.h b/WebCore/loader/HistoryController.h >index c161516..976971d 100644 >--- a/WebCore/loader/HistoryController.h >+++ b/WebCore/loader/HistoryController.h >@@ -38,11 +38,12 @@ > namespace WebCore { > > class Frame; >+ class FrameLoader; > class HistoryItem; > > class HistoryController : public Noncopyable { > public: >- HistoryController(Frame*); >+ HistoryController(FrameLoader*); > ~HistoryController(); > > void saveScrollPositionAndViewStateToItem(HistoryItem*); >@@ -83,7 +84,7 @@ namespace WebCore { > bool childFramesMatchItem(HistoryItem*) const; > void updateBackForwardListClippedAtTarget(bool doClip); > >- Frame* m_frame; >+ FrameLoader* m_frameLoader; > > RefPtr<HistoryItem> m_currentItem; > RefPtr<HistoryItem> m_previousItem;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
darin
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 30274
:
40987
| 40988