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

Unified Diff: Source/web/PageScaleConstraintsSet.cpp

Issue 61593006: Zoom instead of autosizing for desktop sites. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address review comments. Created 7 years, 1 month 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 | « Source/web/PageScaleConstraintsSet.h ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/PageScaleConstraintsSet.cpp
diff --git a/Source/web/PageScaleConstraintsSet.cpp b/Source/web/PageScaleConstraintsSet.cpp
index b361be9ce18b7a5e6c70349c10fb53d7b7f8dae8..0c74a28be2cdc7526ae49f8057a9b1771dffc207 100644
--- a/Source/web/PageScaleConstraintsSet.cpp
+++ b/Source/web/PageScaleConstraintsSet.cpp
@@ -39,6 +39,7 @@ namespace WebKit {
static const float defaultMinimumScale = 0.25f;
static const float defaultMaximumScale = 5.0f;
+static const float minimumLayoutWidth = 980.0f;
aelias_OOO_until_Jul13 2013/11/07 22:02:50 ViewportDescription.minWidth.value() should always
skobes 2013/11/08 03:26:47 Done.
PageScaleConstraintsSet::PageScaleConstraintsSet()
: m_lastContentsWidth(0)
@@ -182,4 +183,13 @@ void PageScaleConstraintsSet::adjustForAndroidWebViewQuirks(const ViewportDescri
}
}
+void PageScaleConstraintsSet::applyDeviceScaleAdjustment(const ViewportDescription& viewportDescription, float deviceScaleAdjustment)
+{
+ // If possible, reduce the layout width instead of applying text autosizing.
+ // But don't reduce below the minimum fallback width and don't reduce if explicitly specified by the page author.
+ float width = m_pageDefinedConstraints.layoutSize.width();
+ if (width > minimumLayoutWidth && !viewportDescription.isSpecifiedByAuthor())
aelias_OOO_until_Jul13 2013/11/07 22:02:50 Please delete the condition "width > minimumLayout
skobes 2013/11/08 03:26:47 Done.
+ m_pageDefinedConstraints.layoutSize.setWidth(std::max(minimumLayoutWidth, width / deviceScaleAdjustment));
+}
+
} // namespace WebCore
« no previous file with comments | « Source/web/PageScaleConstraintsSet.h ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698