Changeset 49413 in webkit
- Timestamp:
- Oct 9, 2009 7:27:21 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r49410 r49413 1 2009-10-09 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Darin Adler. 4 5 Factor HistoryController out of FrameLoader 6 https://bugs.webkit.org/show_bug.cgi?id=30246 7 8 HistoryController is in charge of managing the current / previous / 9 provisional HistoryItems. The split isn't perfect, but it's a place to 10 start. I'll move HistoryController into its own file in another patch. 11 12 * WebCore.base.exp: 13 * loader/FrameLoader.cpp: 14 (WebCore::HistoryController::HistoryController): 15 (WebCore::HistoryController::~HistoryController): 16 (WebCore::FrameLoader::FrameLoader): 17 (WebCore::FrameLoader::closeURL): 18 (WebCore::FrameLoader::begin): 19 (WebCore::HistoryController::restoreDocumentState): 20 (WebCore::HistoryController::setCurrentItem): 21 (WebCore::HistoryController::setProvisionalItem): 22 (WebCore::FrameLoader::loadURLIntoChildFrame): 23 (WebCore::FrameLoader::canCachePageContainingThisFrame): 24 (WebCore::FrameLoader::logCanCacheFrameDecision): 25 (WebCore::FrameLoader::scrollToAnchor): 26 (WebCore::FrameLoader::commitProvisionalLoad): 27 (WebCore::FrameLoader::transitionToCommitted): 28 (WebCore::FrameLoader::checkLoadCompleteForThisFrame): 29 (WebCore::FrameLoader::didFirstLayout): 30 (WebCore::HistoryController::updateForFrameLoadCompleted): 31 (WebCore::FrameLoader::frameLoadCompleted): 32 (WebCore::FrameLoader::detachFromParent): 33 (WebCore::FrameLoader::receivedMainResourceError): 34 (WebCore::FrameLoader::continueFragmentScrollAfterNavigationPolicy): 35 (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): 36 (WebCore::HistoryController::addHistoryItemForFragmentScroll): 37 (WebCore::FrameLoader::loadProvisionalItemFromCachedPage): 38 (WebCore::FrameLoader::shouldTreatURLAsSameAsCurrent): 39 (WebCore::HistoryController::createHistoryItem): 40 (WebCore::FrameLoader::checkDidPerformFirstNavigation): 41 (WebCore::HistoryController::addBackForwardItemClippedAtTarget): 42 (WebCore::HistoryController::createHistoryItemTree): 43 (WebCore::HistoryController::saveScrollPositionAndViewStateToItem): 44 (WebCore::HistoryController::restoreScrollPositionAndViewState): 45 (WebCore::HistoryController::invalidateCurrentItemCachedPage): 46 (WebCore::HistoryController::saveDocumentState): 47 (WebCore::FrameLoader::loadItem): 48 (WebCore::HistoryController::urlsMatchItem): 49 (WebCore::HistoryController::goToItem): 50 (WebCore::HistoryController::recursiveGoToItem): 51 (WebCore::HistoryController::childFramesMatchItem): 52 (WebCore::HistoryController::updateForStandardLoad): 53 (WebCore::HistoryController::updateForClientRedirect): 54 (WebCore::HistoryController::updateForBackForwardNavigation): 55 (WebCore::HistoryController::updateForReload): 56 (WebCore::HistoryController::updateForRedirectWithLockedBackForwardList): 57 (WebCore::HistoryController::updateForCommit): 58 (WebCore::HistoryController::updateForAnchorScroll): 59 (WebCore::HistoryController::saveDocumentAndScrollState): 60 (WebCore::HistoryController::setCurrentItemTitle): 61 (WebCore::FrameLoader::didChangeTitle): 62 * loader/FrameLoader.h: 63 (WebCore::HistoryController::current): 64 (WebCore::HistoryController::provisional): 65 (WebCore::FrameLoader::policyChecker): 66 (WebCore::FrameLoader::history): 67 (WebCore::FrameLoader::creatingInitialEmptyDocument): 68 * page/Page.cpp: 69 (WebCore::Page::goToItem): 70 1 71 2009-10-09 Alexey Proskuryakov <ap@apple.com> 2 72 -
trunk/WebCore/WebCore.base.exp
r49385 r49413 163 163 __ZN7WebCore11FrameLoader16loadFrameRequestERKNS_16FrameLoadRequestEbbN3WTF10PassRefPtrINS_5EventEEENS5_INS_9FormStateEEE 164 164 __ZN7WebCore11FrameLoader17stopForUserCancelEb 165 __ZN7WebCore11FrameLoader18currentHistoryItemEv166 165 __ZN7WebCore11FrameLoader21loadURLIntoChildFrameERKNS_4KURLERKNS_6StringEPNS_5FrameE 167 __ZN7WebCore11FrameLoader21setCurrentHistoryItemEN3WTF10PassRefPtrINS_11HistoryItemEEE168 166 __ZN7WebCore11FrameLoader22findFrameForNavigationERKNS_12AtomicStringE 169 167 __ZN7WebCore11FrameLoader23isProcessingUserGestureEv 170 168 __ZN7WebCore11FrameLoader23timeOfLastCompletedLoadEv 171 169 __ZN7WebCore11FrameLoader26reloadWithOverrideEncodingERKNS_6StringE 172 __ZN7WebCore11FrameLoader26saveDocumentAndScrollStateEv173 __ZN7WebCore11FrameLoader36saveScrollPositionAndViewStateToItemEPNS_11HistoryItemE174 170 __ZN7WebCore11FrameLoader4loadERKNS_15ResourceRequestERKNS_14SubstituteDataEb 175 171 __ZN7WebCore11FrameLoader4loadERKNS_15ResourceRequestERKNS_6StringEb … … 389 385 __ZN7WebCore17DOMImplementation14isTextMIMETypeERKNS_6StringE 390 386 __ZN7WebCore17GlyphPageTreeNode18treeGlyphPageCountEv 387 __ZN7WebCore17HistoryController26saveDocumentAndScrollStateEv 391 388 __ZN7WebCore17HTMLPlugInElement11getNPObjectEv 392 389 __ZN7WebCore17equalIgnoringCaseEPNS_10StringImplES1_ -
trunk/WebCore/loader/FrameLoader.cpp
r49372 r49413 164 164 } 165 165 166 HistoryController::HistoryController(Frame* frame) 167 : m_frame(frame) 168 { 169 } 170 171 HistoryController::~HistoryController() 172 { 173 } 174 166 175 FrameLoader::FrameLoader(Frame* frame, FrameLoaderClient* client) 167 176 : m_frame(frame) 168 177 , m_client(client) 169 178 , m_policyChecker(frame) 179 , m_history(frame) 170 180 , m_state(FrameStateCommittedPage) 171 181 , m_loadType(FrameLoadTypeStandard) … … 564 574 bool FrameLoader::closeURL() 565 575 { 566 saveDocumentState();576 history()->saveDocumentState(); 567 577 568 578 // Should only send the pagehide event here if the current document exists and has not been placed in the page cache. … … 827 837 } 828 838 829 restoreDocumentState();839 history()->restoreDocumentState(); 830 840 831 841 document->implicitOpen(); … … 1014 1024 } 1015 1025 1016 void FrameLoader::restoreDocumentState()1026 void HistoryController::restoreDocumentState() 1017 1027 { 1018 1028 Document* doc = m_frame->document(); … … 1020 1030 HistoryItem* itemToRestore = 0; 1021 1031 1022 switch ( loadType()) {1032 switch (m_frame->loader()->loadType()) { 1023 1033 case FrameLoadTypeReload: 1024 1034 case FrameLoadTypeReloadFromOrigin: … … 1032 1042 case FrameLoadTypeRedirectWithLockedBackForwardList: 1033 1043 case FrameLoadTypeStandard: 1034 itemToRestore = m_current HistoryItem.get();1044 itemToRestore = m_currentItem.get(); 1035 1045 } 1036 1046 … … 1203 1213 } 1204 1214 1215 void HistoryController::setCurrentItem(HistoryItem* item) 1216 { 1217 m_currentItem = item; 1218 } 1219 1220 void HistoryController::setProvisionalItem(HistoryItem* item) 1221 { 1222 m_provisionalItem = item; 1223 } 1224 1205 1225 void FrameLoader::loadURLIntoChildFrame(const KURL& url, const String& referer, Frame* childFrame) 1206 1226 { 1207 1227 ASSERT(childFrame); 1208 1228 1209 HistoryItem* parentItem = currentHistoryItem();1229 HistoryItem* parentItem = history()->currentItem(); 1210 1230 FrameLoadType loadType = this->loadType(); 1211 1231 FrameLoadType childLoadType = FrameLoadTypeRedirectWithLockedBackForwardList; … … 1223 1243 workingURL = KURL(ParsedURLString, childItem->originalURLString()); 1224 1244 childLoadType = loadType; 1225 childFrame->loader()-> m_provisionalHistoryItem = childItem;1245 childFrame->loader()->history()->setProvisionalItem(childItem); 1226 1246 } 1227 1247 } … … 1547 1567 #endif 1548 1568 && !m_frame->document()->usingGeolocation() 1549 && m_currentHistoryItem1569 && history()->currentItem() 1550 1570 && !m_quickRedirectComing 1551 1571 && !m_documentLoader->isLoadingInAPISense() … … 1698 1718 if (m_frame->document()->usingGeolocation()) 1699 1719 { PCLOG(" -Frame uses Geolocation"); cannotCache = true; } 1700 if (! m_currentHistoryItem)1720 if (!history()->currentItem()) 1701 1721 { PCLOG(" -No current history item"); cannotCache = true; } 1702 1722 if (m_quickRedirectComing) … … 1776 1796 1777 1797 m_URL = url; 1778 updateHistoryForAnchorScroll();1798 history()->updateForAnchorScroll(); 1779 1799 1780 1800 // If we were in the autoscroll/panScroll mode we want to stop it before following the link to the anchor … … 2419 2439 // Check to see if we need to cache the page we are navigating away from into the back/forward cache. 2420 2440 // We are doing this here because we know for sure that a new page is about to be loaded. 2421 cachePageForHistoryItem( m_currentHistoryItem.get());2441 cachePageForHistoryItem(history()->currentItem()); 2422 2442 2423 2443 if (m_loadType != FrameLoadTypeReplace) … … 2453 2473 2454 2474 if (m_loadType == FrameLoadTypeStandard && m_documentLoader->isClientRedirect()) 2455 updateHistoryForClientRedirect();2475 history()->updateForClientRedirect(); 2456 2476 2457 2477 if (m_loadingFromCachedPage) { … … 2476 2496 } 2477 2497 2478 pageCache()->remove( m_currentHistoryItem.get());2498 pageCache()->remove(history()->currentItem()); 2479 2499 2480 2500 m_documentLoader->setPrimaryLoadComplete(true); … … 2494 2514 2495 2515 m_client->setCopiesOnScroll(); 2496 updateHistoryForCommit();2516 history()->updateForCommit(); 2497 2517 2498 2518 // The call to closeURL() invokes the unload event handler, which can execute arbitrary … … 2526 2546 if (Page* page = m_frame->page()) 2527 2547 if (page->backForwardList()) { 2528 updateHistoryForBackForwardNavigation();2548 history()->updateForBackForwardNavigation(); 2529 2549 2530 2550 // Create a document view for this document, or used the cached view. … … 2544 2564 case FrameLoadTypeSame: 2545 2565 case FrameLoadTypeReplace: 2546 updateHistoryForReload();2566 history()->updateForReload(); 2547 2567 m_client->transitionToCommittedForNewPage(); 2548 2568 break; 2549 2569 2550 2570 case FrameLoadTypeStandard: 2551 updateHistoryForStandardLoad();2571 history()->updateForStandardLoad(); 2552 2572 #ifndef BUILDING_ON_TIGER 2553 2573 // This code was originally added for a Leopard performance imporvement. We decided to … … 2560 2580 2561 2581 case FrameLoadTypeRedirectWithLockedBackForwardList: 2562 updateHistoryForRedirectWithLockedBackForwardList();2582 history()->updateForRedirectWithLockedBackForwardList(); 2563 2583 m_client->transitionToCommittedForNewPage(); 2564 2584 break; … … 2909 2929 if (Page* page = m_frame->page()) 2910 2930 if (isBackForwardLoadType(loadType()) && m_frame == page->mainFrame()) 2911 item = m_currentHistoryItem;2931 item = history()->currentItem(); 2912 2932 2913 2933 bool shouldReset = true; … … 2958 2978 if (Page* page = m_frame->page()) 2959 2979 if ((isBackForwardLoadType(m_loadType) || m_loadType == FrameLoadTypeReload || m_loadType == FrameLoadTypeReloadFromOrigin) && page->backForwardList()) 2960 restoreScrollPositionAndViewState();2980 history()->restoreScrollPositionAndViewState(); 2961 2981 2962 2982 if (m_creatingInitialEmptyDocument || !m_committedFirstRealDocumentLoad) … … 3019 3039 if (Page* page = m_frame->page()) 3020 3040 if (isBackForwardLoadType(m_loadType) && page->backForwardList()) 3021 restoreScrollPositionAndViewState();3041 history()->restoreScrollPositionAndViewState(); 3022 3042 3023 3043 m_firstLayoutDone = true; … … 3030 3050 } 3031 3051 3032 void FrameLoader::frameLoadCompleted() 3033 { 3034 // Note: Can be called multiple times. 3035 3036 m_client->frameLoadCompleted(); 3037 3052 void HistoryController::updateForFrameLoadCompleted() 3053 { 3038 3054 // Even if already complete, we might have set a previous item on a frame that 3039 3055 // didn't do any data loading on the past transaction. Make sure to clear these out. 3040 m_previousHistoryItem = 0; 3056 m_previousItem = 0; 3057 } 3058 3059 void FrameLoader::frameLoadCompleted() 3060 { 3061 // Note: Can be called multiple times. 3062 3063 m_client->frameLoadCompleted(); 3064 3065 history()->updateForFrameLoadCompleted(); 3041 3066 3042 3067 // After a canceled provisional load, firstLayoutDone is false. … … 3139 3164 closeURL(); 3140 3165 stopAllLoaders(); 3141 saveScrollPositionAndViewStateToItem(currentHistoryItem());3166 history()->saveScrollPositionAndViewStateToItem(history()->currentItem()); 3142 3167 detachChildren(); 3143 3168 … … 3381 3406 3382 3407 RefPtr<DocumentLoader> loader = activeDocumentLoader(); 3383 3408 3384 3409 if (isComplete) { 3385 3410 // FIXME: Don't want to do this if an entirely new load is going, so should check … … 3389 3414 handleFallbackContent(); 3390 3415 } 3391 3416 3392 3417 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) { 3393 3418 if (m_submittedFormURL == m_provisionalDocumentLoader->originalRequestCopy().url()) … … 3397 3422 // transitioned to the new page (before WebFrameState == commit). The goal here is to restore any state 3398 3423 // so that the existing view (that wenever got far enough to replace) can continue being used. 3399 invalidateCurrentItemCachedPage();3424 history()->invalidateCurrentItemCachedPage(); 3400 3425 3401 3426 // Call clientRedirectCancelledOrFinished here so that the frame load delegate is notified that the redirect's … … 3407 3432 clientRedirectCancelledOrFinished(false); 3408 3433 } 3409 3410 3434 3411 3435 loader->mainReceivedError(error, isComplete); 3412 3436 } … … 3442 3466 // but it's not an obvious case. 3443 3467 3444 addHistoryItemForFragmentScroll();3468 history()->updateBackForwardListForFragmentScroll(); 3445 3469 } 3446 3470 … … 3491 3515 ASSERT(m_policyDocumentLoader || !m_provisionalDocumentLoader->unreachableURL().isEmpty()); 3492 3516 3493 bool isTargetItem = m_provisionalHistoryItem ? m_provisionalHistoryItem->isTargetItem() : false;3517 bool isTargetItem = history()->provisionalItem() ? history()->provisionalItem()->isTargetItem() : false; 3494 3518 3495 3519 // Two reasons we can't continue: … … 3514 3538 if (Page* page = m_frame->page()) { 3515 3539 Frame* mainFrame = page->mainFrame(); 3516 if (HistoryItem* resetItem = mainFrame->loader()-> m_currentHistoryItem.get()) {3540 if (HistoryItem* resetItem = mainFrame->loader()->history()->currentItem()) { 3517 3541 page->backForwardList()->goToItem(resetItem); 3518 3542 Settings* settings = m_frame->settings(); … … 3671 3695 } 3672 3696 3673 void FrameLoader::addHistoryItemForFragmentScroll()3674 { 3675 addBackForwardItemClippedAtTarget(false);3697 void HistoryController::updateBackForwardListForFragmentScroll() 3698 { 3699 updateBackForwardListClippedAtTarget(false); 3676 3700 } 3677 3701 3678 3702 bool FrameLoader::loadProvisionalItemFromCachedPage() 3679 3703 { 3680 RefPtr<CachedPage> cachedPage = pageCache()->get( m_provisionalHistoryItem.get());3704 RefPtr<CachedPage> cachedPage = pageCache()->get(history()->provisionalItem()); 3681 3705 if (!cachedPage || !cachedPage->document()) 3682 3706 return false; … … 3722 3746 bool FrameLoader::shouldTreatURLAsSameAsCurrent(const KURL& url) const 3723 3747 { 3724 if (! m_currentHistoryItem)3748 if (!history()->currentItem()) 3725 3749 return false; 3726 return url == m_currentHistoryItem->url() || url == m_currentHistoryItem->originalURL();3727 } 3728 3729 PassRefPtr<HistoryItem> FrameLoader::createHistoryItem(bool useOriginal)3730 { 3731 DocumentLoader* docLoader = documentLoader();3750 return url == history()->currentItem()->url() || url == history()->currentItem()->originalURL(); 3751 } 3752 3753 PassRefPtr<HistoryItem> HistoryController::createItem(bool useOriginal) 3754 { 3755 DocumentLoader* docLoader = m_frame->loader()->documentLoader(); 3732 3756 3733 3757 KURL unreachableURL = docLoader ? docLoader->unreachableURL() : KURL(); … … 3778 3802 3779 3803 // Set the item for which we will save document state 3780 m_previous HistoryItem = m_currentHistoryItem;3781 m_current HistoryItem = item;3804 m_previousItem = m_currentItem; 3805 m_currentItem = item; 3782 3806 3783 3807 return item.release(); 3784 3808 } 3785 3786 void FrameLoader::addBackForwardItemClippedAtTarget(bool doClip) 3809 3810 void FrameLoader::checkDidPerformFirstNavigation() 3811 { 3812 Page* page = m_frame->page(); 3813 if (!page) 3814 return; 3815 3816 if (!m_didPerformFirstNavigation && page->backForwardList()->entries().size() == 1) { 3817 m_didPerformFirstNavigation = true; 3818 m_client->didPerformFirstNavigation(); 3819 } 3820 } 3821 3822 void HistoryController::updateBackForwardListClippedAtTarget(bool doClip) 3787 3823 { 3788 3824 // In the case of saving state about a page with frames, we store a tree of items that mirrors the frame tree. … … 3795 3831 return; 3796 3832 3797 if ( documentLoader()->urlForHistory().isEmpty())3833 if (m_frame->loader()->documentLoader()->urlForHistory().isEmpty()) 3798 3834 return; 3799 3835 … … 3802 3838 FrameLoader* frameLoader = mainFrame->loader(); 3803 3839 3804 if (!frameLoader->m_didPerformFirstNavigation && page->backForwardList()->entries().size() == 1) { 3805 frameLoader->m_didPerformFirstNavigation = true; 3806 m_client->didPerformFirstNavigation(); 3807 } 3808 3809 RefPtr<HistoryItem> item = frameLoader->createHistoryItemTree(m_frame, doClip); 3810 LOG(BackForward, "WebCoreBackForward - Adding backforward item %p for frame %s", item.get(), documentLoader()->url().string().ascii().data()); 3840 frameLoader->checkDidPerformFirstNavigation(); 3841 3842 RefPtr<HistoryItem> item = frameLoader->history()->createItemTree(m_frame, doClip); 3843 LOG(BackForward, "WebCoreBackForward - Adding backforward item %p for frame %s", item.get(), m_frame->loader()->documentLoader()->url().string().ascii().data()); 3811 3844 page->backForwardList()->addItem(item); 3812 3845 } 3813 3846 3814 PassRefPtr<HistoryItem> FrameLoader::createHistoryItemTree(Frame* targetFrame, bool clipAtTarget)3815 { 3816 RefPtr<HistoryItem> bfItem = create HistoryItem(m_frame->tree()->parent() ? true : false);3817 if (m_previous HistoryItem)3818 saveScrollPositionAndViewStateToItem(m_previous HistoryItem.get());3847 PassRefPtr<HistoryItem> HistoryController::createItemTree(Frame* targetFrame, bool clipAtTarget) 3848 { 3849 RefPtr<HistoryItem> bfItem = createItem(m_frame->tree()->parent() ? true : false); 3850 if (m_previousItem) 3851 saveScrollPositionAndViewStateToItem(m_previousItem.get()); 3819 3852 if (!(clipAtTarget && m_frame == targetFrame)) { 3820 3853 // save frame state for items that aren't loading (khtml doesn't save those) … … 3823 3856 FrameLoader* childLoader = child->loader(); 3824 3857 bool hasChildLoaded = childLoader->frameHasLoaded(); 3825 3858 3826 3859 // If the child is a frame corresponding to an <object> element that never loaded, 3827 3860 // we don't want to create a history item, because that causes fallback content … … 3829 3862 3830 3863 if (!(!hasChildLoaded && childLoader->isHostedByObjectElement())) 3831 bfItem->addChildItem(childLoader-> createHistoryItemTree(targetFrame, clipAtTarget));3864 bfItem->addChildItem(childLoader->history()->createItemTree(targetFrame, clipAtTarget)); 3832 3865 } 3833 3866 } … … 3845 3878 } 3846 3879 3847 void FrameLoader::saveScrollPositionAndViewStateToItem(HistoryItem* item)3880 void HistoryController::saveScrollPositionAndViewStateToItem(HistoryItem* item) 3848 3881 { 3849 3882 if (!item || !m_frame->view()) … … 3852 3885 item->setScrollPoint(m_frame->view()->scrollPosition()); 3853 3886 // FIXME: It would be great to work out a way to put this code in WebCore instead of calling through to the client. 3854 m_ client->saveViewStateToItem(item);3887 m_frame->loader()->client()->saveViewStateToItem(item); 3855 3888 } 3856 3889 … … 3866 3899 fails. We then successfully restore it when the layout happens. 3867 3900 */ 3868 void FrameLoader::restoreScrollPositionAndViewState()3869 { 3870 if (!m_ committedFirstRealDocumentLoad)3871 return; 3872 3873 ASSERT(m_current HistoryItem);3901 void HistoryController::restoreScrollPositionAndViewState() 3902 { 3903 if (!m_frame->loader()->committedFirstRealDocumentLoad()) 3904 return; 3905 3906 ASSERT(m_currentItem); 3874 3907 3875 3908 // FIXME: As the ASSERT attests, it seems we should always have a currentItem here. … … 3878 3911 // early and from a user standpoint - as in the above radar - the previous page load failed 3879 3912 // so there *is* no scroll or view state to restore! 3880 if (!m_current HistoryItem)3913 if (!m_currentItem) 3881 3914 return; 3882 3915 3883 3916 // FIXME: It would be great to work out a way to put this code in WebCore instead of calling 3884 3917 // through to the client. It's currently used only for the PDF view on Mac. 3885 m_ client->restoreViewState();3918 m_frame->loader()->client()->restoreViewState(); 3886 3919 3887 3920 if (FrameView* view = m_frame->view()) 3888 3921 if (!view->wasScrolledByUser()) 3889 view->setScrollPosition(m_current HistoryItem->scrollPoint());3890 } 3891 3892 void FrameLoader::invalidateCurrentItemCachedPage()3922 view->setScrollPosition(m_currentItem->scrollPoint()); 3923 } 3924 3925 void HistoryController::invalidateCurrentItemCachedPage() 3893 3926 { 3894 3927 // When we are pre-commit, the currentItem is where the pageCache data resides 3895 CachedPage* cachedPage = pageCache()->get( m_currentHistoryItem.get());3928 CachedPage* cachedPage = pageCache()->get(currentItem()); 3896 3929 3897 3930 // FIXME: This is a grotesque hack to fix <rdar://problem/4059059> Crash in RenderFlow::detach … … 3906 3939 3907 3940 if (cachedPage) 3908 pageCache()->remove(m_currentHistoryItem.get()); 3909 } 3910 3911 void FrameLoader::saveDocumentState() 3912 { 3913 if (m_creatingInitialEmptyDocument) 3941 pageCache()->remove(currentItem()); 3942 } 3943 3944 void HistoryController::saveDocumentState() 3945 { 3946 // FIXME: Reading this bit of FrameLoader state here is unfortunate. I need to study 3947 // this more to see if we can remove this dependency. 3948 if (m_frame->loader()->creatingInitialEmptyDocument()) 3914 3949 return; 3915 3950 … … 3925 3960 // checkLoadComplete recursion to achieve this goal. 3926 3961 3927 HistoryItem* item = m_previous HistoryItem ? m_previousHistoryItem.get() : m_currentHistoryItem.get();3962 HistoryItem* item = m_previousItem ? m_previousItem.get() : m_currentItem.get(); 3928 3963 if (!item) 3929 3964 return; … … 3939 3974 3940 3975 // Loads content into this frame, as specified by history item 3976 // FIXME: This function should really be split into a couple pieces, some of 3977 // which should be methods of HistoryController and some of which should be 3978 // methods of FrameLoader. 3941 3979 void FrameLoader::loadItem(HistoryItem* item, FrameLoadType loadType) 3942 3980 { … … 3957 3995 // We also do not do anchor-style navigation if we're posting a form or navigating from 3958 3996 // a page that was resulted from a form post. 3959 bool shouldScroll = !formData && !( m_currentHistoryItem && m_currentHistoryItem->formData()) &&urlsMatchItem(item);3997 bool shouldScroll = !formData && !(history()->currentItem() && history()->currentItem()->formData()) && history()->urlsMatchItem(item); 3960 3998 3961 3999 #if ENABLE(WML) … … 3967 4005 if (shouldScroll) { 3968 4006 // Must do this maintenance here, since we don't go through a real page reload 3969 saveScrollPositionAndViewStateToItem(m_currentHistoryItem.get());4007 history()->saveScrollPositionAndViewStateToItem(history()->currentItem()); 3970 4008 3971 4009 if (FrameView* view = m_frame->view()) 3972 4010 view->setWasScrolledByUser(false); 3973 4011 3974 m_currentHistoryItem = item;4012 history()->setCurrentItem(item); 3975 4013 3976 4014 // FIXME: Form state might need to be saved here too. … … 3981 4019 3982 4020 // must do this maintenance here, since we don't go through a real page reload 3983 restoreScrollPositionAndViewState();4021 history()->restoreScrollPositionAndViewState(); 3984 4022 3985 4023 // Fake the URL change by updating the data source's request. This will no longer … … 3993 4031 } else { 3994 4032 // Remember this item so we can traverse any child items as child frames load 3995 m_provisionalHistoryItem = item;4033 history()->setProvisionalItem(item); 3996 4034 3997 4035 bool inPageCache = false; … … 4010 4048 inPageCache = true; 4011 4049 } else { 4012 LOG(PageCache, "Not restoring page for %s from back/forward cache because cache entry has expired", m_provisionalHistoryItem->url().string().ascii().data());4050 LOG(PageCache, "Not restoring page for %s from back/forward cache because cache entry has expired", history()->provisionalItem()->url().string().ascii().data()); 4013 4051 pageCache()->remove(item); 4014 4052 } … … 4086 4124 4087 4125 // Walk the frame tree and ensure that the URLs match the URLs in the item. 4088 bool FrameLoader::urlsMatchItem(HistoryItem* item) const4089 { 4090 const KURL& currentURL = documentLoader()->url();4126 bool HistoryController::urlsMatchItem(HistoryItem* item) const 4127 { 4128 const KURL& currentURL = m_frame->loader()->documentLoader()->url(); 4091 4129 if (!equalIgnoringFragmentIdentifier(currentURL, item->url())) 4092 4130 return false; … … 4097 4135 for (unsigned i = 0; i < size; ++i) { 4098 4136 Frame* childFrame = m_frame->tree()->child(childItems[i]->target()); 4099 if (childFrame && !childFrame->loader()-> urlsMatchItem(childItems[i].get()))4137 if (childFrame && !childFrame->loader()->history()->urlsMatchItem(childItems[i].get())) 4100 4138 return false; 4101 4139 } … … 4106 4144 // Main funnel for navigating to a previous location (back/forward, non-search snap-back) 4107 4145 // This includes recursion to handle loading into framesets properly 4108 void FrameLoader::goToItem(HistoryItem* targetItem, FrameLoadType type)4146 void HistoryController::goToItem(HistoryItem* targetItem, FrameLoadType type) 4109 4147 { 4110 4148 ASSERT(!m_frame->tree()->parent()); … … 4117 4155 if (!page) 4118 4156 return; 4119 if (!m_ client->shouldGoToHistoryItem(targetItem))4157 if (!m_frame->loader()->client()->shouldGoToHistoryItem(targetItem)) 4120 4158 return; 4121 4159 … … 4135 4173 // a match (by URL), we just restore scroll position and recurse. Otherwise we must 4136 4174 // reload that frame, and all its kids. 4137 void FrameLoader::recursiveGoToItem(HistoryItem* item, HistoryItem* fromItem, FrameLoadType type)4175 void HistoryController::recursiveGoToItem(HistoryItem* item, HistoryItem* fromItem, FrameLoadType type) 4138 4176 { 4139 4177 ASSERT(item); 4140 4178 ASSERT(fromItem); 4141 4179 4142 4180 KURL itemURL = item->url(); 4143 4181 KURL currentURL; 4144 if ( documentLoader())4145 currentURL = documentLoader()->url();4146 4182 if (m_frame->loader()->documentLoader()) 4183 currentURL = m_frame->loader()->documentLoader()->url(); 4184 4147 4185 // Always reload the target frame of the item we're going to. This ensures that we will 4148 4186 // do -some- load for the transition, which means a proper notification will be posted … … 4158 4196 // This content is good, so leave it alone and look for children that need reloading 4159 4197 // Save form state (works from currentItem, since prevItem is nil) 4160 ASSERT(!m_previous HistoryItem);4198 ASSERT(!m_previousItem); 4161 4199 saveDocumentState(); 4162 saveScrollPositionAndViewStateToItem(m_current HistoryItem.get());4200 saveScrollPositionAndViewStateToItem(m_currentItem.get()); 4163 4201 4164 4202 if (FrameView* view = m_frame->view()) 4165 4203 view->setWasScrolledByUser(false); 4166 4204 4167 m_current HistoryItem = item;4205 m_currentItem = item; 4168 4206 4169 4207 // Restore form state (works from currentItem) … … 4182 4220 Frame* childFrame = m_frame->tree()->child(childFrameName); 4183 4221 ASSERT(childFrame); 4184 childFrame->loader()-> recursiveGoToItem(childItems[i].get(), fromChildItem, type);4222 childFrame->loader()->history()->recursiveGoToItem(childItems[i].get(), fromChildItem, type); 4185 4223 } 4186 4224 } else { 4187 loadItem(item, type);4225 m_frame->loader()->loadItem(item, type); 4188 4226 } 4189 4227 } … … 4191 4229 // helper method that determines whether the subframes described by the item's subitems 4192 4230 // match our own current frameset 4193 bool FrameLoader::childFramesMatchItem(HistoryItem* item) const4231 bool HistoryController::childFramesMatchItem(HistoryItem* item) const 4194 4232 { 4195 4233 const HistoryItemVector& childItems = item->children(); … … 4209 4247 // There are 3 things you might think of as "history", all of which are handled by these functions. 4210 4248 // 4211 // 1) Back/forward: The m_current HistoryItem is part of this mechanism.4249 // 1) Back/forward: The m_currentItem is part of this mechanism. 4212 4250 // 2) Global history: Handled by the client. 4213 4251 // 3) Visited links: Handled by the PageGroup. 4214 4252 4215 void FrameLoader::updateHistoryForStandardLoad() 4216 { 4217 LOG(History, "WebCoreHistory: Updating History for Standard Load in frame %s", documentLoader()->url().string().ascii().data()); 4253 void HistoryController::updateForStandardLoad() 4254 { 4255 LOG(History, "WebCoreHistory: Updating History for Standard Load in frame %s", m_frame->loader()->documentLoader()->url().string().ascii().data()); 4256 4257 FrameLoader* frameLoader = m_frame->loader(); 4218 4258 4219 4259 Settings* settings = m_frame->settings(); 4220 4260 bool needPrivacy = !settings || settings->privateBrowsingEnabled(); 4221 const KURL& historyURL = documentLoader()->urlForHistory();4222 4223 if (! documentLoader()->isClientRedirect()) {4261 const KURL& historyURL = frameLoader->documentLoader()->urlForHistory(); 4262 4263 if (!frameLoader->documentLoader()->isClientRedirect()) { 4224 4264 if (!historyURL.isEmpty()) { 4225 addBackForwardItemClippedAtTarget(true);4265 updateBackForwardListClippedAtTarget(true); 4226 4266 if (!needPrivacy) { 4227 m_client->updateGlobalHistory();4228 m_documentLoader->setDidCreateGlobalHistoryEntry(true);4229 if ( m_documentLoader->unreachableURL().isEmpty())4230 m_client->updateGlobalHistoryRedirectLinks();4267 frameLoader->client()->updateGlobalHistory(); 4268 frameLoader->documentLoader()->setDidCreateGlobalHistoryEntry(true); 4269 if (frameLoader->documentLoader()->unreachableURL().isEmpty()) 4270 frameLoader->client()->updateGlobalHistoryRedirectLinks(); 4231 4271 } 4232 4272 if (Page* page = m_frame->page()) 4233 4273 page->setGlobalHistoryItem(needPrivacy ? 0 : page->backForwardList()->currentItem()); 4234 4274 } 4235 } else if ( documentLoader()->unreachableURL().isEmpty() && m_currentHistoryItem) {4236 m_current HistoryItem->setURL(documentLoader()->url());4237 m_current HistoryItem->setFormInfoFromRequest(documentLoader()->request());4275 } else if (frameLoader->documentLoader()->unreachableURL().isEmpty() && m_currentItem) { 4276 m_currentItem->setURL(frameLoader->documentLoader()->url()); 4277 m_currentItem->setFormInfoFromRequest(frameLoader->documentLoader()->request()); 4238 4278 } 4239 4279 … … 4242 4282 page->group().addVisitedLink(historyURL); 4243 4283 4244 if (! m_documentLoader->didCreateGlobalHistoryEntry() && documentLoader()->unreachableURL().isEmpty() && !url().isEmpty())4245 m_client->updateGlobalHistoryRedirectLinks();4246 } 4247 } 4248 4249 void FrameLoader::updateHistoryForClientRedirect()4284 if (!frameLoader->documentLoader()->didCreateGlobalHistoryEntry() && frameLoader->documentLoader()->unreachableURL().isEmpty() && !frameLoader->url().isEmpty()) 4285 frameLoader->client()->updateGlobalHistoryRedirectLinks(); 4286 } 4287 } 4288 4289 void HistoryController::updateForClientRedirect() 4250 4290 { 4251 4291 #if !LOG_DISABLED 4252 if ( documentLoader())4253 LOG(History, "WebCoreHistory: Updating History for client redirect in frame %s", documentLoader()->title().utf8().data());4292 if (m_frame->loader()->documentLoader()) 4293 LOG(History, "WebCoreHistory: Updating History for client redirect in frame %s", m_frame->loader()->documentLoader()->title().utf8().data()); 4254 4294 #endif 4255 4295 4256 4296 // Clear out form data so we don't try to restore it into the incoming page. Must happen after 4257 4297 // webcore has closed the URL and saved away the form state. 4258 if (m_current HistoryItem) {4259 m_current HistoryItem->clearDocumentState();4260 m_current HistoryItem->clearScrollPoint();4298 if (m_currentItem) { 4299 m_currentItem->clearDocumentState(); 4300 m_currentItem->clearScrollPoint(); 4261 4301 } 4262 4302 4263 4303 Settings* settings = m_frame->settings(); 4264 4304 bool needPrivacy = !settings || settings->privateBrowsingEnabled(); 4265 const KURL& historyURL = documentLoader()->urlForHistory();4305 const KURL& historyURL = m_frame->loader()->documentLoader()->urlForHistory(); 4266 4306 4267 4307 if (!historyURL.isEmpty() && !needPrivacy) { … … 4271 4311 } 4272 4312 4273 void FrameLoader::updateHistoryForBackForwardNavigation()4313 void HistoryController::updateForBackForwardNavigation() 4274 4314 { 4275 4315 #if !LOG_DISABLED 4276 if ( documentLoader())4277 LOG(History, "WebCoreHistory: Updating History for back/forward navigation in frame %s", documentLoader()->title().utf8().data());4316 if (m_frame->loader()->documentLoader()) 4317 LOG(History, "WebCoreHistory: Updating History for back/forward navigation in frame %s", m_frame->loader()->documentLoader()->title().utf8().data()); 4278 4318 #endif 4279 4319 4280 4320 // Must grab the current scroll position before disturbing it 4281 saveScrollPositionAndViewStateToItem(m_previous HistoryItem.get());4282 } 4283 4284 void FrameLoader::updateHistoryForReload()4321 saveScrollPositionAndViewStateToItem(m_previousItem.get()); 4322 } 4323 4324 void HistoryController::updateForReload() 4285 4325 { 4286 4326 #if !LOG_DISABLED 4287 if ( documentLoader())4288 LOG(History, "WebCoreHistory: Updating History for reload in frame %s", documentLoader()->title().utf8().data());4327 if (m_frame->loader()->documentLoader()) 4328 LOG(History, "WebCoreHistory: Updating History for reload in frame %s", m_frame->loader()->documentLoader()->title().utf8().data()); 4289 4329 #endif 4290 4330 4291 if (m_current HistoryItem) {4292 pageCache()->remove(m_current HistoryItem.get());4293 4294 if ( loadType() == FrameLoadTypeReload ||loadType() == FrameLoadTypeReloadFromOrigin)4295 saveScrollPositionAndViewStateToItem(m_current HistoryItem.get());4331 if (m_currentItem) { 4332 pageCache()->remove(m_currentItem.get()); 4333 4334 if (m_frame->loader()->loadType() == FrameLoadTypeReload || m_frame->loader()->loadType() == FrameLoadTypeReloadFromOrigin) 4335 saveScrollPositionAndViewStateToItem(m_currentItem.get()); 4296 4336 4297 4337 // Sometimes loading a page again leads to a different result because of cookies. Bugzilla 4072 4298 if ( documentLoader()->unreachableURL().isEmpty())4299 m_current HistoryItem->setURL(documentLoader()->requestURL());4300 } 4301 } 4302 4303 void FrameLoader::updateHistoryForRedirectWithLockedBackForwardList()4338 if (m_frame->loader()->documentLoader()->unreachableURL().isEmpty()) 4339 m_currentItem->setURL(m_frame->loader()->documentLoader()->requestURL()); 4340 } 4341 } 4342 4343 void HistoryController::updateForRedirectWithLockedBackForwardList() 4304 4344 { 4305 4345 #if !LOG_DISABLED 4306 if ( documentLoader())4307 LOG(History, "WebCoreHistory: Updating History for redirect load in frame %s", documentLoader()->title().utf8().data());4346 if (m_frame->loader()->documentLoader()) 4347 LOG(History, "WebCoreHistory: Updating History for redirect load in frame %s", m_frame->loader()->documentLoader()->title().utf8().data()); 4308 4348 #endif 4309 4349 4310 4350 Settings* settings = m_frame->settings(); 4311 4351 bool needPrivacy = !settings || settings->privateBrowsingEnabled(); 4312 const KURL& historyURL = documentLoader()->urlForHistory();4313 4314 if ( documentLoader()->isClientRedirect()) {4315 if (!m_current HistoryItem && !m_frame->tree()->parent()) {4352 const KURL& historyURL = m_frame->loader()->documentLoader()->urlForHistory(); 4353 4354 if (m_frame->loader()->documentLoader()->isClientRedirect()) { 4355 if (!m_currentItem && !m_frame->tree()->parent()) { 4316 4356 if (!historyURL.isEmpty()) { 4317 addBackForwardItemClippedAtTarget(true);4357 updateBackForwardListClippedAtTarget(true); 4318 4358 if (!needPrivacy) { 4319 m_ client->updateGlobalHistory();4320 m_ documentLoader->setDidCreateGlobalHistoryEntry(true);4321 if (m_ documentLoader->unreachableURL().isEmpty())4322 m_ client->updateGlobalHistoryRedirectLinks();4359 m_frame->loader()->client()->updateGlobalHistory(); 4360 m_frame->loader()->documentLoader()->setDidCreateGlobalHistoryEntry(true); 4361 if (m_frame->loader()->documentLoader()->unreachableURL().isEmpty()) 4362 m_frame->loader()->client()->updateGlobalHistoryRedirectLinks(); 4323 4363 } 4324 4364 if (Page* page = m_frame->page()) … … 4326 4366 } 4327 4367 } 4328 if (m_current HistoryItem) {4329 m_current HistoryItem->setURL(documentLoader()->url());4330 m_current HistoryItem->setFormInfoFromRequest(documentLoader()->request());4368 if (m_currentItem) { 4369 m_currentItem->setURL(m_frame->loader()->documentLoader()->url()); 4370 m_currentItem->setFormInfoFromRequest(m_frame->loader()->documentLoader()->request()); 4331 4371 } 4332 4372 } else { 4333 4373 Frame* parentFrame = m_frame->tree()->parent(); 4334 if (parentFrame && parentFrame->loader()-> m_currentHistoryItem)4335 parentFrame->loader()-> m_currentHistoryItem->setChildItem(createHistoryItem(true));4374 if (parentFrame && parentFrame->loader()->history()->m_currentItem) 4375 parentFrame->loader()->history()->m_currentItem->setChildItem(createItem(true)); 4336 4376 } 4337 4377 … … 4340 4380 page->group().addVisitedLink(historyURL); 4341 4381 4342 if (!m_documentLoader->didCreateGlobalHistoryEntry() && documentLoader()->unreachableURL().isEmpty() && !url().isEmpty()) 4343 m_client->updateGlobalHistoryRedirectLinks(); 4344 } 4345 } 4346 4347 void FrameLoader::updateHistoryForCommit() 4348 { 4382 if (!m_frame->loader()->documentLoader()->didCreateGlobalHistoryEntry() && m_frame->loader()->documentLoader()->unreachableURL().isEmpty() && !m_frame->loader()->url().isEmpty()) 4383 m_frame->loader()->client()->updateGlobalHistoryRedirectLinks(); 4384 } 4385 } 4386 4387 void HistoryController::updateForCommit() 4388 { 4389 FrameLoader* frameLoader = m_frame->loader(); 4349 4390 #if !LOG_DISABLED 4350 if ( documentLoader())4351 LOG(History, "WebCoreHistory: Updating History for commit in frame %s", documentLoader()->title().utf8().data());4391 if (frameLoader->documentLoader()) 4392 LOG(History, "WebCoreHistory: Updating History for commit in frame %s", frameLoader->documentLoader()->title().utf8().data()); 4352 4393 #endif 4353 FrameLoadType type = loadType();4394 FrameLoadType type = frameLoader->loadType(); 4354 4395 if (isBackForwardLoadType(type) || 4355 ((type == FrameLoadTypeReload || type == FrameLoadTypeReloadFromOrigin) && ! provisionalDocumentLoader()->unreachableURL().isEmpty())) {4396 ((type == FrameLoadTypeReload || type == FrameLoadTypeReloadFromOrigin) && !frameLoader->provisionalDocumentLoader()->unreachableURL().isEmpty())) { 4356 4397 // Once committed, we want to use current item for saving DocState, and 4357 4398 // the provisional item for restoring state. 4358 4399 // Note previousItem must be set before we close the URL, which will 4359 4400 // happen when the data source is made non-provisional below 4360 m_previous HistoryItem = m_currentHistoryItem;4361 ASSERT(m_provisional HistoryItem);4362 m_current HistoryItem = m_provisionalHistoryItem;4363 m_provisional HistoryItem = 0;4364 } 4365 } 4366 4367 void FrameLoader::updateHistoryForAnchorScroll()4368 { 4369 if (m_ URL.isEmpty())4401 m_previousItem = m_currentItem; 4402 ASSERT(m_provisionalItem); 4403 m_currentItem = m_provisionalItem; 4404 m_provisionalItem = 0; 4405 } 4406 } 4407 4408 void HistoryController::updateForAnchorScroll() 4409 { 4410 if (m_frame->loader()->url().isEmpty()) 4370 4411 return; 4371 4412 … … 4378 4419 return; 4379 4420 4380 page->group().addVisitedLink(m_ URL);4421 page->group().addVisitedLink(m_frame->loader()->url()); 4381 4422 } 4382 4423 4383 4424 // Walk the frame tree, telling all frames to save their form state into their current 4384 4425 // history item. 4385 void FrameLoader::saveDocumentAndScrollState()4426 void HistoryController::saveDocumentAndScrollState() 4386 4427 { 4387 4428 for (Frame* frame = m_frame; frame; frame = frame->tree()->traverseNext(m_frame)) { 4388 frame->loader()->saveDocumentState(); 4389 frame->loader()->saveScrollPositionAndViewStateToItem(frame->loader()->currentHistoryItem()); 4390 } 4391 } 4392 4393 HistoryItem* FrameLoader::currentHistoryItem() 4394 { 4395 return m_currentHistoryItem.get(); 4396 } 4397 4398 void FrameLoader::setCurrentHistoryItem(PassRefPtr<HistoryItem> item) 4399 { 4400 m_currentHistoryItem = item; 4429 frame->loader()->history()->saveDocumentState(); 4430 frame->loader()->history()->saveScrollPositionAndViewStateToItem(frame->loader()->history()->currentItem()); 4431 } 4401 4432 } 4402 4433 … … 4538 4569 } 4539 4570 4571 void HistoryController::setCurrentItemTitle(const String& title) 4572 { 4573 if (m_currentItem) 4574 m_currentItem->setTitle(title); 4575 } 4576 4540 4577 void FrameLoader::didChangeTitle(DocumentLoader* loader) 4541 4578 { … … 4544 4581 if (loader == m_documentLoader) { 4545 4582 // Must update the entries in the back-forward list too. 4546 if (m_currentHistoryItem) 4547 m_currentHistoryItem->setTitle(loader->title()); 4583 history()->setCurrentItemTitle(loader->title()); 4548 4584 // This must go through the WebFrame because it has the right notion of the current b/f item. 4549 4585 m_client->setTitle(loader->title(), loader->urlForHistory()); -
trunk/WebCore/loader/FrameLoader.h
r49372 r49413 80 80 bool isBackForwardLoadType(FrameLoadType); 81 81 82 class HistoryController : public Noncopyable { 83 public: 84 HistoryController(Frame*); 85 ~HistoryController(); 86 87 void saveScrollPositionAndViewStateToItem(HistoryItem*); 88 void restoreScrollPositionAndViewState(); 89 90 void updateBackForwardListForFragmentScroll(); 91 92 void saveDocumentState(); 93 void saveDocumentAndScrollState(); 94 void restoreDocumentState(); 95 96 void invalidateCurrentItemCachedPage(); 97 98 void goToItem(HistoryItem*, FrameLoadType); 99 bool urlsMatchItem(HistoryItem*) const; 100 101 void updateForBackForwardNavigation(); 102 void updateForReload(); 103 void updateForStandardLoad(); 104 void updateForRedirectWithLockedBackForwardList(); 105 void updateForClientRedirect(); 106 void updateForCommit(); 107 void updateForAnchorScroll(); 108 void updateForFrameLoadCompleted(); 109 110 HistoryItem* currentItem() const { return m_currentItem.get(); } 111 void setCurrentItem(HistoryItem*); 112 void setCurrentItemTitle(const String&); 113 114 HistoryItem* provisionalItem() const { return m_provisionalItem.get(); } 115 void setProvisionalItem(HistoryItem*); 116 117 private: 118 PassRefPtr<HistoryItem> createItem(bool useOriginal); 119 PassRefPtr<HistoryItem> createItemTree(Frame* targetFrame, bool clipAtTarget); 120 121 void recursiveGoToItem(HistoryItem*, HistoryItem*, FrameLoadType); 122 bool childFramesMatchItem(HistoryItem*) const; 123 void updateBackForwardListClippedAtTarget(bool doClip); 124 125 Frame* m_frame; 126 127 RefPtr<HistoryItem> m_currentItem; 128 RefPtr<HistoryItem> m_previousItem; 129 RefPtr<HistoryItem> m_provisionalItem; 130 }; 131 82 132 class FrameLoader : public Noncopyable { 83 133 public: … … 89 139 Frame* frame() const { return m_frame; } 90 140 91 PolicyChecker* policyChecker() { return &m_policyChecker; } 141 PolicyChecker* policyChecker() const { return &m_policyChecker; } 142 HistoryController* history() const { return &m_history; } 92 143 93 144 // FIXME: This is not cool, people. There are too many different functions that all start loads. … … 256 307 void dispatchWindowObjectAvailable(); 257 308 void dispatchDocumentElementAvailable(); 258 void restoreDocumentState();259 309 260 310 // Mixed content related functions. … … 287 337 void checkCompleted(); 288 338 339 void checkDidPerformFirstNavigation(); 340 289 341 bool isComplete() const; 290 342 … … 301 353 bool isLoadingFromCachedPage() const { return m_loadingFromCachedPage; } 302 354 303 void goToItem(HistoryItem*, FrameLoadType);304 void saveDocumentAndScrollState();305 306 HistoryItem* currentHistoryItem();307 void setCurrentHistoryItem(PassRefPtr<HistoryItem>);308 309 355 bool committingFirstRealLoad() const { return !m_creatingInitialEmptyDocument && !m_committedFirstRealDocumentLoad; } 310 356 bool committedFirstRealDocumentLoad() const { return m_committedFirstRealDocumentLoad; } 357 bool creatingInitialEmptyDocument() const { return m_creatingInitialEmptyDocument; } 311 358 312 359 void iconLoadDecisionAvailable(); … … 329 376 void clientRedirected(const KURL&, double delay, double fireDate, bool lockBackForwardList); 330 377 void clientRedirectCancelledOrFinished(bool cancelWithLoadInProgress); 378 void loadItem(HistoryItem*, FrameLoadType); 331 379 332 380 // FIXME: This is public because this asynchronous callback from the FrameLoaderClient … … 336 384 337 385 private: 338 PassRefPtr<HistoryItem> createHistoryItem(bool useOriginal);339 PassRefPtr<HistoryItem> createHistoryItemTree(Frame* targetFrame, bool clipAtTarget);340 341 386 bool canCachePageContainingThisFrame(); 342 387 #ifndef NDEBUG … … 344 389 bool logCanCacheFrameDecision(int indentLevel); 345 390 #endif 346 347 void addBackForwardItemClippedAtTarget(bool doClip);348 void restoreScrollPositionAndViewState();349 void saveDocumentState();350 void loadItem(HistoryItem*, FrameLoadType);351 bool urlsMatchItem(HistoryItem*) const;352 void invalidateCurrentItemCachedPage();353 void recursiveGoToItem(HistoryItem*, HistoryItem*, FrameLoadType);354 bool childFramesMatchItem(HistoryItem*) const;355 356 void updateHistoryForBackForwardNavigation();357 void updateHistoryForReload();358 void updateHistoryForStandardLoad();359 void updateHistoryForRedirectWithLockedBackForwardList();360 void updateHistoryForClientRedirect();361 void updateHistoryForCommit();362 void updateHistoryForAnchorScroll();363 391 364 392 void checkTimerFired(Timer<FrameLoader>*); … … 402 430 403 431 bool shouldScrollToAnchor(bool isFormSubmission, FrameLoadType, const KURL&); 404 void addHistoryItemForFragmentScroll();405 432 406 433 void checkLoadCompleteForThisFrame(); … … 468 495 bool shouldTreatURLAsSameAsCurrent(const KURL&) const; 469 496 470 void saveScrollPositionAndViewStateToItem(HistoryItem*);471 472 497 Frame* m_frame; 473 498 FrameLoaderClient* m_client; 474 499 475 PolicyChecker m_policyChecker; 500 mutable PolicyChecker m_policyChecker; 501 mutable HistoryController m_history; 476 502 477 503 FrameState m_state; … … 535 561 bool m_committedFirstRealDocumentLoad; 536 562 537 RefPtr<HistoryItem> m_currentHistoryItem;538 RefPtr<HistoryItem> m_previousHistoryItem;539 RefPtr<HistoryItem> m_provisionalHistoryItem;540 541 563 bool m_didPerformFirstNavigation; 542 564 bool m_loadingFromCachedPage; -
trunk/WebCore/page/Page.cpp
r49385 r49413 292 292 #endif 293 293 m_mainFrame->loader()->stopAllLoaders(databasePolicy); 294 m_mainFrame->loader()-> goToItem(item, type);294 m_mainFrame->loader()->history()->goToItem(item, type); 295 295 } 296 296 -
trunk/WebKit/mac/ChangeLog
r49411 r49413 1 2009-10-09 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Darin Adler. 4 5 Factor HistoryController out of FrameLoader 6 https://bugs.webkit.org/show_bug.cgi?id=30246 7 8 Update API call. 9 10 * WebCoreSupport/WebFrameLoaderClient.mm: 11 (WebFrameLoaderClient::restoreViewState): 12 * WebView/WebView.mm: 13 (-[WebView _loadBackForwardListFromOtherView:]): 14 1 15 2009-10-09 Mark Rowe <mrowe@apple.com> 2 16 -
trunk/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
r49320 r49413 989 989 void WebFrameLoaderClient::restoreViewState() 990 990 { 991 HistoryItem* currentItem = core(m_webFrame.get())->loader()-> currentHistoryItem();991 HistoryItem* currentItem = core(m_webFrame.get())->loader()->history()->currentItem(); 992 992 ASSERT(currentItem); 993 993 -
trunk/WebKit/mac/WebView/WebView.mm
r49385 r49413 1188 1188 // since that might have changed since loading and it is normally not saved 1189 1189 // until we leave that page. 1190 otherView->_private->page->mainFrame()->loader()-> saveDocumentAndScrollState();1190 otherView->_private->page->mainFrame()->loader()->history()->saveDocumentAndScrollState(); 1191 1191 } 1192 1192 RefPtr<HistoryItem> newItem = otherBackForwardList->itemAtIndex(i)->copy(); -
trunk/WebKit/win/ChangeLog
r49385 r49413 1 2009-10-09 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Darin Adler. 4 5 Factor HistoryController out of FrameLoader 6 https://bugs.webkit.org/show_bug.cgi?id=30246 7 8 Update API call. 9 10 * WebView.cpp: 11 (WebView::loadBackForwardListFromOtherView): 12 1 13 2009-10-08 Jon Honeycutt <jhoneycutt@apple.com> 2 14 -
trunk/WebKit/win/WebView.cpp
r49385 r49413 4811 4811 // since that might have changed since loading and it is normally not saved 4812 4812 // until we leave that page. 4813 otherWebView->m_page->mainFrame()->loader()-> saveDocumentAndScrollState();4813 otherWebView->m_page->mainFrame()->loader()->history()->saveDocumentAndScrollState(); 4814 4814 } 4815 4815 RefPtr<HistoryItem> newItem = otherBackForwardList->itemAtIndex(i)->copy();
Note: See TracChangeset
for help on using the changeset viewer.