| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
| 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 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
| 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
| 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> | 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> |
| 8 * Copyright (C) 2011 Google Inc. All rights reserved. | 8 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 9 * | 9 * |
| 10 * Redistribution and use in source and binary forms, with or without | 10 * Redistribution and use in source and binary forms, with or without |
| (...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 } | 1107 } |
| 1108 | 1108 |
| 1109 FrameLoadType FrameLoader::loadType() const | 1109 FrameLoadType FrameLoader::loadType() const |
| 1110 { | 1110 { |
| 1111 return m_loadType; | 1111 return m_loadType; |
| 1112 } | 1112 } |
| 1113 | 1113 |
| 1114 void FrameLoader::restoreScrollPositionAndViewState() | 1114 void FrameLoader::restoreScrollPositionAndViewState() |
| 1115 { | 1115 { |
| 1116 FrameView* view = m_frame->view(); | 1116 FrameView* view = m_frame->view(); |
| 1117 if (!m_frame->page() || !view || !m_currentItem || !m_stateMachine.committed
FirstRealDocumentLoad()) | 1117 if (!m_frame->page() || !view || !view->layoutViewportScrollableArea() || !m
_currentItem || !m_stateMachine.committedFirstRealDocumentLoad()) |
| 1118 return; | 1118 return; |
| 1119 | 1119 |
| 1120 if (!needsHistoryItemRestore(m_loadType)) | 1120 if (!needsHistoryItemRestore(m_loadType)) |
| 1121 return; | 1121 return; |
| 1122 | 1122 |
| 1123 bool shouldRestoreScroll = m_currentItem->scrollRestorationType() != ScrollR
estorationManual; | 1123 bool shouldRestoreScroll = m_currentItem->scrollRestorationType() != ScrollR
estorationManual; |
| 1124 bool shouldRestoreScale = m_currentItem->pageScaleFactor(); | 1124 bool shouldRestoreScale = m_currentItem->pageScaleFactor(); |
| 1125 | 1125 |
| 1126 // This tries to balance: | 1126 // This tries to balance: |
| 1127 // 1. restoring as soon as possible | 1127 // 1. restoring as soon as possible |
| 1128 // 2. not overriding user scroll (TODO(majidvp): also respect user scale) | 1128 // 2. not overriding user scroll (TODO(majidvp): also respect user scale) |
| 1129 // 3. detecting clamping to avoid repeatedly popping the scroll position | 1129 // 3. detecting clamping to avoid repeatedly popping the scroll position |
| 1130 // down as the page height increases | 1130 // down as the page height increases |
| 1131 // 4. ignore clamp detection if we are not restoring scroll or after load | 1131 // 4. ignore clamp detection if we are not restoring scroll or after load |
| 1132 // completes because that may be because the page will never reach its | 1132 // completes because that may be because the page will never reach its |
| 1133 // previous height | 1133 // previous height |
| 1134 bool canRestoreWithoutClamping = view->clampOffsetAtScale(m_currentItem->scr
ollPoint(), 1) == m_currentItem->scrollPoint(); | 1134 bool canRestoreWithoutClamping = view->layoutViewportScrollableArea()->clamp
ScrollPosition(m_currentItem->scrollPoint()) == m_currentItem->scrollPoint(); |
| 1135 bool canRestoreWithoutAnnoyingUser = !documentLoader()->initialScrollState()
.wasScrolledByUser | 1135 bool canRestoreWithoutAnnoyingUser = !documentLoader()->initialScrollState()
.wasScrolledByUser |
| 1136 && (canRestoreWithoutClamping || !m_frame->isLoading() || !shouldRestore
Scroll); | 1136 && (canRestoreWithoutClamping || !m_frame->isLoading() || !shouldRestore
Scroll); |
| 1137 if (!canRestoreWithoutAnnoyingUser) | 1137 if (!canRestoreWithoutAnnoyingUser) |
| 1138 return; | 1138 return; |
| 1139 | 1139 |
| 1140 if (shouldRestoreScroll) | 1140 if (shouldRestoreScroll) |
| 1141 view->layoutViewportScrollableArea()->setScrollPosition(m_currentItem->s
crollPoint(), ProgrammaticScroll); | 1141 view->layoutViewportScrollableArea()->setScrollPosition(m_currentItem->s
crollPoint(), ProgrammaticScroll); |
| 1142 | 1142 |
| 1143 // For main frame restore scale and visual viewport position | 1143 // For main frame restore scale and visual viewport position |
| 1144 if (m_frame->isMainFrame()) { | 1144 if (m_frame->isMainFrame()) { |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1516 // FIXME: We need a way to propagate insecure requests policy flags to | 1516 // FIXME: We need a way to propagate insecure requests policy flags to |
| 1517 // out-of-process frames. For now, we'll always use default behavior. | 1517 // out-of-process frames. For now, we'll always use default behavior. |
| 1518 if (!parentFrame->isLocalFrame()) | 1518 if (!parentFrame->isLocalFrame()) |
| 1519 return nullptr; | 1519 return nullptr; |
| 1520 | 1520 |
| 1521 ASSERT(toLocalFrame(parentFrame)->document()); | 1521 ASSERT(toLocalFrame(parentFrame)->document()); |
| 1522 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; | 1522 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; |
| 1523 } | 1523 } |
| 1524 | 1524 |
| 1525 } // namespace blink | 1525 } // namespace blink |
| OLD | NEW |