summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/ViewportArguments.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/dom/ViewportArguments.h')
-rw-r--r--Source/WebCore/dom/ViewportArguments.h73
1 files changed, 23 insertions, 50 deletions
diff --git a/Source/WebCore/dom/ViewportArguments.h b/Source/WebCore/dom/ViewportArguments.h
index e45e3cfd3..4e6907f58 100644
--- a/Source/WebCore/dom/ViewportArguments.h
+++ b/Source/WebCore/dom/ViewportArguments.h
@@ -25,8 +25,7 @@
*
*/
-#ifndef ViewportArguments_h
-#define ViewportArguments_h
+#pragma once
#include "FloatSize.h"
#include <wtf/Forward.h>
@@ -51,6 +50,7 @@ struct ViewportAttributes {
float userScalable;
float orientation;
+ float shrinkToFit;
};
struct ViewportArguments {
@@ -58,11 +58,6 @@ struct ViewportArguments {
enum Type {
// These are ordered in increasing importance.
Implicit,
-#if ENABLE(LEGACY_VIEWPORT_ADAPTION)
- XHTMLMobileProfile,
- HandheldFriendlyMeta,
- MobileOptimizedMeta,
-#endif
#if PLATFORM(IOS)
PluginDocument,
ImageDocument,
@@ -81,49 +76,30 @@ struct ViewportArguments {
explicit ViewportArguments(Type type = Implicit)
: type(type)
- , width(ValueAuto)
- , minWidth(ValueAuto)
- , maxWidth(ValueAuto)
- , height(ValueAuto)
- , minHeight(ValueAuto)
- , maxHeight(ValueAuto)
- , zoom(ValueAuto)
- , minZoom(ValueAuto)
- , maxZoom(ValueAuto)
- , userZoom(ValueAuto)
- , orientation(ValueAuto)
-#if PLATFORM(IOS)
- , minimalUI(false)
-#endif
{
}
// All arguments are in CSS units.
ViewportAttributes resolve(const FloatSize& initialViewportSize, const FloatSize& deviceSize, int defaultWidth) const;
- float width;
- float minWidth;
- float maxWidth;
- float height;
- float minHeight;
- float maxHeight;
- float zoom;
- float minZoom;
- float maxZoom;
- float userZoom;
- float orientation;
-#if PLATFORM(IOS)
- bool minimalUI;
-#endif
+ float width { ValueAuto };
+ float minWidth { ValueAuto };
+ float maxWidth { ValueAuto };
+ float height { ValueAuto };
+ float minHeight { ValueAuto };
+ float maxHeight { ValueAuto };
+ float zoom { ValueAuto };
+ float minZoom { ValueAuto };
+ float maxZoom { ValueAuto };
+ float userZoom { ValueAuto };
+ float orientation { ValueAuto };
+ float shrinkToFit { ValueAuto };
+ bool widthWasExplicit { false };
bool operator==(const ViewportArguments& other) const
{
// Used for figuring out whether to reset the viewport or not,
// thus we are not taking type into account.
-#if PLATFORM(IOS)
- // We ignore minimalUI for the same reason -- it is a higher-level
- // property that doesn't affect the actual viewport.
-#endif
return width == other.width
&& minWidth == other.minWidth
&& maxWidth == other.maxWidth
@@ -134,7 +110,9 @@ struct ViewportArguments {
&& minZoom == other.minZoom
&& maxZoom == other.maxZoom
&& userZoom == other.userZoom
- && orientation == other.orientation;
+ && orientation == other.orientation
+ && shrinkToFit == other.shrinkToFit
+ && widthWasExplicit == other.widthWasExplicit;
}
bool operator!=(const ViewportArguments& other) const
@@ -149,19 +127,14 @@ struct ViewportArguments {
#endif
};
-ViewportAttributes computeViewportAttributes(ViewportArguments args, int desktopWidth, int deviceWidth, int deviceHeight, float devicePixelRatio, IntSize visibleViewport);
+WEBCORE_EXPORT ViewportAttributes computeViewportAttributes(ViewportArguments args, int desktopWidth, int deviceWidth, int deviceHeight, float devicePixelRatio, IntSize visibleViewport);
-void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSize visibleViewport, float devicePixelRatio);
-void restrictScaleFactorToInitialScaleIfNotUserScalable(ViewportAttributes& result);
+WEBCORE_EXPORT void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSize visibleViewport, float devicePixelRatio);
+WEBCORE_EXPORT void restrictScaleFactorToInitialScaleIfNotUserScalable(ViewportAttributes& result);
float computeMinimumScaleFactorForContentContained(const ViewportAttributes& result, const IntSize& viewportSize, const IntSize& contentSize);
-void setViewportFeature(const String& keyString, const String& valueString, Document*, void* data);
-void reportViewportWarning(Document*, ViewportErrorCode, const String& replacement1, const String& replacement2);
+void setViewportFeature(ViewportArguments&, Document&, StringView key, StringView value);
-#if PLATFORM(IOS)
-void finalizeViewportArguments(ViewportArguments&);
-#endif
+TextStream& operator<<(TextStream&, const ViewportArguments&);
} // namespace WebCore
-
-#endif // ViewportArguments_h