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

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: Add tests for new behavior 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 440
441 m_defersLoading = defers; 441 m_defersLoading = defers;
442 for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext( )) 442 for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext( ))
443 frame->loader()->setDefersLoading(defers); 443 frame->loader()->setDefersLoading(defers);
444 } 444 }
445 445
446 void Page::setPageScaleFactor(float scale, const IntPoint& origin) 446 void Page::setPageScaleFactor(float scale, const IntPoint& origin)
447 { 447 {
448 FrameView* view = mainFrame()->view(); 448 FrameView* view = mainFrame()->view();
449 449
450 if (scale == m_pageScaleFactor) { 450 bool oldProgrammaticScroll = view->inProgrammaticScroll();
dshwang 2013/05/13 12:38:01 It is so confusing. How about extracting scroll so
aelias_OOO_until_Jul13 2013/05/13 18:13:06 The reason is that changing page scale may have th
451 if (view && view->scrollPosition() != origin) 451 view->setInProgrammaticScroll(false);
452 view->setScrollPosition(origin); 452
453 return; 453 if (scale != m_pageScaleFactor) {
454 m_pageScaleFactor = scale;
455
456 if (view)
457 view->setVisibleContentScaleFactor(scale);
458
459 mainFrame()->deviceOrPageScaleFactorChanged();
460
461 if (view)
462 view->setViewportConstrainedObjectsNeedLayout();
454 } 463 }
455 464
456 m_pageScaleFactor = scale; 465 if (view && view->scrollPosition() != origin)
466 view->notifyScrollPositionChanged(origin);
457 467
458 if (view) 468 view->setInProgrammaticScroll(oldProgrammaticScroll);
459 view->setVisibleContentScaleFactor(scale);
460
461 mainFrame()->deviceOrPageScaleFactorChanged();
462
463 if (view)
464 view->setViewportConstrainedObjectsNeedLayout();
465
466 if (view && view->scrollPosition() != origin)
467 view->setScrollPosition(origin);
468 } 469 }
469 470
470 void Page::setDeviceScaleFactor(float scaleFactor) 471 void Page::setDeviceScaleFactor(float scaleFactor)
471 { 472 {
472 if (m_deviceScaleFactor == scaleFactor) 473 if (m_deviceScaleFactor == scaleFactor)
473 return; 474 return;
474 475
475 m_deviceScaleFactor = scaleFactor; 476 m_deviceScaleFactor = scaleFactor;
476 setNeedsRecalcStyleInAllFrames(); 477 setNeedsRecalcStyleInAllFrames();
477 478
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 , inspectorClient(0) 829 , inspectorClient(0)
829 , plugInClient(0) 830 , plugInClient(0)
830 { 831 {
831 } 832 }
832 833
833 Page::PageClients::~PageClients() 834 Page::PageClients::~PageClients()
834 { 835 {
835 } 836 }
836 837
837 } // namespace WebCore 838 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698