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

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

Issue 14813025: Refactor viewport initialization logic out of WebViewImpl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix webkit_unit_tests Created 7 years, 7 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 | Annotate | Revision Log
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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 424
425 m_defersLoading = defers; 425 m_defersLoading = defers;
426 for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext( )) 426 for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext( ))
427 frame->loader()->setDefersLoading(defers); 427 frame->loader()->setDefersLoading(defers);
428 } 428 }
429 429
430 void Page::setPageScaleFactor(float scale, const IntPoint& origin) 430 void Page::setPageScaleFactor(float scale, const IntPoint& origin)
431 { 431 {
432 FrameView* view = mainFrame()->view(); 432 FrameView* view = mainFrame()->view();
433 433
434 if (scale == m_pageScaleFactor) { 434 bool oldProgrammaticScroll = view->inProgrammaticScroll();
435 if (view && view->scrollPosition() != origin) 435 view->setInProgrammaticScroll(false);
436 view->setScrollPosition(origin); 436
437 return; 437 if (scale != m_pageScaleFactor) {
438 m_pageScaleFactor = scale;
439
440 if (view)
441 view->setVisibleContentScaleFactor(scale);
442
443 mainFrame()->deviceOrPageScaleFactorChanged();
444
445 if (view)
446 view->setViewportConstrainedObjectsNeedLayout();
438 } 447 }
439 448
440 m_pageScaleFactor = scale; 449 if (view && view->scrollPosition() != origin)
450 view->notifyScrollPositionChanged(origin);
441 451
442 if (view) 452 view->setInProgrammaticScroll(oldProgrammaticScroll);
443 view->setVisibleContentScaleFactor(scale);
444
445 mainFrame()->deviceOrPageScaleFactorChanged();
446
447 if (view)
448 view->setViewportConstrainedObjectsNeedLayout();
449
450 if (view && view->scrollPosition() != origin)
451 view->setScrollPosition(origin);
452 } 453 }
453 454
454 void Page::setDeviceScaleFactor(float scaleFactor) 455 void Page::setDeviceScaleFactor(float scaleFactor)
455 { 456 {
456 if (m_deviceScaleFactor == scaleFactor) 457 if (m_deviceScaleFactor == scaleFactor)
457 return; 458 return;
458 459
459 m_deviceScaleFactor = scaleFactor; 460 m_deviceScaleFactor = scaleFactor;
460 setNeedsRecalcStyleInAllFrames(); 461 setNeedsRecalcStyleInAllFrames();
461 462
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 , dragClient(0) 828 , dragClient(0)
828 , inspectorClient(0) 829 , inspectorClient(0)
829 { 830 {
830 } 831 }
831 832
832 Page::PageClients::~PageClients() 833 Page::PageClients::~PageClients()
833 { 834 {
834 } 835 }
835 836
836 } // namespace WebCore 837 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698