Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: Source/core/dom/ViewportArguments.h

Issue 23742003: Use css-device-adapt constraining for legacy viewport tags. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 UnrecognizedViewportArgumentValueError, 42 UnrecognizedViewportArgumentValueError,
43 TruncatedViewportArgumentValueError, 43 TruncatedViewportArgumentValueError,
44 MaximumScaleTooLargeError, 44 MaximumScaleTooLargeError,
45 TargetDensityDpiUnsupported 45 TargetDensityDpiUnsupported
46 }; 46 };
47 47
48 struct ViewportArguments { 48 struct ViewportArguments {
49 49
50 enum Type { 50 enum Type {
51 // These are ordered in increasing importance. 51 // These are ordered in increasing importance.
52 Implicit, 52 UserAgent,
53 XHTMLMobileProfile,
54 HandheldFriendlyMeta, 53 HandheldFriendlyMeta,
55 MobileOptimizedMeta, 54 MobileOptimizedMeta,
56 ViewportMeta, 55 ViewportMeta,
57 ViewportMetaLayoutSizeQuirk,
58 CSSDeviceAdaptation 56 CSSDeviceAdaptation
kenneth.r.christiansen 2013/09/02 09:10:49 Maybe rename to StyleSheet ?
rune 2013/09/02 11:29:30 Yes. Perhaps: UserAgent => UserAgentStyleSheet (o
rune 2013/09/02 11:53:39 Done.
59 } type; 57 } type;
60 58
61 enum { 59 enum {
62 ValueAuto = -1, 60 ValueAuto = -1,
63 ValueDeviceWidth = -2, 61 ValueDeviceWidth = -2,
64 ValueDeviceHeight = -3, 62 ValueDeviceHeight = -3,
65 ValuePortrait = -4, 63 ValuePortrait = -4,
66 ValueLandscape = -5, 64 ValueLandscape = -5,
67 ValueDeviceDPI = -6, 65 ValueDeviceDPI = -6,
68 ValueLowDPI = -7, 66 ValueLowDPI = -7,
69 ValueMediumDPI = -8, 67 ValueMediumDPI = -8,
70 ValueHighDPI = -9, 68 ValueHighDPI = -9,
71 ValueExtendToZoom = -10 69 ValueExtendToZoom = -10
72 }; 70 };
73 71
74 ViewportArguments(Type type = Implicit) 72 ViewportArguments(Type type = UserAgent)
75 : type(type) 73 : type(type)
76 , width(ValueAuto)
77 , minWidth(ValueAuto) 74 , minWidth(ValueAuto)
78 , maxWidth(ValueAuto) 75 , maxWidth(ValueAuto)
79 , height(ValueAuto)
80 , minHeight(ValueAuto) 76 , minHeight(ValueAuto)
81 , maxHeight(ValueAuto) 77 , maxHeight(ValueAuto)
82 , zoom(ValueAuto) 78 , zoom(ValueAuto)
83 , minZoom(ValueAuto) 79 , minZoom(ValueAuto)
84 , maxZoom(ValueAuto) 80 , maxZoom(ValueAuto)
85 , userZoom(ValueAuto) 81 , userZoom(ValueAuto)
86 , orientation(ValueAuto) 82 , orientation(ValueAuto)
87 , deprecatedTargetDensityDPI(ValueAuto) 83 , deprecatedTargetDensityDPI(ValueAuto)
88 { 84 {
89 } 85 }
90 86
91 // All arguments are in CSS units. 87 // All arguments are in CSS units.
92 PageScaleConstraints resolve(const FloatSize& initialViewportSize, int defau ltWidth) const; 88 PageScaleConstraints resolve(const FloatSize& initialViewportSize) const;
93 89
94 float width;
95 float minWidth; 90 float minWidth;
96 float maxWidth; 91 float maxWidth;
97 float height;
98 float minHeight; 92 float minHeight;
99 float maxHeight; 93 float maxHeight;
100 float zoom; 94 float zoom;
101 float minZoom; 95 float minZoom;
102 float maxZoom; 96 float maxZoom;
103 float userZoom; 97 float userZoom;
104 float orientation; 98 float orientation;
105 float deprecatedTargetDensityDPI; // Only used for Android WebView 99 float deprecatedTargetDensityDPI; // Only used for Android WebView
106 100
107 bool operator==(const ViewportArguments& other) const 101 bool operator==(const ViewportArguments& other) const
108 { 102 {
109 // Used for figuring out whether to reset the viewport or not, 103 // Used for figuring out whether to reset the viewport or not.
110 // thus we are not taking type into account. 104 return minWidth == other.minWidth
111 return width == other.width
112 && minWidth == other.minWidth
113 && maxWidth == other.maxWidth 105 && maxWidth == other.maxWidth
114 && height == other.height
115 && minHeight == other.minHeight 106 && minHeight == other.minHeight
116 && maxHeight == other.maxHeight 107 && maxHeight == other.maxHeight
117 && zoom == other.zoom 108 && zoom == other.zoom
118 && minZoom == other.minZoom 109 && minZoom == other.minZoom
119 && maxZoom == other.maxZoom 110 && maxZoom == other.maxZoom
120 && userZoom == other.userZoom 111 && userZoom == other.userZoom
121 && orientation == other.orientation 112 && orientation == other.orientation
122 && deprecatedTargetDensityDPI == other.deprecatedTargetDensityDPI; 113 && deprecatedTargetDensityDPI == other.deprecatedTargetDensityDPI;
123 } 114 }
124 115
125 bool operator!=(const ViewportArguments& other) const 116 bool operator!=(const ViewportArguments& other) const
126 { 117 {
127 return !(*this == other); 118 return !(*this == other);
128 } 119 }
129 }; 120 };
130 121
131 void setViewportFeature(const String& keyString, const String& valueString, Docu ment*, void* data); 122 void setViewportFeature(const String& keyString, const String& valueString, Docu ment*, void* data);
132 void reportViewportWarning(Document*, ViewportErrorCode, const String& replaceme nt1, const String& replacement2); 123 void reportViewportWarning(Document*, ViewportErrorCode, const String& replaceme nt1, const String& replacement2);
133 124
134 } // namespace WebCore 125 } // namespace WebCore
135 126
136 #endif // ViewportArguments_h 127 #endif // ViewportArguments_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698