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

Unified Diff: Source/web/PageScaleConstraintsSet.cpp

Issue 53053002: [Android WebView] Add a legacy quirk for 'user-scalable=no' case (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move the setting into WebSettingsImpl Created 7 years, 2 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 | « Source/web/PageScaleConstraintsSet.h ('k') | Source/web/WebSettingsImpl.h » ('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 582c27fce1427446acfd83a516d60c0ab7d01569..e40d6bce553eb29b08bad1fc51560c39c14bd797 100644
--- a/Source/web/PageScaleConstraintsSet.cpp
+++ b/Source/web/PageScaleConstraintsSet.cpp
@@ -123,9 +123,9 @@ static float getLayoutWidthForNonWideViewport(const FloatSize& deviceSize, float
return initialScale == -1 ? deviceSize.width() : deviceSize.width() / initialScale;
}
-void PageScaleConstraintsSet::adjustForAndroidWebViewQuirks(const ViewportDescription& description, IntSize viewSize, int layoutFallbackWidth, float deviceScaleFactor, bool supportTargetDensityDPI, bool wideViewportQuirkEnabled, bool useWideViewport, bool loadWithOverviewMode)
+void PageScaleConstraintsSet::adjustForAndroidWebViewQuirks(const ViewportDescription& description, IntSize viewSize, int layoutFallbackWidth, float deviceScaleFactor, bool supportTargetDensityDPI, bool wideViewportQuirkEnabled, bool useWideViewport, bool loadWithOverviewMode, bool nonUserScalableQuirkEnabled)
{
- if (!supportTargetDensityDPI && !wideViewportQuirkEnabled && loadWithOverviewMode)
+ if (!supportTargetDensityDPI && !wideViewportQuirkEnabled && loadWithOverviewMode && !nonUserScalableQuirkEnabled)
return;
const float oldInitialScale = m_pageDefinedConstraints.initialScale;
@@ -140,6 +140,11 @@ void PageScaleConstraintsSet::adjustForAndroidWebViewQuirks(const ViewportDescri
if (resetInitialScale)
m_pageDefinedConstraints.initialScale = 1.0f;
}
+ if (nonUserScalableQuirkEnabled && !description.userZoom) {
+ m_pageDefinedConstraints.initialScale = 1.0f;
+ m_pageDefinedConstraints.minimumScale = 1.0f;
+ m_pageDefinedConstraints.maximumScale = 1.0f;
+ }
float adjustedLayoutSizeWidth = m_pageDefinedConstraints.layoutSize.width();
float targetDensityDPIFactor = 1.0f;
@@ -155,12 +160,13 @@ void PageScaleConstraintsSet::adjustForAndroidWebViewQuirks(const ViewportDescri
}
if (wideViewportQuirkEnabled) {
- if (useWideViewport && (description.maxWidth.isAuto() || description.maxWidth.type() == ExtendToZoom) && description.zoom != 1.0f) {
+ const bool nonUserScalable = nonUserScalableQuirkEnabled && !description.userZoom;
+ if (useWideViewport && (description.maxWidth.isAuto() || description.maxWidth.type() == ExtendToZoom) && description.zoom != 1.0f && !nonUserScalable) {
adjustedLayoutSizeWidth = layoutFallbackWidth;
- } else if (!useWideViewport) {
- const float nonWideScale = description.zoom < 1 && !description.maxWidth.isViewportPercentage() ? -1 : oldInitialScale;
+ } else if (!useWideViewport || (nonUserScalable && (description.maxWidth.isAuto() || description.maxWidth.type() == ExtendToZoom || !description.maxWidth.isFixed()))) {
+ const float nonWideScale = nonUserScalable || (description.zoom < 1 && !description.maxWidth.isViewportPercentage()) ? -1 : oldInitialScale;
adjustedLayoutSizeWidth = getLayoutWidthForNonWideViewport(viewSize, nonWideScale) / targetDensityDPIFactor;
- if (description.zoom < 1) {
+ if (nonUserScalable || description.zoom < 1) {
m_pageDefinedConstraints.initialScale = targetDensityDPIFactor;
m_pageDefinedConstraints.minimumScale = std::min<float>(m_pageDefinedConstraints.minimumScale, m_pageDefinedConstraints.initialScale);
m_pageDefinedConstraints.maximumScale = std::max<float>(m_pageDefinedConstraints.maximumScale, m_pageDefinedConstraints.initialScale);
« no previous file with comments | « Source/web/PageScaleConstraintsSet.h ('k') | Source/web/WebSettingsImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698