Chromium Code Reviews| 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 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1435 // is an old version of HistoryItem so distribute the scroll between | 1435 // is an old version of HistoryItem so distribute the scroll between |
| 1436 // the main frame and the visual viewport as best as we can. | 1436 // the main frame and the visual viewport as best as we can. |
| 1437 if (visualViewportOffset.width() == -1 && | 1437 if (visualViewportOffset.width() == -1 && |
| 1438 visualViewportOffset.height() == -1) { | 1438 visualViewportOffset.height() == -1) { |
| 1439 visualViewportOffset = | 1439 visualViewportOffset = |
| 1440 m_currentItem->getScrollOffset() - | 1440 m_currentItem->getScrollOffset() - |
| 1441 view->layoutViewportScrollableArea()->getScrollOffset(); | 1441 view->layoutViewportScrollableArea()->getScrollOffset(); |
| 1442 } | 1442 } |
| 1443 | 1443 |
| 1444 VisualViewport& visualViewport = m_frame->host()->visualViewport(); | 1444 VisualViewport& visualViewport = m_frame->host()->visualViewport(); |
| 1445 float originalScale = visualViewport.scale(); | |
| 1445 if (shouldRestoreScale && shouldRestoreScroll) { | 1446 if (shouldRestoreScale && shouldRestoreScroll) { |
| 1446 visualViewport.setScaleAndLocation(m_currentItem->pageScaleFactor(), | 1447 visualViewport.setScaleAndLocation(m_currentItem->pageScaleFactor(), |
| 1447 FloatPoint(visualViewportOffset)); | 1448 FloatPoint(visualViewportOffset)); |
| 1448 } else if (shouldRestoreScale) { | 1449 } else if (shouldRestoreScale) { |
| 1449 visualViewport.setScale(m_currentItem->pageScaleFactor()); | 1450 visualViewport.setScale(m_currentItem->pageScaleFactor()); |
| 1450 } else if (shouldRestoreScroll) { | 1451 } else if (shouldRestoreScroll) { |
| 1451 visualViewport.setLocation(FloatPoint(visualViewportOffset)); | 1452 visualViewport.setLocation(FloatPoint(visualViewportOffset)); |
| 1452 } | 1453 } |
| 1454 // If necessary, notify client we've restored page scale. | |
| 1455 if (shouldRestoreScale && (originalScale != visualViewport.scale())) | |
| 1456 client()->didRestorePageScaleFactorOnLoad(visualViewport.scale()); | |
|
kenrb
2017/01/24 17:13:27
I am not clear on why this is necessary. Does this
wjmaclean
2017/01/24 18:24:26
Hmm, I don't think so, otherwise one would not exp
kenrb
2017/01/24 18:47:30
What I meant was, if the frames have been destroye
| |
| 1453 | 1457 |
| 1454 if (ScrollingCoordinator* scrollingCoordinator = | 1458 if (ScrollingCoordinator* scrollingCoordinator = |
| 1455 m_frame->page()->scrollingCoordinator()) | 1459 m_frame->page()->scrollingCoordinator()) |
| 1456 scrollingCoordinator->frameViewRootLayerDidChange(view); | 1460 scrollingCoordinator->frameViewRootLayerDidChange(view); |
| 1457 } | 1461 } |
| 1458 | 1462 |
| 1459 documentLoader()->initialScrollState().didRestoreFromHistory = true; | 1463 documentLoader()->initialScrollState().didRestoreFromHistory = true; |
| 1460 } | 1464 } |
| 1461 | 1465 |
| 1462 String FrameLoader::userAgent() const { | 1466 String FrameLoader::userAgent() const { |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1927 m_documentLoader ? m_documentLoader->url() : String()); | 1931 m_documentLoader ? m_documentLoader->url() : String()); |
| 1928 return tracedValue; | 1932 return tracedValue; |
| 1929 } | 1933 } |
| 1930 | 1934 |
| 1931 inline void FrameLoader::takeObjectSnapshot() const { | 1935 inline void FrameLoader::takeObjectSnapshot() const { |
| 1932 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, | 1936 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, |
| 1933 toTracedValue()); | 1937 toTracedValue()); |
| 1934 } | 1938 } |
| 1935 | 1939 |
| 1936 } // namespace blink | 1940 } // namespace blink |
| OLD | NEW |