| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 6 * (http://www.torchmobile.com/) | 6 * (http://www.torchmobile.com/) |
| 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
| 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
| 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> | 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> |
| 10 * Copyright (C) 2011 Google Inc. All rights reserved. | 10 * Copyright (C) 2011 Google Inc. All rights reserved. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 29 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 30 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 30 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 32 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 32 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 34 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 34 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 35 */ | 35 */ |
| 36 | 36 |
| 37 #include "core/loader/FrameLoader.h" | 37 #include "core/loader/FrameLoader.h" |
| 38 | 38 |
| 39 #include <memory> |
| 39 #include "bindings/core/v8/DOMWrapperWorld.h" | 40 #include "bindings/core/v8/DOMWrapperWorld.h" |
| 40 #include "bindings/core/v8/ScriptController.h" | 41 #include "bindings/core/v8/ScriptController.h" |
| 41 #include "bindings/core/v8/SerializedScriptValue.h" | 42 #include "bindings/core/v8/SerializedScriptValue.h" |
| 42 #include "core/HTMLNames.h" | 43 #include "core/HTMLNames.h" |
| 43 #include "core/dom/Document.h" | 44 #include "core/dom/Document.h" |
| 44 #include "core/dom/Element.h" | 45 #include "core/dom/Element.h" |
| 45 #include "core/dom/TaskRunnerHelper.h" | 46 #include "core/dom/TaskRunnerHelper.h" |
| 46 #include "core/dom/ViewportDescription.h" | 47 #include "core/dom/ViewportDescription.h" |
| 47 #include "core/editing/Editor.h" | 48 #include "core/editing/Editor.h" |
| 48 #include "core/events/GestureEvent.h" | 49 #include "core/events/GestureEvent.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 #include "platform/scroll/ScrollAnimatorBase.h" | 96 #include "platform/scroll/ScrollAnimatorBase.h" |
| 96 #include "platform/weborigin/SecurityOrigin.h" | 97 #include "platform/weborigin/SecurityOrigin.h" |
| 97 #include "platform/weborigin/SecurityPolicy.h" | 98 #include "platform/weborigin/SecurityPolicy.h" |
| 98 #include "platform/weborigin/Suborigin.h" | 99 #include "platform/weborigin/Suborigin.h" |
| 99 #include "public/platform/WebCachePolicy.h" | 100 #include "public/platform/WebCachePolicy.h" |
| 100 #include "public/platform/WebFeaturePolicy.h" | 101 #include "public/platform/WebFeaturePolicy.h" |
| 101 #include "public/platform/WebURLRequest.h" | 102 #include "public/platform/WebURLRequest.h" |
| 102 #include "wtf/AutoReset.h" | 103 #include "wtf/AutoReset.h" |
| 103 #include "wtf/text/CString.h" | 104 #include "wtf/text/CString.h" |
| 104 #include "wtf/text/WTFString.h" | 105 #include "wtf/text/WTFString.h" |
| 105 #include <memory> | |
| 106 | 106 |
| 107 using blink::WebURLRequest; | 107 using blink::WebURLRequest; |
| 108 | 108 |
| 109 namespace blink { | 109 namespace blink { |
| 110 | 110 |
| 111 using namespace HTMLNames; | 111 using namespace HTMLNames; |
| 112 | 112 |
| 113 bool isBackForwardLoadType(FrameLoadType type) { | 113 bool isBackForwardLoadType(FrameLoadType type) { |
| 114 return type == FrameLoadTypeBackForward || | 114 return type == FrameLoadTypeBackForward || |
| 115 type == FrameLoadTypeInitialHistoryLoad; | 115 type == FrameLoadTypeInitialHistoryLoad; |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 // Don't propagate state from the old item if this is a different-document | 414 // Don't propagate state from the old item if this is a different-document |
| 415 // navigation, unless the before and after pages are logically related. This | 415 // navigation, unless the before and after pages are logically related. This |
| 416 // means they have the same url (ignoring fragment) and the new item was | 416 // means they have the same url (ignoring fragment) and the new item was |
| 417 // loaded via reload or client redirect. | 417 // loaded via reload or client redirect. |
| 418 if (navigationType == HistoryNavigationType::DifferentDocument && | 418 if (navigationType == HistoryNavigationType::DifferentDocument && |
| 419 (historyCommitType != HistoryInertCommit || | 419 (historyCommitType != HistoryInertCommit || |
| 420 !equalIgnoringFragmentIdentifier(oldItem->url(), m_currentItem->url()))) | 420 !equalIgnoringFragmentIdentifier(oldItem->url(), m_currentItem->url()))) |
| 421 return; | 421 return; |
| 422 m_currentItem->setDocumentSequenceNumber(oldItem->documentSequenceNumber()); | 422 m_currentItem->setDocumentSequenceNumber(oldItem->documentSequenceNumber()); |
| 423 m_currentItem->setScrollOffset(oldItem->getScrollOffset()); | 423 m_currentItem->setScrollOffset(oldItem->getScrollOffset()); |
| 424 m_currentItem->setDidSaveScrollOrScaleState( |
| 425 oldItem->didSaveScrollOrScaleState()); |
| 424 m_currentItem->setVisualViewportScrollOffset( | 426 m_currentItem->setVisualViewportScrollOffset( |
| 425 oldItem->visualViewportScrollOffset()); | 427 oldItem->visualViewportScrollOffset()); |
| 426 m_currentItem->setPageScaleFactor(oldItem->pageScaleFactor()); | 428 m_currentItem->setPageScaleFactor(oldItem->pageScaleFactor()); |
| 427 m_currentItem->setScrollRestorationType(oldItem->scrollRestorationType()); | 429 m_currentItem->setScrollRestorationType(oldItem->scrollRestorationType()); |
| 428 | 430 |
| 429 // The item sequence number determines whether items are "the same", such | 431 // The item sequence number determines whether items are "the same", such |
| 430 // back/forward navigation between items with the same item sequence number is | 432 // back/forward navigation between items with the same item sequence number is |
| 431 // a no-op. Only treat this as identical if the navigation did not create a | 433 // a no-op. Only treat this as identical if the navigation did not create a |
| 432 // back/forward entry and the url is identical or it was loaded via | 434 // back/forward entry and the url is identical or it was loaded via |
| 433 // history.replaceState(). | 435 // history.replaceState(). |
| (...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 | 1409 |
| 1408 void FrameLoader::restoreScrollPositionAndViewStateForLoadType( | 1410 void FrameLoader::restoreScrollPositionAndViewStateForLoadType( |
| 1409 FrameLoadType loadType) { | 1411 FrameLoadType loadType) { |
| 1410 FrameView* view = m_frame->view(); | 1412 FrameView* view = m_frame->view(); |
| 1411 if (!view || !view->layoutViewportScrollableArea() || !m_currentItem || | 1413 if (!view || !view->layoutViewportScrollableArea() || !m_currentItem || |
| 1412 !m_stateMachine.committedFirstRealDocumentLoad()) { | 1414 !m_stateMachine.committedFirstRealDocumentLoad()) { |
| 1413 return; | 1415 return; |
| 1414 } | 1416 } |
| 1415 if (!needsHistoryItemRestore(loadType)) | 1417 if (!needsHistoryItemRestore(loadType)) |
| 1416 return; | 1418 return; |
| 1419 if (!m_currentItem->didSaveScrollOrScaleState()) |
| 1420 return; |
| 1417 | 1421 |
| 1418 bool shouldRestoreScroll = | 1422 bool shouldRestoreScroll = |
| 1419 m_currentItem->scrollRestorationType() != ScrollRestorationManual; | 1423 m_currentItem->scrollRestorationType() != ScrollRestorationManual; |
| 1420 bool shouldRestoreScale = m_currentItem->pageScaleFactor(); | 1424 bool shouldRestoreScale = m_currentItem->pageScaleFactor(); |
| 1421 | 1425 |
| 1422 // This tries to balance: | 1426 // This tries to balance: |
| 1423 // 1. restoring as soon as possible | 1427 // 1. restoring as soon as possible |
| 1424 // 2. not overriding user scroll (TODO(majidvp): also respect user scale) | 1428 // 2. not overriding user scroll (TODO(majidvp): also respect user scale) |
| 1425 // 3. detecting clamping to avoid repeatedly popping the scroll position down | 1429 // 3. detecting clamping to avoid repeatedly popping the scroll position down |
| 1426 // as the page height increases | 1430 // as the page height increases |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2010 frameLoadRequest.clientRedirect()); | 2014 frameLoadRequest.clientRedirect()); |
| 2011 | 2015 |
| 2012 loader->setLoadType(loadType); | 2016 loader->setLoadType(loadType); |
| 2013 loader->setNavigationType(navigationType); | 2017 loader->setNavigationType(navigationType); |
| 2014 loader->setReplacesCurrentHistoryItem(loadType == | 2018 loader->setReplacesCurrentHistoryItem(loadType == |
| 2015 FrameLoadTypeReplaceCurrentItem); | 2019 FrameLoadTypeReplaceCurrentItem); |
| 2016 return loader; | 2020 return loader; |
| 2017 } | 2021 } |
| 2018 | 2022 |
| 2019 } // namespace blink | 2023 } // namespace blink |
| OLD | NEW |