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 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 RefPtr<SecurityOrigin> securityOrigin = | 1316 RefPtr<SecurityOrigin> securityOrigin = |
1317 SecurityOrigin::create(m_provisionalDocumentLoader->request().url()); | 1317 SecurityOrigin::create(m_provisionalDocumentLoader->request().url()); |
1318 m_provisionalDocumentLoader->timing().setHasSameOriginAsPreviousDocument( | 1318 m_provisionalDocumentLoader->timing().setHasSameOriginAsPreviousDocument( |
1319 securityOrigin->canRequest(m_frame->document()->url())); | 1319 securityOrigin->canRequest(m_frame->document()->url())); |
1320 } | 1320 } |
1321 | 1321 |
1322 if (!prepareForCommit()) | 1322 if (!prepareForCommit()) |
1323 return; | 1323 return; |
1324 | 1324 |
1325 if (isLoadingMainFrame()) { | 1325 if (isLoadingMainFrame()) { |
| 1326 // TODO(wjmaclean): Instead of passing |m_frame| here we pass nullptr |
| 1327 // instead so the properties will be set on the WebView. We do this since, |
| 1328 // while we are loading, the WebFrameWidget for m_frame may not yet |
| 1329 // be available. |
1326 m_frame->page()->chromeClient().setEventListenerProperties( | 1330 m_frame->page()->chromeClient().setEventListenerProperties( |
1327 WebEventListenerClass::TouchStartOrMove, | 1331 nullptr, WebEventListenerClass::TouchStartOrMove, |
1328 WebEventListenerProperties::Nothing); | 1332 WebEventListenerProperties::Nothing); |
1329 m_frame->page()->chromeClient().setEventListenerProperties( | 1333 m_frame->page()->chromeClient().setEventListenerProperties( |
1330 WebEventListenerClass::MouseWheel, WebEventListenerProperties::Nothing); | 1334 nullptr, WebEventListenerClass::MouseWheel, |
| 1335 WebEventListenerProperties::Nothing); |
1331 m_frame->page()->chromeClient().setEventListenerProperties( | 1336 m_frame->page()->chromeClient().setEventListenerProperties( |
1332 WebEventListenerClass::TouchEndOrCancel, | 1337 nullptr, WebEventListenerClass::TouchEndOrCancel, |
1333 WebEventListenerProperties::Nothing); | 1338 WebEventListenerProperties::Nothing); |
1334 } | 1339 } |
1335 | 1340 |
1336 client()->transitionToCommittedForNewPage(); | 1341 client()->transitionToCommittedForNewPage(); |
1337 m_frame->navigationScheduler().cancel(); | 1342 m_frame->navigationScheduler().cancel(); |
1338 m_frame->editor().clearLastEditCommand(); | 1343 m_frame->editor().clearLastEditCommand(); |
1339 | 1344 |
1340 // If we are still in the process of initializing an empty document then its | 1345 // If we are still in the process of initializing an empty document then its |
1341 // frame is not in a consistent state for rendering, so avoid | 1346 // frame is not in a consistent state for rendering, so avoid |
1342 // setJSStatusBarText since it may cause clients to attempt to render the | 1347 // setJSStatusBarText since it may cause clients to attempt to render the |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 // is an old version of HistoryItem so distribute the scroll between | 1408 // is an old version of HistoryItem so distribute the scroll between |
1404 // the main frame and the visual viewport as best as we can. | 1409 // the main frame and the visual viewport as best as we can. |
1405 if (visualViewportOffset.width() == -1 && | 1410 if (visualViewportOffset.width() == -1 && |
1406 visualViewportOffset.height() == -1) { | 1411 visualViewportOffset.height() == -1) { |
1407 visualViewportOffset = | 1412 visualViewportOffset = |
1408 m_currentItem->scrollOffset() - | 1413 m_currentItem->scrollOffset() - |
1409 view->layoutViewportScrollableArea()->scrollOffset(); | 1414 view->layoutViewportScrollableArea()->scrollOffset(); |
1410 } | 1415 } |
1411 | 1416 |
1412 VisualViewport& visualViewport = m_frame->host()->visualViewport(); | 1417 VisualViewport& visualViewport = m_frame->host()->visualViewport(); |
| 1418 float originalScale = visualViewport.scale(); |
1413 if (shouldRestoreScale && shouldRestoreScroll) { | 1419 if (shouldRestoreScale && shouldRestoreScroll) { |
1414 visualViewport.setScaleAndLocation(m_currentItem->pageScaleFactor(), | 1420 visualViewport.setScaleAndLocation(m_currentItem->pageScaleFactor(), |
1415 FloatPoint(visualViewportOffset)); | 1421 FloatPoint(visualViewportOffset)); |
1416 } else if (shouldRestoreScale) { | 1422 } else if (shouldRestoreScale) { |
1417 visualViewport.setScale(m_currentItem->pageScaleFactor()); | 1423 visualViewport.setScale(m_currentItem->pageScaleFactor()); |
1418 } else if (shouldRestoreScroll) { | 1424 } else if (shouldRestoreScroll) { |
1419 visualViewport.setLocation(FloatPoint(visualViewportOffset)); | 1425 visualViewport.setLocation(FloatPoint(visualViewportOffset)); |
1420 } | 1426 } |
| 1427 // If necessary, notify client we've restored page scale. |
| 1428 if (shouldRestoreScale && (originalScale != visualViewport.scale())) |
| 1429 client()->didRestorePageScaleFactorOnLoad(visualViewport.scale()); |
1421 | 1430 |
1422 if (ScrollingCoordinator* scrollingCoordinator = | 1431 if (ScrollingCoordinator* scrollingCoordinator = |
1423 m_frame->page()->scrollingCoordinator()) | 1432 m_frame->page()->scrollingCoordinator()) |
1424 scrollingCoordinator->frameViewRootLayerDidChange(view); | 1433 scrollingCoordinator->frameViewRootLayerDidChange(view); |
1425 } | 1434 } |
1426 | 1435 |
1427 documentLoader()->initialScrollState().didRestoreFromHistory = true; | 1436 documentLoader()->initialScrollState().didRestoreFromHistory = true; |
1428 } | 1437 } |
1429 | 1438 |
1430 String FrameLoader::userAgent() const { | 1439 String FrameLoader::userAgent() const { |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1945 m_documentLoader ? m_documentLoader->url() : String()); | 1954 m_documentLoader ? m_documentLoader->url() : String()); |
1946 return tracedValue; | 1955 return tracedValue; |
1947 } | 1956 } |
1948 | 1957 |
1949 inline void FrameLoader::takeObjectSnapshot() const { | 1958 inline void FrameLoader::takeObjectSnapshot() const { |
1950 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, | 1959 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, |
1951 toTracedValue()); | 1960 toTracedValue()); |
1952 } | 1961 } |
1953 | 1962 |
1954 } // namespace blink | 1963 } // namespace blink |
OLD | NEW |