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

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

Issue 2722773002: Moved FrameHost::setDefaultPageScaleLimits/UserAgentPageScaleConstraints (Closed)
Patch Set: Rebase Created 3 years, 9 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 | « third_party/WebKit/Source/core/page/Page.h ('k') | no next file » | 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 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All
3 * Rights Reserved. 3 * Rights Reserved.
4 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. 4 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved.
5 * (http://www.torchmobile.com/) 5 * (http://www.torchmobile.com/)
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 16 matching lines...) Expand all
27 #include "core/dom/StyleChangeReason.h" 27 #include "core/dom/StyleChangeReason.h"
28 #include "core/dom/StyleEngine.h" 28 #include "core/dom/StyleEngine.h"
29 #include "core/dom/VisitedLinkState.h" 29 #include "core/dom/VisitedLinkState.h"
30 #include "core/editing/DragCaret.h" 30 #include "core/editing/DragCaret.h"
31 #include "core/editing/markers/DocumentMarkerController.h" 31 #include "core/editing/markers/DocumentMarkerController.h"
32 #include "core/events/Event.h" 32 #include "core/events/Event.h"
33 #include "core/frame/DOMTimer.h" 33 #include "core/frame/DOMTimer.h"
34 #include "core/frame/FrameConsole.h" 34 #include "core/frame/FrameConsole.h"
35 #include "core/frame/FrameHost.h" 35 #include "core/frame/FrameHost.h"
36 #include "core/frame/FrameView.h" 36 #include "core/frame/FrameView.h"
37 #include "core/frame/PageScaleConstraints.h"
37 #include "core/frame/PageScaleConstraintsSet.h" 38 #include "core/frame/PageScaleConstraintsSet.h"
38 #include "core/frame/RemoteFrame.h" 39 #include "core/frame/RemoteFrame.h"
39 #include "core/frame/RemoteFrameView.h" 40 #include "core/frame/RemoteFrameView.h"
40 #include "core/frame/Settings.h" 41 #include "core/frame/Settings.h"
41 #include "core/frame/VisualViewport.h" 42 #include "core/frame/VisualViewport.h"
42 #include "core/html/HTMLMediaElement.h" 43 #include "core/html/HTMLMediaElement.h"
43 #include "core/inspector/ConsoleMessageStorage.h" 44 #include "core/inspector/ConsoleMessageStorage.h"
44 #include "core/inspector/InspectorInstrumentation.h" 45 #include "core/inspector/InspectorInstrumentation.h"
45 #include "core/layout/TextAutosizer.h" 46 #include "core/layout/TextAutosizer.h"
46 #include "core/page/AutoscrollController.h" 47 #include "core/page/AutoscrollController.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 for (Frame* frame = mainFrame(); frame; 250 for (Frame* frame = mainFrame(); frame;
250 frame = frame->tree().traverseNext()) { 251 frame = frame->tree().traverseNext()) {
251 if (!frame->isLocalFrame()) 252 if (!frame->isLocalFrame())
252 continue; 253 continue;
253 LocalFrame* localFrame = toLocalFrame(frame); 254 LocalFrame* localFrame = toLocalFrame(frame);
254 localFrame->loader().setDefersLoading(suspended); 255 localFrame->loader().setDefersLoading(suspended);
255 localFrame->frameScheduler()->setSuspended(suspended); 256 localFrame->frameScheduler()->setSuspended(suspended);
256 } 257 }
257 } 258 }
258 259
260 void Page::setDefaultPageScaleLimits(float minScale, float maxScale) {
261 PageScaleConstraints newDefaults =
262 pageScaleConstraintsSet().defaultConstraints();
263 newDefaults.minimumScale = minScale;
264 newDefaults.maximumScale = maxScale;
265
266 if (newDefaults == pageScaleConstraintsSet().defaultConstraints())
267 return;
268
269 pageScaleConstraintsSet().setDefaultConstraints(newDefaults);
270 pageScaleConstraintsSet().computeFinalConstraints();
271 pageScaleConstraintsSet().setNeedsReset(true);
272
273 if (!mainFrame() || !mainFrame()->isLocalFrame())
274 return;
275
276 FrameView* rootView = deprecatedLocalMainFrame()->view();
277
278 if (!rootView)
279 return;
280
281 rootView->setNeedsLayout();
282 }
283
284 void Page::setUserAgentPageScaleConstraints(
285 const PageScaleConstraints& newConstraints) {
286 if (newConstraints == pageScaleConstraintsSet().userAgentConstraints())
287 return;
288
289 pageScaleConstraintsSet().setUserAgentConstraints(newConstraints);
290
291 if (!mainFrame() || !mainFrame()->isLocalFrame())
292 return;
293
294 FrameView* rootView = deprecatedLocalMainFrame()->view();
295
296 if (!rootView)
297 return;
298
299 rootView->setNeedsLayout();
300 }
301
259 void Page::setPageScaleFactor(float scale) { 302 void Page::setPageScaleFactor(float scale) {
260 frameHost().visualViewport().setScale(scale); 303 frameHost().visualViewport().setScale(scale);
261 } 304 }
262 305
263 float Page::pageScaleFactor() const { 306 float Page::pageScaleFactor() const {
264 return frameHost().visualViewport().scale(); 307 return frameHost().visualViewport().scale();
265 } 308 }
266 309
267 void Page::setDeviceScaleFactorDeprecated(float scaleFactor) { 310 void Page::setDeviceScaleFactorDeprecated(float scaleFactor) {
268 if (m_deviceScaleFactor == scaleFactor) 311 if (m_deviceScaleFactor == scaleFactor)
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 : chromeClient(nullptr), 583 : chromeClient(nullptr),
541 contextMenuClient(nullptr), 584 contextMenuClient(nullptr),
542 editorClient(nullptr), 585 editorClient(nullptr),
543 spellCheckerClient(nullptr) {} 586 spellCheckerClient(nullptr) {}
544 587
545 Page::PageClients::~PageClients() {} 588 Page::PageClients::~PageClients() {}
546 589
547 template class CORE_TEMPLATE_EXPORT Supplement<Page>; 590 template class CORE_TEMPLATE_EXPORT Supplement<Page>;
548 591
549 } // namespace blink 592 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/Page.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698