Chromium Code Reviews| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 UnrecognizedViewportArgumentValueError, | 43 UnrecognizedViewportArgumentValueError, |
| 44 TruncatedViewportArgumentValueError, | 44 TruncatedViewportArgumentValueError, |
| 45 MaximumScaleTooLargeError, | 45 MaximumScaleTooLargeError, |
| 46 TargetDensityDpiUnsupported | 46 TargetDensityDpiUnsupported |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 struct ViewportArguments { | 49 struct ViewportArguments { |
| 50 | 50 |
| 51 enum Type { | 51 enum Type { |
| 52 // These are ordered in increasing importance. | 52 // These are ordered in increasing importance. |
| 53 Implicit, | 53 UserAgentStyleSheet, |
| 54 XHTMLMobileProfile, | |
| 55 HandheldFriendlyMeta, | 54 HandheldFriendlyMeta, |
| 56 MobileOptimizedMeta, | 55 MobileOptimizedMeta, |
| 57 ViewportMeta, | 56 ViewportMeta, |
| 58 ViewportMetaLayoutSizeQuirk, | 57 AuthorStyleSheet |
|
kenneth.r.christiansen
2013/09/03 08:55:57
This one
rune
2013/09/03 09:25:00
Done.
| |
| 59 CSSDeviceAdaptation | |
| 60 } type; | 58 } type; |
| 61 | 59 |
| 62 enum { | 60 enum { |
| 63 ValueAuto = -1, | 61 ValueAuto = -1, |
| 64 ValueDeviceWidth = -2, | 62 ValueDeviceWidth = -2, |
| 65 ValueDeviceHeight = -3, | 63 ValueDeviceHeight = -3, |
| 66 ValuePortrait = -4, | 64 ValuePortrait = -4, |
| 67 ValueLandscape = -5, | 65 ValueLandscape = -5, |
| 68 ValueDeviceDPI = -6, | 66 ValueDeviceDPI = -6, |
| 69 ValueLowDPI = -7, | 67 ValueLowDPI = -7, |
| 70 ValueMediumDPI = -8, | 68 ValueMediumDPI = -8, |
| 71 ValueHighDPI = -9, | 69 ValueHighDPI = -9, |
| 72 ValueExtendToZoom = -10 | 70 ValueExtendToZoom = -10 |
| 73 }; | 71 }; |
| 74 | 72 |
| 75 ViewportArguments(Type type = Implicit) | 73 ViewportArguments(Type type = UserAgentStyleSheet) |
| 76 : type(type) | 74 : type(type) |
| 77 , width(ValueAuto) | |
| 78 , height(ValueAuto) | |
| 79 , zoom(ValueAuto) | 75 , zoom(ValueAuto) |
| 80 , minZoom(ValueAuto) | 76 , minZoom(ValueAuto) |
| 81 , maxZoom(ValueAuto) | 77 , maxZoom(ValueAuto) |
| 82 , userZoom(ValueAuto) | 78 , userZoom(ValueAuto) |
| 83 , orientation(ValueAuto) | 79 , orientation(ValueAuto) |
| 84 , deprecatedTargetDensityDPI(ValueAuto) | 80 , deprecatedTargetDensityDPI(ValueAuto) |
| 85 { | 81 { |
| 86 } | 82 } |
| 87 | 83 |
| 88 // All arguments are in CSS units. | 84 // All arguments are in CSS units. |
| 89 PageScaleConstraints resolve(const FloatSize& initialViewportSize, int defau ltWidth) const; | 85 PageScaleConstraints resolve(const FloatSize& initialViewportSize) const; |
| 90 | 86 |
| 91 float width; | |
| 92 Length minWidth; | 87 Length minWidth; |
| 93 Length maxWidth; | 88 Length maxWidth; |
| 94 float height; | |
| 95 Length minHeight; | 89 Length minHeight; |
| 96 Length maxHeight; | 90 Length maxHeight; |
| 97 float zoom; | 91 float zoom; |
| 98 float minZoom; | 92 float minZoom; |
| 99 float maxZoom; | 93 float maxZoom; |
| 100 float userZoom; | 94 float userZoom; |
| 101 float orientation; | 95 float orientation; |
| 102 float deprecatedTargetDensityDPI; // Only used for Android WebView | 96 float deprecatedTargetDensityDPI; // Only used for Android WebView |
| 103 | 97 |
| 104 bool operator==(const ViewportArguments& other) const | 98 bool operator==(const ViewportArguments& other) const |
| 105 { | 99 { |
| 106 // Used for figuring out whether to reset the viewport or not, | 100 // Used for figuring out whether to reset the viewport or not, |
| 107 // thus we are not taking type into account. | 101 // thus we are not taking type into account. |
| 108 return width == other.width | 102 return minWidth == other.minWidth |
| 109 && minWidth == other.minWidth | |
| 110 && maxWidth == other.maxWidth | 103 && maxWidth == other.maxWidth |
| 111 && height == other.height | |
| 112 && minHeight == other.minHeight | 104 && minHeight == other.minHeight |
| 113 && maxHeight == other.maxHeight | 105 && maxHeight == other.maxHeight |
| 114 && zoom == other.zoom | 106 && zoom == other.zoom |
| 115 && minZoom == other.minZoom | 107 && minZoom == other.minZoom |
| 116 && maxZoom == other.maxZoom | 108 && maxZoom == other.maxZoom |
| 117 && userZoom == other.userZoom | 109 && userZoom == other.userZoom |
| 118 && orientation == other.orientation | 110 && orientation == other.orientation |
| 119 && deprecatedTargetDensityDPI == other.deprecatedTargetDensityDPI; | 111 && deprecatedTargetDensityDPI == other.deprecatedTargetDensityDPI; |
| 120 } | 112 } |
| 121 | 113 |
| 122 bool operator!=(const ViewportArguments& other) const | 114 bool operator!=(const ViewportArguments& other) const |
| 123 { | 115 { |
| 124 return !(*this == other); | 116 return !(*this == other); |
| 125 } | 117 } |
| 126 | 118 |
| 127 private: | 119 private: |
| 128 enum Direction { Horizontal, Vertical }; | 120 enum Direction { Horizontal, Vertical }; |
| 129 static float resolveViewportLength(const Length&, const FloatSize& initialVi ewportSize, Direction); | 121 static float resolveViewportLength(const Length&, const FloatSize& initialVi ewportSize, Direction); |
| 130 }; | 122 }; |
| 131 | 123 |
| 132 void setViewportFeature(const String& keyString, const String& valueString, Docu ment*, void* data); | 124 void setViewportFeature(const String& keyString, const String& valueString, Docu ment*, void* data); |
| 133 void reportViewportWarning(Document*, ViewportErrorCode, const String& replaceme nt1, const String& replacement2); | 125 void reportViewportWarning(Document*, ViewportErrorCode, const String& replaceme nt1, const String& replacement2); |
| 134 | 126 |
| 135 } // namespace WebCore | 127 } // namespace WebCore |
| 136 | 128 |
| 137 #endif // ViewportArguments_h | 129 #endif // ViewportArguments_h |
| OLD | NEW |