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

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

Issue 225303014: [Pinch-to-zoom] Moved scale factor into PinchViewport (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed layout test breakage Created 6 years, 8 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/platform/geometry/FloatPoint.h » ('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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 , m_historyController(adoptPtr(new HistoryController(this))) 120 , m_historyController(adoptPtr(new HistoryController(this)))
121 , m_undoStack(UndoStack::create()) 121 , m_undoStack(UndoStack::create())
122 , m_backForwardClient(pageClients.backForwardClient) 122 , m_backForwardClient(pageClients.backForwardClient)
123 , m_editorClient(pageClients.editorClient) 123 , m_editorClient(pageClients.editorClient)
124 , m_spellCheckerClient(pageClients.spellCheckerClient) 124 , m_spellCheckerClient(pageClients.spellCheckerClient)
125 , m_storageClient(pageClients.storageClient) 125 , m_storageClient(pageClients.storageClient)
126 , m_subframeCount(0) 126 , m_subframeCount(0)
127 , m_openedByDOM(false) 127 , m_openedByDOM(false)
128 , m_tabKeyCyclesThroughElements(true) 128 , m_tabKeyCyclesThroughElements(true)
129 , m_defersLoading(false) 129 , m_defersLoading(false)
130 , m_pageScaleFactor(1)
131 , m_deviceScaleFactor(1) 130 , m_deviceScaleFactor(1)
132 , m_timerAlignmentInterval(DOMTimer::visiblePageAlignmentInterval()) 131 , m_timerAlignmentInterval(DOMTimer::visiblePageAlignmentInterval())
133 , m_visibilityState(PageVisibilityStateVisible) 132 , m_visibilityState(PageVisibilityStateVisible)
134 , m_isCursorVisible(true) 133 , m_isCursorVisible(true)
135 #ifndef NDEBUG 134 #ifndef NDEBUG
136 , m_isPainting(false) 135 , m_isPainting(false)
137 #endif 136 #endif
138 , m_frameHost(FrameHost::create(*this)) 137 , m_frameHost(FrameHost::create(*this))
139 { 138 {
140 ASSERT(m_editorClient); 139 ASSERT(m_editorClient);
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 return; 310 return;
312 311
313 m_defersLoading = defers; 312 m_defersLoading = defers;
314 for (LocalFrame* frame = mainFrame(); frame; frame = frame->tree().traverseN ext()) 313 for (LocalFrame* frame = mainFrame(); frame; frame = frame->tree().traverseN ext())
315 frame->loader().setDefersLoading(defers); 314 frame->loader().setDefersLoading(defers);
316 } 315 }
317 316
318 void Page::setPageScaleFactor(float scale, const IntPoint& origin) 317 void Page::setPageScaleFactor(float scale, const IntPoint& origin)
319 { 318 {
320 FrameView* view = mainFrame()->view(); 319 FrameView* view = mainFrame()->view();
320 PinchViewport& viewport = frameHost().pinchViewport();
321 321
322 if (scale != m_pageScaleFactor) { 322 if (scale != viewport.scale()) {
323 m_pageScaleFactor = scale; 323 viewport.setScale(scale);
324 324
325 if (view) 325 if (view)
326 view->setVisibleContentScaleFactor(scale); 326 view->setVisibleContentScaleFactor(scale);
327 327
328 mainFrame()->deviceOrPageScaleFactorChanged(); 328 mainFrame()->deviceOrPageScaleFactorChanged();
329 m_chrome->client().deviceOrPageScaleFactorChanged(); 329 m_chrome->client().deviceOrPageScaleFactorChanged();
330 330
331 if (view) 331 if (view)
332 view->viewportConstrainedVisibleContentSizeChanged(true, true); 332 view->viewportConstrainedVisibleContentSizeChanged(true, true);
333 333
334 mainFrame()->loader().saveScrollState(); 334 mainFrame()->loader().saveScrollState();
335 } 335 }
336 336
337 if (view && view->scrollPosition() != origin) 337 if (view && view->scrollPosition() != origin)
338 view->notifyScrollPositionChanged(origin); 338 view->notifyScrollPositionChanged(origin);
339 } 339 }
340 340
341 float Page::pageScaleFactor() const
342 {
343 return frameHost().pinchViewport().scale();
344 }
345
341 void Page::setDeviceScaleFactor(float scaleFactor) 346 void Page::setDeviceScaleFactor(float scaleFactor)
342 { 347 {
343 if (m_deviceScaleFactor == scaleFactor) 348 if (m_deviceScaleFactor == scaleFactor)
344 return; 349 return;
345 350
346 m_deviceScaleFactor = scaleFactor; 351 m_deviceScaleFactor = scaleFactor;
347 setNeedsRecalcStyleInAllFrames(); 352 setNeedsRecalcStyleInAllFrames();
348 353
349 if (mainFrame()) { 354 if (mainFrame()) {
350 mainFrame()->deviceOrPageScaleFactorChanged(); 355 mainFrame()->deviceOrPageScaleFactorChanged();
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 , spellCheckerClient(0) 578 , spellCheckerClient(0)
574 , storageClient(0) 579 , storageClient(0)
575 { 580 {
576 } 581 }
577 582
578 Page::PageClients::~PageClients() 583 Page::PageClients::~PageClients()
579 { 584 {
580 } 585 }
581 586
582 } // namespace WebCore 587 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/Page.h ('k') | Source/platform/geometry/FloatPoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698