Chromium Code Reviews| Index: Source/core/page/PageScaleConstraintsSet.cpp |
| diff --git a/Source/core/page/PageScaleConstraintsSet.cpp b/Source/core/page/PageScaleConstraintsSet.cpp |
| index a5df3e1550f4d867b59bc540180127f51e668d75..439c99f6e69e042a272acd0f15a522902345fe1a 100644 |
| --- a/Source/core/page/PageScaleConstraintsSet.cpp |
| +++ b/Source/core/page/PageScaleConstraintsSet.cpp |
| @@ -49,9 +49,9 @@ PageScaleConstraints PageScaleConstraintsSet::defaultConstraints() const |
| return PageScaleConstraints(-1, defaultMinimumScale, defaultMaximumScale); |
| } |
| -void PageScaleConstraintsSet::updatePageDefinedConstraints(const ViewportArguments& arguments, IntSize viewSize, int layoutFallbackWidth) |
| +void PageScaleConstraintsSet::updatePageDefinedConstraints(const ViewportArguments& arguments, IntSize viewSize) |
| { |
| - m_pageDefinedConstraints = arguments.resolve(viewSize, viewSize, layoutFallbackWidth); |
| + m_pageDefinedConstraints = arguments.resolve(viewSize); |
| m_constraintsDirty = true; |
| } |
| @@ -121,9 +121,9 @@ static float getLayoutWidthForNonWideViewport(const FloatSize& deviceSize, float |
| void PageScaleConstraintsSet::adjustPageDefinedConstraintsForAndroidWebView(const ViewportArguments& arguments, IntSize viewSize, int layoutFallbackWidth, float deviceScaleFactor, bool useWideViewport, bool loadWithOverviewMode) |
| { |
| - float initialScale = m_pageDefinedConstraints.initialScale; |
| - if (arguments.zoom == -1 && !loadWithOverviewMode) { |
| - if (arguments.width == -1 || (useWideViewport && arguments.width != ViewportArguments::ValueDeviceWidth)) |
| + float zoom = m_pageDefinedConstraints.initialScale; |
| + if (zoom < 0 && !loadWithOverviewMode) { |
| + if (arguments.minWidth < 0 || useWideViewport) |
| m_pageDefinedConstraints.initialScale = 1.0f; |
| } |
| @@ -134,17 +134,24 @@ void PageScaleConstraintsSet::adjustPageDefinedConstraintsForAndroidWebView(cons |
| m_pageDefinedConstraints.maximumScale *= targetDensityDPIFactor; |
| float adjustedLayoutSizeWidth = m_pageDefinedConstraints.layoutSize.width(); |
| - if (useWideViewport && arguments.width == -1 && arguments.zoom != 1.0f) |
| + |
| + if (!useWideViewport) |
| + adjustedLayoutSizeWidth = getLayoutWidthForNonWideViewport(viewSize, zoom); |
| + |
| + adjustedLayoutSizeWidth /= targetDensityDPIFactor; |
| + |
| + // FIXME: Why this particular Android behavior? |
|
rune
2013/08/22 15:43:38
I've tried to take your CL and build it here local
rune
2013/08/26 21:32:24
After reading [1] and [2] it starts to be clearer
|
| + // |
| + // <meta name="viewport" content="initial-scale=2.0"> translates into: |
| + // @viewport { zoom: 2.0; width: extend-to-zoom; } according to the spec. |
| + // |
| + // But Android seems to convert the width into 'auto'; |
| + if (useWideViewport && arguments.maxWidth < 0 && arguments.zoom != 1.0f) |
| adjustedLayoutSizeWidth = layoutFallbackWidth; |
| - else { |
| - if (!useWideViewport) |
| - adjustedLayoutSizeWidth = getLayoutWidthForNonWideViewport(viewSize, initialScale); |
| - if (!useWideViewport || arguments.width == -1 || arguments.width == ViewportArguments::ValueDeviceWidth) |
| - adjustedLayoutSizeWidth /= targetDensityDPIFactor; |
| - } |
| ASSERT(m_pageDefinedConstraints.layoutSize.width() > 0); |
| float adjustedLayoutSizeHeight = (adjustedLayoutSizeWidth * m_pageDefinedConstraints.layoutSize.height()) / m_pageDefinedConstraints.layoutSize.width(); |
| + |
| m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth); |
| m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight); |
| } |