| Index: Source/core/dom/ViewportArguments.cpp
|
| diff --git a/Source/core/dom/ViewportArguments.cpp b/Source/core/dom/ViewportArguments.cpp
|
| index a8a70b7fcd85e53de65b948a8fb405c3505fb0f0..8593f84c5e24c65a599df23b63b1bd621cda4c43 100644
|
| --- a/Source/core/dom/ViewportArguments.cpp
|
| +++ b/Source/core/dom/ViewportArguments.cpp
|
| @@ -36,8 +36,6 @@ using namespace std;
|
|
|
| namespace WebCore {
|
|
|
| -const float ViewportArguments::deprecatedTargetDPI = 160;
|
| -
|
| static const float& compareIgnoringAuto(const float& value1, const float& value2, const float& (*compare) (const float&, const float&))
|
| {
|
| ASSERT(value1 != ViewportArguments::ValueAuto || value2 != ViewportArguments::ValueAuto);
|
| @@ -73,7 +71,7 @@ static inline float clampScaleValue(float value)
|
| return value;
|
| }
|
|
|
| -ViewportAttributes ViewportArguments::resolve(const FloatSize& initialViewportSize, const FloatSize& deviceSize, int defaultWidth) const
|
| +PageScaleConstraints ViewportArguments::resolve(const FloatSize& initialViewportSize, const FloatSize& deviceSize, int defaultWidth) const
|
| {
|
| float resultWidth = width;
|
| float resultMaxWidth = maxWidth;
|
| @@ -184,8 +182,7 @@ ViewportAttributes ViewportArguments::resolve(const FloatSize& initialViewportSi
|
| resultMaxZoom = clampScaleValue(resultMaxZoom);
|
| }
|
|
|
| - ViewportAttributes result;
|
| - result.orientation = orientation;
|
| + PageScaleConstraints result;
|
|
|
| // Resolve minimum-scale and maximum-scale values according to spec.
|
| if (resultMinZoom == ViewportArguments::ValueAuto)
|
| @@ -238,52 +235,18 @@ ViewportAttributes ViewportArguments::resolve(const FloatSize& initialViewportSi
|
| result.layoutSize.setWidth(resultWidth);
|
| result.layoutSize.setHeight(resultHeight);
|
|
|
| - // FIXME: This might affect some ports, but is the right thing to do.
|
| - // Only set initialScale to a value if it was explicitly set.
|
| - // if (resultZoom == ViewportArguments::ValueAuto)
|
| - // result.initialScale = ViewportArguments::ValueAuto;
|
| -
|
| - result.userScalable = resultUserZoom;
|
| - result.orientation = orientation;
|
| + // If user-scalable = no, lock the min/max scale to the computed initial
|
| + // scale.
|
| + if (!resultUserZoom)
|
| + result.maximumScale = result.minimumScale = result.initialScale;
|
|
|
| - return result;
|
| -}
|
| + // Only set initialScale to a value if it was explicitly set.
|
| + if (resultZoom == ViewportArguments::ValueAuto)
|
| + result.initialScale = ViewportArguments::ValueAuto;
|
|
|
| -static FloatSize convertToUserSpace(const FloatSize& deviceSize, float devicePixelRatio)
|
| -{
|
| - FloatSize result = deviceSize;
|
| - if (devicePixelRatio != 1)
|
| - result.scale(1 / devicePixelRatio);
|
| return result;
|
| }
|
|
|
| -ViewportAttributes computeViewportAttributes(ViewportArguments args, int desktopWidth, int deviceWidth, int deviceHeight, float devicePixelRatio, IntSize visibleViewport)
|
| -{
|
| - FloatSize initialViewportSize = convertToUserSpace(visibleViewport, devicePixelRatio);
|
| - FloatSize deviceSize = convertToUserSpace(FloatSize(deviceWidth, deviceHeight), devicePixelRatio);
|
| -
|
| - return args.resolve(initialViewportSize, deviceSize, desktopWidth);
|
| -}
|
| -
|
| -float computeMinimumScaleFactorForContentContained(const ViewportAttributes& result, const IntSize& visibleViewport, const IntSize& contentsSize)
|
| -{
|
| - FloatSize viewportSize(visibleViewport);
|
| - return max<float>(result.minimumScale, max(viewportSize.width() / contentsSize.width(), viewportSize.height() / contentsSize.height()));
|
| -}
|
| -
|
| -void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSize visibleViewport, float devicePixelRatio)
|
| -{
|
| - FloatSize viewportSize = convertToUserSpace(visibleViewport, devicePixelRatio);
|
| -
|
| - result.minimumScale = max<float>(result.minimumScale, max(viewportSize.width() / result.layoutSize.width(), viewportSize.height() / result.layoutSize.height()));
|
| -}
|
| -
|
| -void restrictScaleFactorToInitialScaleIfNotUserScalable(ViewportAttributes& result)
|
| -{
|
| - if (!result.userScalable)
|
| - result.maximumScale = result.minimumScale = result.initialScale;
|
| -}
|
| -
|
| static float numericPrefix(const String& keyString, const String& valueString, Document* document, bool* ok = 0)
|
| {
|
| size_t parsedLength;
|
|
|