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

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: 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
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 return; 329 return;
331 330
332 m_defersLoading = defers; 331 m_defersLoading = defers;
333 for (LocalFrame* frame = mainFrame(); frame; frame = frame->tree().traverseN ext()) 332 for (LocalFrame* frame = mainFrame(); frame; frame = frame->tree().traverseN ext())
334 frame->loader().setDefersLoading(defers); 333 frame->loader().setDefersLoading(defers);
335 } 334 }
336 335
337 void Page::setPageScaleFactor(float scale, const IntPoint& origin) 336 void Page::setPageScaleFactor(float scale, const IntPoint& origin)
338 { 337 {
339 FrameView* view = mainFrame()->view(); 338 FrameView* view = mainFrame()->view();
339 PinchViewport& viewport = frameHost().pinchViewport();
340 340
341 if (scale != m_pageScaleFactor) { 341 if (scale != viewport.scale()) {
342 m_pageScaleFactor = scale; 342 viewport.setScale(scale);
343 343
344 if (view) 344 if (view)
345 view->setVisibleContentScaleFactor(scale); 345 view->setVisibleContentScaleFactor(scale);
346 346
347 mainFrame()->deviceOrPageScaleFactorChanged(); 347 mainFrame()->deviceOrPageScaleFactorChanged();
348 m_chrome->client().deviceOrPageScaleFactorChanged(); 348 m_chrome->client().deviceOrPageScaleFactorChanged();
349 349
350 if (view) 350 if (view)
351 view->viewportConstrainedVisibleContentSizeChanged(true, true); 351 view->viewportConstrainedVisibleContentSizeChanged(true, true);
352 352
353 mainFrame()->loader().saveScrollState(); 353 mainFrame()->loader().saveScrollState();
354 } 354 }
355 355
356 if (view && view->scrollPosition() != origin) 356 if (view && view->scrollPosition() != origin)
357 view->notifyScrollPositionChanged(origin); 357 view->notifyScrollPositionChanged(origin);
358 } 358 }
359 359
360 float Page::pageScaleFactor() const
361 {
362 return frameHost().pinchViewport().scale();
363 }
364
360 void Page::setDeviceScaleFactor(float scaleFactor) 365 void Page::setDeviceScaleFactor(float scaleFactor)
361 { 366 {
362 if (m_deviceScaleFactor == scaleFactor) 367 if (m_deviceScaleFactor == scaleFactor)
363 return; 368 return;
364 369
365 m_deviceScaleFactor = scaleFactor; 370 m_deviceScaleFactor = scaleFactor;
366 setNeedsRecalcStyleInAllFrames(); 371 setNeedsRecalcStyleInAllFrames();
367 372
368 if (mainFrame()) { 373 if (mainFrame()) {
369 mainFrame()->deviceOrPageScaleFactorChanged(); 374 mainFrame()->deviceOrPageScaleFactorChanged();
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 , spellCheckerClient(0) 551 , spellCheckerClient(0)
547 , storageClient(0) 552 , storageClient(0)
548 { 553 {
549 } 554 }
550 555
551 Page::PageClients::~PageClients() 556 Page::PageClients::~PageClients()
552 { 557 {
553 } 558 }
554 559
555 } // namespace WebCore 560 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698