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

Side by Side Diff: Source/core/loader/HistoryController.cpp

Issue 59573002: Add Frame::isMainFrame and deploy it (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | Source/core/page/AutoscrollController.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 which case the restore silent fails and we will fix it in when we try to restor e on doc completion. 78 which case the restore silent fails and we will fix it in when we try to restor e on doc completion.
79 2) If the layout happens after the load completes, the attempt to restore at lo ad completion time silently 79 2) If the layout happens after the load completes, the attempt to restore at lo ad completion time silently
80 fails. We then successfully restore it when the layout happens. 80 fails. We then successfully restore it when the layout happens.
81 */ 81 */
82 void HistoryController::restoreScrollPositionAndViewState() 82 void HistoryController::restoreScrollPositionAndViewState()
83 { 83 {
84 if (!m_currentItem || !m_frame->loader().stateMachine()->committedFirstRealD ocumentLoad()) 84 if (!m_currentItem || !m_frame->loader().stateMachine()->committedFirstRealD ocumentLoad())
85 return; 85 return;
86 86
87 if (FrameView* view = m_frame->view()) { 87 if (FrameView* view = m_frame->view()) {
88 Page* page = m_frame->page(); 88 if (m_frame->isMainFrame()) {
89 if (page && page->mainFrame() == m_frame) { 89 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->sc rollingCoordinator())
90 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoor dinator())
91 scrollingCoordinator->frameViewRootLayerDidChange(view); 90 scrollingCoordinator->frameViewRootLayerDidChange(view);
92 } 91 }
93 92
94 if (!view->wasScrolledByUser()) { 93 if (!view->wasScrolledByUser()) {
95 if (page && page->mainFrame() == m_frame && m_currentItem->pageScale Factor()) 94 if (m_frame->isMainFrame() && m_currentItem->pageScaleFactor())
96 page->setPageScaleFactor(m_currentItem->pageScaleFactor(), m_cur rentItem->scrollPoint()); 95 m_frame->page()->setPageScaleFactor(m_currentItem->pageScaleFact or(), m_currentItem->scrollPoint());
97 else 96 else
98 view->setScrollPositionNonProgrammatically(m_currentItem->scroll Point()); 97 view->setScrollPositionNonProgrammatically(m_currentItem->scroll Point());
99 } 98 }
100 } 99 }
101 } 100 }
102 101
103 void HistoryController::updateBackForwardListForFragmentScroll() 102 void HistoryController::updateBackForwardListForFragmentScroll()
104 { 103 {
105 createNewBackForwardItem(false); 104 createNewBackForwardItem(false);
106 } 105 }
(...skipping 10 matching lines...) Expand all
117 LOG(Loading, "WebCoreLoading %s: saving form state to %p", m_frame->tree ().uniqueName().string().utf8().data(), m_currentItem.get()); 116 LOG(Loading, "WebCoreLoading %s: saving form state to %p", m_frame->tree ().uniqueName().string().utf8().data(), m_currentItem.get());
118 m_currentItem->setDocumentState(document->formElementsState()); 117 m_currentItem->setDocumentState(document->formElementsState());
119 } 118 }
120 119
121 if (!m_frame->view()) 120 if (!m_frame->view())
122 return; 121 return;
123 122
124 m_currentItem->setScrollPoint(m_frame->view()->scrollPosition()); 123 m_currentItem->setScrollPoint(m_frame->view()->scrollPosition());
125 124
126 Page* page = m_frame->page(); 125 Page* page = m_frame->page();
127 if (page && page->mainFrame() == m_frame && !page->inspectorController().dev iceEmulationEnabled()) 126 if (m_frame->isMainFrame() && !page->inspectorController().deviceEmulationEn abled())
128 m_currentItem->setPageScaleFactor(page->pageScaleFactor()); 127 m_currentItem->setPageScaleFactor(page->pageScaleFactor());
129 } 128 }
130 129
131 void HistoryController::restoreDocumentState() 130 void HistoryController::restoreDocumentState()
132 { 131 {
133 if (m_currentItem && m_frame->loader().loadType() == FrameLoadTypeBackForwar d) 132 if (m_currentItem && m_frame->loader().loadType() == FrameLoadTypeBackForwar d)
134 m_frame->document()->setStateForNewFormElements(m_currentItem->documentS tate()); 133 m_frame->document()->setStateForNewFormElements(m_currentItem->documentS tate());
135 } 134 }
136 135
137 bool HistoryController::shouldStopLoadingForHistoryItem(HistoryItem* targetItem) const 136 bool HistoryController::shouldStopLoadingForHistoryItem(HistoryItem* targetItem) const
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 if (!urlString.isEmpty()) 555 if (!urlString.isEmpty())
557 m_currentItem->setURLString(urlString); 556 m_currentItem->setURLString(urlString);
558 m_currentItem->setStateObject(stateObject); 557 m_currentItem->setStateObject(stateObject);
559 m_currentItem->setFormData(0); 558 m_currentItem->setFormData(0);
560 m_currentItem->setFormContentType(String()); 559 m_currentItem->setFormContentType(String());
561 560
562 ASSERT(m_frame->page()); 561 ASSERT(m_frame->page());
563 } 562 }
564 563
565 } // namespace WebCore 564 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | Source/core/page/AutoscrollController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698