Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2730573003: Moved FrameHost::m_visualViewport to Page (Closed)
Patch Set: Fixed some compile errors on mac and android Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // Shouldn't clobber anything if we might still restore later. 272 // Shouldn't clobber anything if we might still restore later.
273 if (m_documentLoader && 273 if (m_documentLoader &&
274 needsHistoryItemRestore(m_documentLoader->loadType()) && 274 needsHistoryItemRestore(m_documentLoader->loadType()) &&
275 !m_documentLoader->initialScrollState().wasScrolledByUser) 275 !m_documentLoader->initialScrollState().wasScrolledByUser)
276 return; 276 return;
277 277
278 if (ScrollableArea* layoutScrollableArea = 278 if (ScrollableArea* layoutScrollableArea =
279 m_frame->view()->layoutViewportScrollableArea()) 279 m_frame->view()->layoutViewportScrollableArea())
280 m_currentItem->setScrollOffset(layoutScrollableArea->getScrollOffset()); 280 m_currentItem->setScrollOffset(layoutScrollableArea->getScrollOffset());
281 m_currentItem->setVisualViewportScrollOffset(toScrollOffset( 281 m_currentItem->setVisualViewportScrollOffset(toScrollOffset(
282 m_frame->host()->visualViewport().visibleRect().location())); 282 m_frame->page()->visualViewport().visibleRect().location()));
283 283
284 if (m_frame->isMainFrame()) 284 if (m_frame->isMainFrame())
285 m_currentItem->setPageScaleFactor(m_frame->page()->pageScaleFactor()); 285 m_currentItem->setPageScaleFactor(m_frame->page()->pageScaleFactor());
286 286
287 client()->didUpdateCurrentHistoryItem(); 287 client()->didUpdateCurrentHistoryItem();
288 } 288 }
289 289
290 void FrameLoader::dispatchUnloadEvent() { 290 void FrameLoader::dispatchUnloadEvent() {
291 FrameNavigationDisabler navigationDisabler(*m_frame); 291 FrameNavigationDisabler navigationDisabler(*m_frame);
292 292
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 // If the visual viewport's offset is (-1, -1) it means the history item 1445 // If the visual viewport's offset is (-1, -1) it means the history item
1446 // is an old version of HistoryItem so distribute the scroll between 1446 // is an old version of HistoryItem so distribute the scroll between
1447 // the main frame and the visual viewport as best as we can. 1447 // the main frame and the visual viewport as best as we can.
1448 if (visualViewportOffset.width() == -1 && 1448 if (visualViewportOffset.width() == -1 &&
1449 visualViewportOffset.height() == -1) { 1449 visualViewportOffset.height() == -1) {
1450 visualViewportOffset = 1450 visualViewportOffset =
1451 m_currentItem->getScrollOffset() - 1451 m_currentItem->getScrollOffset() -
1452 view->layoutViewportScrollableArea()->getScrollOffset(); 1452 view->layoutViewportScrollableArea()->getScrollOffset();
1453 } 1453 }
1454 1454
1455 VisualViewport& visualViewport = m_frame->host()->visualViewport(); 1455 VisualViewport& visualViewport = m_frame->page()->visualViewport();
1456 if (shouldRestoreScale && shouldRestoreScroll) { 1456 if (shouldRestoreScale && shouldRestoreScroll) {
1457 visualViewport.setScaleAndLocation(m_currentItem->pageScaleFactor(), 1457 visualViewport.setScaleAndLocation(m_currentItem->pageScaleFactor(),
1458 FloatPoint(visualViewportOffset)); 1458 FloatPoint(visualViewportOffset));
1459 } else if (shouldRestoreScale) { 1459 } else if (shouldRestoreScale) {
1460 visualViewport.setScale(m_currentItem->pageScaleFactor()); 1460 visualViewport.setScale(m_currentItem->pageScaleFactor());
1461 } else if (shouldRestoreScroll) { 1461 } else if (shouldRestoreScroll) {
1462 visualViewport.setLocation(FloatPoint(visualViewportOffset)); 1462 visualViewport.setLocation(FloatPoint(visualViewportOffset));
1463 } 1463 }
1464 1464
1465 if (ScrollingCoordinator* scrollingCoordinator = 1465 if (ScrollingCoordinator* scrollingCoordinator =
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1980 frameLoadRequest.clientRedirect()); 1980 frameLoadRequest.clientRedirect());
1981 1981
1982 loader->setLoadType(loadType); 1982 loader->setLoadType(loadType);
1983 loader->setNavigationType(navigationType); 1983 loader->setNavigationType(navigationType);
1984 loader->setReplacesCurrentHistoryItem(loadType == 1984 loader->setReplacesCurrentHistoryItem(loadType ==
1985 FrameLoadTypeReplaceCurrentItem); 1985 FrameLoadTypeReplaceCurrentItem);
1986 return loader; 1986 return loader;
1987 } 1987 }
1988 1988
1989 } // namespace blink 1989 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/EmptyClients.cpp ('k') | third_party/WebKit/Source/core/page/Page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698