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

Side by Side Diff: Source/core/page/Page.cpp

Issue 1277583003: Restore scale even if scroll is not restored (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use window.scroll{X,y} Created 5 years, 4 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
« no previous file with comments | « Source/core/page/Page.h ('k') | Source/core/testing/Internals.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All R ights Reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All R ights Reserved.
3 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 3 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 if (defers == m_defersLoading) 297 if (defers == m_defersLoading)
298 return; 298 return;
299 299
300 m_defersLoading = defers; 300 m_defersLoading = defers;
301 for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext() ) { 301 for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext() ) {
302 if (frame->isLocalFrame()) 302 if (frame->isLocalFrame())
303 toLocalFrame(frame)->loader().setDefersLoading(defers); 303 toLocalFrame(frame)->loader().setDefersLoading(defers);
304 } 304 }
305 } 305 }
306 306
307 void Page::setPageScaleFactor(float scale, const IntPoint& origin) 307 void Page::setPageScaleFactor(float scale)
308 { 308 {
309 if (!mainFrame()->isLocalFrame()) 309 frameHost().visualViewport().setScale(scale);
310 return;
311
312 FrameView* view = deprecatedLocalMainFrame()->view();
313 ScrollableArea* layoutViewport = view ? view->layoutViewportScrollableArea() : nullptr;
314 VisualViewport& visualViewport = frameHost().visualViewport();
315
316 if (scale != visualViewport.scale()) {
317 visualViewport.setScale(scale);
318
319 chromeClient().pageScaleFactorChanged();
320
321 deprecatedLocalMainFrame()->loader().saveScrollState();
322 }
323
324 if (layoutViewport && layoutViewport->scrollPosition() != origin)
325 layoutViewport->setScrollPosition(origin, ProgrammaticScroll);
326 } 310 }
327 311
328 float Page::pageScaleFactor() const 312 float Page::pageScaleFactor() const
329 { 313 {
330 return frameHost().visualViewport().scale(); 314 return frameHost().visualViewport().scale();
331 } 315 }
332 316
333 void Page::setDeviceScaleFactor(float scaleFactor) 317 void Page::setDeviceScaleFactor(float scaleFactor)
334 { 318 {
335 if (m_deviceScaleFactor == scaleFactor) 319 if (m_deviceScaleFactor == scaleFactor)
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 { 593 {
610 } 594 }
611 595
612 Page::PageClients::~PageClients() 596 Page::PageClients::~PageClients()
613 { 597 {
614 } 598 }
615 599
616 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Page>; 600 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Page>;
617 601
618 } // namespace blink 602 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/page/Page.h ('k') | Source/core/testing/Internals.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698