| 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 InvalidKeyValuePairSeparatorError, | 41 InvalidKeyValuePairSeparatorError, |
| 41 UnrecognizedViewportArgumentKeyError, | 42 UnrecognizedViewportArgumentKeyError, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 67 ValueDeviceDPI = -6, | 68 ValueDeviceDPI = -6, |
| 68 ValueLowDPI = -7, | 69 ValueLowDPI = -7, |
| 69 ValueMediumDPI = -8, | 70 ValueMediumDPI = -8, |
| 70 ValueHighDPI = -9, | 71 ValueHighDPI = -9, |
| 71 ValueExtendToZoom = -10 | 72 ValueExtendToZoom = -10 |
| 72 }; | 73 }; |
| 73 | 74 |
| 74 ViewportArguments(Type type = Implicit) | 75 ViewportArguments(Type type = Implicit) |
| 75 : type(type) | 76 : type(type) |
| 76 , width(ValueAuto) | 77 , width(ValueAuto) |
| 77 , minWidth(ValueAuto) | |
| 78 , maxWidth(ValueAuto) | |
| 79 , height(ValueAuto) | 78 , height(ValueAuto) |
| 80 , minHeight(ValueAuto) | |
| 81 , maxHeight(ValueAuto) | |
| 82 , zoom(ValueAuto) | 79 , zoom(ValueAuto) |
| 83 , minZoom(ValueAuto) | 80 , minZoom(ValueAuto) |
| 84 , maxZoom(ValueAuto) | 81 , maxZoom(ValueAuto) |
| 85 , userZoom(ValueAuto) | 82 , userZoom(ValueAuto) |
| 86 , orientation(ValueAuto) | 83 , orientation(ValueAuto) |
| 87 , deprecatedTargetDensityDPI(ValueAuto) | 84 , deprecatedTargetDensityDPI(ValueAuto) |
| 88 { | 85 { |
| 89 } | 86 } |
| 90 | 87 |
| 91 // All arguments are in CSS units. | 88 // All arguments are in CSS units. |
| 92 PageScaleConstraints resolve(const FloatSize& initialViewportSize, int defau
ltWidth) const; | 89 PageScaleConstraints resolve(const FloatSize& initialViewportSize, int defau
ltWidth) const; |
| 93 | 90 |
| 94 float width; | 91 float width; |
| 95 float minWidth; | 92 Length minWidth; |
| 96 float maxWidth; | 93 Length maxWidth; |
| 97 float height; | 94 float height; |
| 98 float minHeight; | 95 Length minHeight; |
| 99 float maxHeight; | 96 Length maxHeight; |
| 100 float zoom; | 97 float zoom; |
| 101 float minZoom; | 98 float minZoom; |
| 102 float maxZoom; | 99 float maxZoom; |
| 103 float userZoom; | 100 float userZoom; |
| 104 float orientation; | 101 float orientation; |
| 105 float deprecatedTargetDensityDPI; // Only used for Android WebView | 102 float deprecatedTargetDensityDPI; // Only used for Android WebView |
| 106 | 103 |
| 107 bool operator==(const ViewportArguments& other) const | 104 bool operator==(const ViewportArguments& other) const |
| 108 { | 105 { |
| 109 // Used for figuring out whether to reset the viewport or not, | 106 // Used for figuring out whether to reset the viewport or not, |
| 110 // thus we are not taking type into account. | 107 // thus we are not taking type into account. |
| 111 return width == other.width | 108 return width == other.width |
| 112 && minWidth == other.minWidth | 109 && minWidth == other.minWidth |
| 113 && maxWidth == other.maxWidth | 110 && maxWidth == other.maxWidth |
| 114 && height == other.height | 111 && height == other.height |
| 115 && minHeight == other.minHeight | 112 && minHeight == other.minHeight |
| 116 && maxHeight == other.maxHeight | 113 && maxHeight == other.maxHeight |
| 117 && zoom == other.zoom | 114 && zoom == other.zoom |
| 118 && minZoom == other.minZoom | 115 && minZoom == other.minZoom |
| 119 && maxZoom == other.maxZoom | 116 && maxZoom == other.maxZoom |
| 120 && userZoom == other.userZoom | 117 && userZoom == other.userZoom |
| 121 && orientation == other.orientation | 118 && orientation == other.orientation |
| 122 && deprecatedTargetDensityDPI == other.deprecatedTargetDensityDPI; | 119 && deprecatedTargetDensityDPI == other.deprecatedTargetDensityDPI; |
| 123 } | 120 } |
| 124 | 121 |
| 125 bool operator!=(const ViewportArguments& other) const | 122 bool operator!=(const ViewportArguments& other) const |
| 126 { | 123 { |
| 127 return !(*this == other); | 124 return !(*this == other); |
| 128 } | 125 } |
| 126 |
| 127 private: |
| 128 enum Direction { Horizontal, Vertical }; |
| 129 static float resolveViewportLength(const Length&, const FloatSize& initialVi
ewportSize, Direction); |
| 129 }; | 130 }; |
| 130 | 131 |
| 131 void setViewportFeature(const String& keyString, const String& valueString, Docu
ment*, void* data); | 132 void setViewportFeature(const String& keyString, const String& valueString, Docu
ment*, void* data); |
| 132 void reportViewportWarning(Document*, ViewportErrorCode, const String& replaceme
nt1, const String& replacement2); | 133 void reportViewportWarning(Document*, ViewportErrorCode, const String& replaceme
nt1, const String& replacement2); |
| 133 | 134 |
| 134 } // namespace WebCore | 135 } // namespace WebCore |
| 135 | 136 |
| 136 #endif // ViewportArguments_h | 137 #endif // ViewportArguments_h |
| OLD | NEW |