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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 m_frame->document()->setReadyState(Document::Complete); | 566 m_frame->document()->setReadyState(Document::Complete); |
567 if (m_frame->document()->loadEventStillNeeded()) | 567 if (m_frame->document()->loadEventStillNeeded()) |
568 m_frame->document()->implicitClose(); | 568 m_frame->document()->implicitClose(); |
569 | 569 |
570 m_frame->navigationScheduler().startTimer(); | 570 m_frame->navigationScheduler().startTimer(); |
571 | 571 |
572 if (m_frame->view()) | 572 if (m_frame->view()) |
573 m_frame->view()->handleLoadCompleted(); | 573 m_frame->view()->handleLoadCompleted(); |
574 | 574 |
575 if (shouldSendCompleteNotifications(m_frame)) { | 575 if (shouldSendCompleteNotifications(m_frame)) { |
576 m_loadType = FrameLoadTypeStandard; | |
577 m_progressTracker->progressCompleted(); | 576 m_progressTracker->progressCompleted(); |
578 // Retry restoring scroll offset since finishing loading disables conten
t | 577 // Retry restoring scroll offset since finishing loading disables conten
t |
579 // size clamping. | 578 // size clamping. |
580 // TODO(majidvp): Remove this call as it appears to be a no-op because | |
581 // we set load type to |FrameLoadTypeStandard| just above. | |
582 restoreScrollPositionAndViewState(); | 579 restoreScrollPositionAndViewState(); |
| 580 |
| 581 m_loadType = FrameLoadTypeStandard; |
583 m_frame->localDOMWindow()->finishedLoading(); | 582 m_frame->localDOMWindow()->finishedLoading(); |
584 | 583 |
585 // Report mobile vs. desktop page statistics. This will only report on A
ndroid. | 584 // Report mobile vs. desktop page statistics. This will only report on A
ndroid. |
586 if (m_frame->isMainFrame()) | 585 if (m_frame->isMainFrame()) |
587 m_frame->document()->viewportDescription().reportMobilePageStats(m_f
rame); | 586 m_frame->document()->viewportDescription().reportMobilePageStats(m_f
rame); |
588 client()->dispatchDidFinishLoad(); | 587 client()->dispatchDidFinishLoad(); |
589 } | 588 } |
590 | 589 |
591 Frame* parent = m_frame->tree().parent(); | 590 Frame* parent = m_frame->tree().parent(); |
592 if (parent && parent->isLocalFrame()) | 591 if (parent && parent->isLocalFrame()) |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 // This tries to balance: | 1126 // This tries to balance: |
1128 // 1. restoring as soon as possible | 1127 // 1. restoring as soon as possible |
1129 // 2. not overriding user scroll (TODO(majidvp): also respect user scale) | 1128 // 2. not overriding user scroll (TODO(majidvp): also respect user scale) |
1130 // 3. detecting clamping to avoid repeatedly popping the scroll position | 1129 // 3. detecting clamping to avoid repeatedly popping the scroll position |
1131 // down as the page height increases | 1130 // down as the page height increases |
1132 // 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 |
1133 // 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 |
1134 // previous height | 1133 // previous height |
1135 bool canRestoreWithoutClamping = view->clampOffsetAtScale(m_currentItem->scr
ollPoint(), 1) == m_currentItem->scrollPoint(); | 1134 bool canRestoreWithoutClamping = view->clampOffsetAtScale(m_currentItem->scr
ollPoint(), 1) == m_currentItem->scrollPoint(); |
1136 bool canRestoreWithoutAnnoyingUser = !documentLoader()->initialScrollState()
.wasScrolledByUser | 1135 bool canRestoreWithoutAnnoyingUser = !documentLoader()->initialScrollState()
.wasScrolledByUser |
1137 && (canRestoreWithoutClamping || m_frame->isLoading() || !shouldRestoreS
croll); | 1136 && (canRestoreWithoutClamping || !m_frame->isLoading() || !shouldRestore
Scroll); |
1138 if (!canRestoreWithoutAnnoyingUser) | 1137 if (!canRestoreWithoutAnnoyingUser) |
1139 return; | 1138 return; |
1140 | 1139 |
1141 if (shouldRestoreScroll) | 1140 if (shouldRestoreScroll) |
1142 view->layoutViewportScrollableArea()->setScrollPosition(m_currentItem->s
crollPoint(), ProgrammaticScroll); | 1141 view->layoutViewportScrollableArea()->setScrollPosition(m_currentItem->s
crollPoint(), ProgrammaticScroll); |
1143 | 1142 |
1144 // For main frame restore scale and visual viewport position | 1143 // For main frame restore scale and visual viewport position |
1145 if (m_frame->isMainFrame()) { | 1144 if (m_frame->isMainFrame()) { |
1146 FloatPoint visualViewportOffset(m_currentItem->visualViewportScrollPoint
()); | 1145 FloatPoint visualViewportOffset(m_currentItem->visualViewportScrollPoint
()); |
1147 | 1146 |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1517 // 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 |
1518 // 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. |
1519 if (!parentFrame->isLocalFrame()) | 1518 if (!parentFrame->isLocalFrame()) |
1520 return nullptr; | 1519 return nullptr; |
1521 | 1520 |
1522 ASSERT(toLocalFrame(parentFrame)->document()); | 1521 ASSERT(toLocalFrame(parentFrame)->document()); |
1523 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; | 1522 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; |
1524 } | 1523 } |
1525 | 1524 |
1526 } // namespace blink | 1525 } // namespace blink |
OLD | NEW |