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

Unified Diff: third_party/WebKit/Source/core/page/Page.cpp

Issue 2722773002: Moved FrameHost::setDefaultPageScaleLimits/UserAgentPageScaleConstraints (Closed)
Patch Set: Rebase Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/page/Page.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/page/Page.cpp
diff --git a/third_party/WebKit/Source/core/page/Page.cpp b/third_party/WebKit/Source/core/page/Page.cpp
index 1f6910aa91d0e0d0b915c6952fae75daacec222e..cb46ff7839871e4e42121a95f384be650f53f522 100644
--- a/third_party/WebKit/Source/core/page/Page.cpp
+++ b/third_party/WebKit/Source/core/page/Page.cpp
@@ -34,6 +34,7 @@
#include "core/frame/FrameConsole.h"
#include "core/frame/FrameHost.h"
#include "core/frame/FrameView.h"
+#include "core/frame/PageScaleConstraints.h"
#include "core/frame/PageScaleConstraintsSet.h"
#include "core/frame/RemoteFrame.h"
#include "core/frame/RemoteFrameView.h"
@@ -256,6 +257,48 @@ void Page::setSuspended(bool suspended) {
}
}
+void Page::setDefaultPageScaleLimits(float minScale, float maxScale) {
+ PageScaleConstraints newDefaults =
+ pageScaleConstraintsSet().defaultConstraints();
+ newDefaults.minimumScale = minScale;
+ newDefaults.maximumScale = maxScale;
+
+ if (newDefaults == pageScaleConstraintsSet().defaultConstraints())
+ return;
+
+ pageScaleConstraintsSet().setDefaultConstraints(newDefaults);
+ pageScaleConstraintsSet().computeFinalConstraints();
+ pageScaleConstraintsSet().setNeedsReset(true);
+
+ if (!mainFrame() || !mainFrame()->isLocalFrame())
+ return;
+
+ FrameView* rootView = deprecatedLocalMainFrame()->view();
+
+ if (!rootView)
+ return;
+
+ rootView->setNeedsLayout();
+}
+
+void Page::setUserAgentPageScaleConstraints(
+ const PageScaleConstraints& newConstraints) {
+ if (newConstraints == pageScaleConstraintsSet().userAgentConstraints())
+ return;
+
+ pageScaleConstraintsSet().setUserAgentConstraints(newConstraints);
+
+ if (!mainFrame() || !mainFrame()->isLocalFrame())
+ return;
+
+ FrameView* rootView = deprecatedLocalMainFrame()->view();
+
+ if (!rootView)
+ return;
+
+ rootView->setNeedsLayout();
+}
+
void Page::setPageScaleFactor(float scale) {
frameHost().visualViewport().setScale(scale);
}
« 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