Index: Source/core/dom/ViewportArguments.cpp |
diff --git a/Source/core/dom/ViewportArguments.cpp b/Source/core/dom/ViewportArguments.cpp |
index 8593f84c5e24c65a599df23b63b1bd621cda4c43..b8125bcd3267a9a2da9ac76e604aa2f7a758504b 100644 |
--- a/Source/core/dom/ViewportArguments.cpp |
+++ b/Source/core/dom/ViewportArguments.cpp |
@@ -140,10 +140,10 @@ PageScaleConstraints ViewportArguments::resolve(const FloatSize& initialViewport |
} |
if (resultMinWidth != ViewportArguments::ValueAuto || resultMaxWidth != ViewportArguments::ValueAuto) |
- resultWidth = compareIgnoringAuto(resultMinWidth, compareIgnoringAuto(resultMaxWidth, deviceSize.width(), min), max); |
+ resultWidth = compareIgnoringAuto(resultMinWidth, compareIgnoringAuto(resultMaxWidth, initialViewportSize.width(), min), max); |
if (resultMinHeight != ViewportArguments::ValueAuto || resultMaxHeight != ViewportArguments::ValueAuto) |
- resultHeight = compareIgnoringAuto(resultMinHeight, compareIgnoringAuto(resultMaxHeight, deviceSize.height(), min), max); |
+ resultHeight = compareIgnoringAuto(resultMinHeight, compareIgnoringAuto(resultMaxHeight, initialViewportSize.height(), min), max); |
if (resultMinZoom != ViewportArguments::ValueAuto && resultMaxZoom != ViewportArguments::ValueAuto) |
resultMaxZoom = max(resultMinZoom, resultMaxZoom); |
@@ -151,25 +151,18 @@ PageScaleConstraints ViewportArguments::resolve(const FloatSize& initialViewport |
if (resultZoom != ViewportArguments::ValueAuto) |
resultZoom = compareIgnoringAuto(resultMinZoom, compareIgnoringAuto(resultMaxZoom, resultZoom, min), max); |
- if (resultWidth == ViewportArguments::ValueAuto && resultZoom == ViewportArguments::ValueAuto) |
- resultWidth = deviceSize.width(); |
- |
- if (resultWidth == ViewportArguments::ValueAuto && resultHeight == ViewportArguments::ValueAuto) |
- resultWidth = deviceSize.width() / resultZoom; |
+ if (resultWidth == ViewportArguments::ValueAuto && (resultHeight == ViewportArguments::ValueAuto || !initialViewportSize.height())) |
+ resultWidth = initialViewportSize.width(); |
if (resultWidth == ViewportArguments::ValueAuto) |
- resultWidth = resultHeight * deviceSize.width() / deviceSize.height(); |
- |
- if (resultHeight == ViewportArguments::ValueAuto) |
- resultHeight = resultWidth * deviceSize.height() / deviceSize.width(); |
+ resultWidth = resultHeight * initialViewportSize.width() / initialViewportSize.height(); |
kenneth.r.christiansen
2013/06/13 13:46:42
I am a bit afraid that this might break Android,
Peter Beverloo
2013/06/28 01:13:51
Can you please add an ASSERT() to ensure that init
rune
2013/07/03 08:01:52
Added.
|
- if (resultZoom != ViewportArguments::ValueAuto || resultMaxZoom != ViewportArguments::ValueAuto) { |
- resultWidth = compareIgnoringAuto(resultWidth, deviceSize.width() / compareIgnoringAuto(resultZoom, resultMaxZoom, min), max); |
- resultHeight = compareIgnoringAuto(resultHeight, deviceSize.height() / compareIgnoringAuto(resultZoom, resultMaxZoom, min), max); |
+ if (resultHeight == ViewportArguments::ValueAuto) { |
+ if (!initialViewportSize.width()) |
+ resultHeight = initialViewportSize.height(); |
+ else |
+ resultHeight = resultWidth * initialViewportSize.height() / initialViewportSize.width(); |
} |
- |
- resultWidth = max<float>(1, resultWidth); |
- resultHeight = max<float>(1, resultHeight); |
} |
if (type != ViewportArguments::CSSDeviceAdaptation && type != ViewportArguments::Implicit) { |
@@ -201,9 +194,9 @@ PageScaleConstraints ViewportArguments::resolve(const FloatSize& initialViewport |
result.initialScale = resultZoom; |
if (resultZoom == ViewportArguments::ValueAuto) { |
result.initialScale = initialViewportSize.width() / defaultWidth; |
- if (resultWidth != ViewportArguments::ValueAuto) |
+ if (resultWidth != ViewportArguments::ValueAuto && resultWidth > 0) |
result.initialScale = initialViewportSize.width() / resultWidth; |
- if (resultHeight != ViewportArguments::ValueAuto) { |
+ if (resultHeight != ViewportArguments::ValueAuto && resultHeight > 0) { |
// if 'auto', the initial-scale will be negative here and thus ignored. |
result.initialScale = max<float>(result.initialScale, initialViewportSize.height() / resultHeight); |
} |