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

Side by Side 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: Moved min/max scale reset under the quirk condition, rebased 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/PageScaleConstraintsSet.h ('k') | Source/web/WebSettingsImpl.h » ('j') | 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 static float getLayoutWidthForNonWideViewport(const FloatSize& deviceSize, float initialScale) 127 static float getLayoutWidthForNonWideViewport(const FloatSize& deviceSize, float initialScale)
128 { 128 {
129 return initialScale == -1 ? deviceSize.width() : deviceSize.width() / initia lScale; 129 return initialScale == -1 ? deviceSize.width() : deviceSize.width() / initia lScale;
130 } 130 }
131 131
132 static float computeHeightByAspectRatio(float width, const FloatSize& deviceSize ) 132 static float computeHeightByAspectRatio(float width, const FloatSize& deviceSize )
133 { 133 {
134 return width * (deviceSize.height() / deviceSize.width()); 134 return width * (deviceSize.height() / deviceSize.width());
135 } 135 }
136 136
137 void PageScaleConstraintsSet::adjustForAndroidWebViewQuirks(const ViewportDescri ption& description, IntSize viewSize, int layoutFallbackWidth, float deviceScale Factor, bool supportTargetDensityDPI, bool wideViewportQuirkEnabled, bool useWid eViewport, bool loadWithOverviewMode) 137 void PageScaleConstraintsSet::adjustForAndroidWebViewQuirks(const ViewportDescri ption& description, IntSize viewSize, int layoutFallbackWidth, float deviceScale Factor, bool supportTargetDensityDPI, bool wideViewportQuirkEnabled, bool useWid eViewport, bool loadWithOverviewMode, bool nonUserScalableQuirkEnabled)
138 { 138 {
139 if (!supportTargetDensityDPI && !wideViewportQuirkEnabled && loadWithOvervie wMode) 139 if (!supportTargetDensityDPI && !wideViewportQuirkEnabled && loadWithOvervie wMode && !nonUserScalableQuirkEnabled)
140 return; 140 return;
141 141
142 const float oldInitialScale = m_pageDefinedConstraints.initialScale; 142 const float oldInitialScale = m_pageDefinedConstraints.initialScale;
143 if (!loadWithOverviewMode) { 143 if (!loadWithOverviewMode) {
144 bool resetInitialScale = false; 144 bool resetInitialScale = false;
145 if (description.zoom == -1) { 145 if (description.zoom == -1) {
146 if (description.maxWidth.isAuto()) 146 if (description.maxWidth.isAuto())
147 resetInitialScale = true; 147 resetInitialScale = true;
148 if (useWideViewport || description.maxWidth == Length(100, ViewportP ercentageWidth)) 148 if (useWideViewport || description.maxWidth == Length(100, ViewportP ercentageWidth))
149 resetInitialScale = true; 149 resetInitialScale = true;
(...skipping 27 matching lines...) Expand all
177 adjustedLayoutSizeWidth = getLayoutWidthForNonWideViewport(viewSize, nonWideScale) / targetDensityDPIFactor; 177 adjustedLayoutSizeWidth = getLayoutWidthForNonWideViewport(viewSize, nonWideScale) / targetDensityDPIFactor;
178 adjustedLayoutSizeHeight = computeHeightByAspectRatio(adjustedLayout SizeWidth, viewSize); 178 adjustedLayoutSizeHeight = computeHeightByAspectRatio(adjustedLayout SizeWidth, viewSize);
179 if (description.zoom < 1) { 179 if (description.zoom < 1) {
180 m_pageDefinedConstraints.initialScale = targetDensityDPIFactor; 180 m_pageDefinedConstraints.initialScale = targetDensityDPIFactor;
181 m_pageDefinedConstraints.minimumScale = std::min<float>(m_pageDe finedConstraints.minimumScale, m_pageDefinedConstraints.initialScale); 181 m_pageDefinedConstraints.minimumScale = std::min<float>(m_pageDe finedConstraints.minimumScale, m_pageDefinedConstraints.initialScale);
182 m_pageDefinedConstraints.maximumScale = std::max<float>(m_pageDe finedConstraints.maximumScale, m_pageDefinedConstraints.initialScale); 182 m_pageDefinedConstraints.maximumScale = std::max<float>(m_pageDe finedConstraints.maximumScale, m_pageDefinedConstraints.initialScale);
183 } 183 }
184 } 184 }
185 } 185 }
186 186
187 if (nonUserScalableQuirkEnabled && !description.userZoom) {
188 m_pageDefinedConstraints.initialScale = targetDensityDPIFactor;
189 m_pageDefinedConstraints.minimumScale = m_pageDefinedConstraints.initial Scale;
aelias_OOO_until_Jul13 2013/11/06 20:45:25 Hmm, I don't think this should've been moved here
190 m_pageDefinedConstraints.maximumScale = m_pageDefinedConstraints.initial Scale;
191 if (description.maxWidth.isAuto() || description.maxWidth.type() == Exte ndToZoom || description.maxWidth == Length(100, ViewportPercentageWidth)) {
192 adjustedLayoutSizeWidth = viewSize.width() / targetDensityDPIFactor;
193 adjustedLayoutSizeHeight = computeHeightByAspectRatio(adjustedLayout SizeWidth, viewSize);
194 }
195 }
196
187 m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth); 197 m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth);
188 m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight); 198 m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight);
189 } 199 }
190 200
191 } // namespace WebCore 201 } // namespace WebCore
OLDNEW
« 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