| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 9 * Copyright (C) 2012-2013 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012-2013 Intel Corporation. All rights reserved. |
| 10 * | 10 * |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * along with this library; see the file COPYING.LIB. If not, write to | 22 * along with this library; see the file COPYING.LIB. If not, write to |
| 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 24 * Boston, MA 02110-1301, USA. | 24 * Boston, MA 02110-1301, USA. |
| 25 * | 25 * |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #ifndef ViewportArguments_h | 28 #ifndef ViewportArguments_h |
| 29 #define ViewportArguments_h | 29 #define ViewportArguments_h |
| 30 | 30 |
| 31 #include "core/page/PageScaleConstraints.h" | 31 #include "core/page/PageScaleConstraints.h" |
| 32 #include "core/platform/Length.h" |
| 32 #include "core/platform/graphics/FloatSize.h" | 33 #include "core/platform/graphics/FloatSize.h" |
| 33 #include "wtf/Forward.h" | 34 #include "wtf/Forward.h" |
| 34 | 35 |
| 35 namespace WebCore { | 36 namespace WebCore { |
| 36 | 37 |
| 37 class Document; | 38 class Document; |
| 38 | 39 |
| 39 enum ViewportErrorCode { | 40 enum ViewportErrorCode { |
| 40 UnrecognizedViewportArgumentKeyError, | 41 UnrecognizedViewportArgumentKeyError, |
| 41 UnrecognizedViewportArgumentValueError, | 42 UnrecognizedViewportArgumentValueError, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 65 ValueDeviceDPI = -6, | 66 ValueDeviceDPI = -6, |
| 66 ValueLowDPI = -7, | 67 ValueLowDPI = -7, |
| 67 ValueMediumDPI = -8, | 68 ValueMediumDPI = -8, |
| 68 ValueHighDPI = -9, | 69 ValueHighDPI = -9, |
| 69 ValueExtendToZoom = -10 | 70 ValueExtendToZoom = -10 |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 ViewportArguments(Type type = Implicit) | 73 ViewportArguments(Type type = Implicit) |
| 73 : type(type) | 74 : type(type) |
| 74 , width(ValueAuto) | 75 , width(ValueAuto) |
| 75 , minWidth(ValueAuto) | |
| 76 , maxWidth(ValueAuto) | |
| 77 , height(ValueAuto) | 76 , height(ValueAuto) |
| 78 , minHeight(ValueAuto) | |
| 79 , maxHeight(ValueAuto) | |
| 80 , zoom(ValueAuto) | 77 , zoom(ValueAuto) |
| 81 , minZoom(ValueAuto) | 78 , minZoom(ValueAuto) |
| 82 , maxZoom(ValueAuto) | 79 , maxZoom(ValueAuto) |
| 83 , userZoom(ValueAuto) | 80 , userZoom(ValueAuto) |
| 84 , orientation(ValueAuto) | 81 , orientation(ValueAuto) |
| 85 , deprecatedTargetDensityDPI(ValueAuto) | 82 , deprecatedTargetDensityDPI(ValueAuto) |
| 86 { | 83 { |
| 87 } | 84 } |
| 88 | 85 |
| 89 // All arguments are in CSS units. | 86 // All arguments are in CSS units. |
| 90 PageScaleConstraints resolve(const FloatSize& initialViewportSize, const Flo
atSize& deviceSize, int defaultWidth) const; | 87 PageScaleConstraints resolve(const FloatSize& initialViewportSize, const Flo
atSize& deviceSize, int defaultWidth) const; |
| 91 | 88 |
| 92 float width; | 89 float width; |
| 93 float minWidth; | 90 Length minWidth; |
| 94 float maxWidth; | 91 Length maxWidth; |
| 95 float height; | 92 float height; |
| 96 float minHeight; | 93 Length minHeight; |
| 97 float maxHeight; | 94 Length maxHeight; |
| 98 float zoom; | 95 float zoom; |
| 99 float minZoom; | 96 float minZoom; |
| 100 float maxZoom; | 97 float maxZoom; |
| 101 float userZoom; | 98 float userZoom; |
| 102 float orientation; | 99 float orientation; |
| 103 float deprecatedTargetDensityDPI; // Only used for Android WebView | 100 float deprecatedTargetDensityDPI; // Only used for Android WebView |
| 104 | 101 |
| 105 bool operator==(const ViewportArguments& other) const | 102 bool operator==(const ViewportArguments& other) const |
| 106 { | 103 { |
| 107 // Used for figuring out whether to reset the viewport or not, | 104 // Used for figuring out whether to reset the viewport or not, |
| 108 // thus we are not taking type into account. | 105 // thus we are not taking type into account. |
| 109 return width == other.width | 106 return width == other.width |
| 110 && minWidth == other.minWidth | 107 && minWidth == other.minWidth |
| 111 && maxWidth == other.maxWidth | 108 && maxWidth == other.maxWidth |
| 112 && height == other.height | 109 && height == other.height |
| 113 && minHeight == other.minHeight | 110 && minHeight == other.minHeight |
| 114 && maxHeight == other.maxHeight | 111 && maxHeight == other.maxHeight |
| 115 && zoom == other.zoom | 112 && zoom == other.zoom |
| 116 && minZoom == other.minZoom | 113 && minZoom == other.minZoom |
| 117 && maxZoom == other.maxZoom | 114 && maxZoom == other.maxZoom |
| 118 && userZoom == other.userZoom | 115 && userZoom == other.userZoom |
| 119 && orientation == other.orientation | 116 && orientation == other.orientation |
| 120 && deprecatedTargetDensityDPI == other.deprecatedTargetDensityDPI; | 117 && deprecatedTargetDensityDPI == other.deprecatedTargetDensityDPI; |
| 121 } | 118 } |
| 122 | 119 |
| 123 bool operator!=(const ViewportArguments& other) const | 120 bool operator!=(const ViewportArguments& other) const |
| 124 { | 121 { |
| 125 return !(*this == other); | 122 return !(*this == other); |
| 126 } | 123 } |
| 124 |
| 125 private: |
| 126 enum Direction { Horizontal, Vertical }; |
| 127 static float resolveViewportLength(const Length&, const FloatSize& initialVi
ewportSize, Direction); |
| 127 }; | 128 }; |
| 128 | 129 |
| 129 void setViewportFeature(const String& keyString, const String& valueString, Docu
ment*, void* data); | 130 void setViewportFeature(const String& keyString, const String& valueString, Docu
ment*, void* data); |
| 130 void reportViewportWarning(Document*, ViewportErrorCode, const String& replaceme
nt1, const String& replacement2); | 131 void reportViewportWarning(Document*, ViewportErrorCode, const String& replaceme
nt1, const String& replacement2); |
| 131 | 132 |
| 132 } // namespace WebCore | 133 } // namespace WebCore |
| 133 | 134 |
| 134 #endif // ViewportArguments_h | 135 #endif // ViewportArguments_h |
| OLD | NEW |