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

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: Improve readability 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
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 if (!mainFrame()->isLocalFrame())
Nate Chapin 2015/08/06 21:02:00 This early exit looks like it's no longer necessar
majidvp 2015/08/06 21:25:36 Acknowledged.
310 return; 310 return;
311 311
312 FrameView* view = deprecatedLocalMainFrame()->view();
313 VisualViewport& viewport = frameHost().visualViewport(); 312 VisualViewport& viewport = frameHost().visualViewport();
314 313 viewport.setScale(scale);
Nate Chapin 2015/08/06 21:02:00 I think this function is now only called by Intern
majidvp 2015/08/06 21:25:36 That is true. The reasons I like to keep it are: 1
bokan 2015/08/07 15:08:01 I agree with Nate, these methods should be removed
315 if (scale != viewport.scale()) {
316 viewport.setScale(scale);
317
318 chromeClient().pageScaleFactorChanged();
319
320 deprecatedLocalMainFrame()->loader().saveScrollState();
321 }
322
323 if (view && view->scrollPosition() != origin)
324 view->setScrollPosition(origin, ProgrammaticScroll);
325 } 314 }
326 315
327 float Page::pageScaleFactor() const 316 float Page::pageScaleFactor() const
328 { 317 {
329 return frameHost().visualViewport().scale(); 318 return frameHost().visualViewport().scale();
330 } 319 }
331 320
332 void Page::setDeviceScaleFactor(float scaleFactor) 321 void Page::setDeviceScaleFactor(float scaleFactor)
333 { 322 {
334 if (m_deviceScaleFactor == scaleFactor) 323 if (m_deviceScaleFactor == scaleFactor)
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 { 597 {
609 } 598 }
610 599
611 Page::PageClients::~PageClients() 600 Page::PageClients::~PageClients()
612 { 601 {
613 } 602 }
614 603
615 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Page>; 604 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Page>;
616 605
617 } // namespace blink 606 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698