OLD | NEW |
| (Empty) |
1 /* | |
2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | |
3 2004, 2005 Rob Buis <buis@kde.org> | |
4 Copyright (C) Research In Motion Limited 2010. All rights reserved. | |
5 | |
6 Based on khtml code by: | |
7 Copyright (C) 2000-2003 Lars Knoll (knoll@kde.org) | |
8 (C) 2000 Antti Koivisto (koivisto@kde.org) | |
9 (C) 2000-2003 Dirk Mueller (mueller@kde.org) | |
10 (C) 2002-2003 Apple Computer, Inc. | |
11 | |
12 This library is free software; you can redistribute it and/or | |
13 modify it under the terms of the GNU Library General Public | |
14 License as published by the Free Software Foundation; either | |
15 version 2 of the License, or (at your option) any later version. | |
16 | |
17 This library is distributed in the hope that it will be useful, | |
18 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
20 Library General Public License for more details. | |
21 | |
22 You should have received a copy of the GNU Library General Public License | |
23 along with this library; see the file COPYING.LIB. If not, write to | |
24 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
25 Boston, MA 02110-1301, USA. | |
26 */ | |
27 | |
28 #ifndef SVGLayoutStyleDefs_h | |
29 #define SVGLayoutStyleDefs_h | |
30 | |
31 #include "platform/Length.h" | |
32 #include "platform/graphics/Color.h" | |
33 #include "wtf/OwnPtr.h" | |
34 #include "wtf/PassOwnPtr.h" | |
35 #include "wtf/RefCounted.h" | |
36 #include "wtf/RefPtr.h" | |
37 #include "wtf/RefVector.h" | |
38 #include "wtf/text/WTFString.h" | |
39 | |
40 namespace blink { | |
41 | |
42 typedef RefVector<Length> SVGDashArray; | |
43 | |
44 enum SVGPaintType { | |
45 SVG_PAINTTYPE_RGBCOLOR, | |
46 SVG_PAINTTYPE_NONE, | |
47 SVG_PAINTTYPE_CURRENTCOLOR, | |
48 SVG_PAINTTYPE_URI_NONE, | |
49 SVG_PAINTTYPE_URI_CURRENTCOLOR, | |
50 SVG_PAINTTYPE_URI_RGBCOLOR, | |
51 SVG_PAINTTYPE_URI | |
52 }; | |
53 | |
54 enum EBaselineShift { | |
55 BS_LENGTH, BS_SUB, BS_SUPER | |
56 }; | |
57 | |
58 enum ETextAnchor { | |
59 TA_START, TA_MIDDLE, TA_END | |
60 }; | |
61 | |
62 enum EColorInterpolation { | |
63 CI_AUTO, CI_SRGB, CI_LINEARRGB | |
64 }; | |
65 | |
66 enum EColorRendering { | |
67 CR_AUTO, CR_OPTIMIZESPEED, CR_OPTIMIZEQUALITY | |
68 }; | |
69 enum EShapeRendering { | |
70 SR_AUTO, SR_OPTIMIZESPEED, SR_CRISPEDGES, SR_GEOMETRICPRECISION | |
71 }; | |
72 | |
73 enum SVGWritingMode { | |
74 WM_LRTB, WM_LR, WM_RLTB, WM_RL, WM_TBRL, WM_TB | |
75 }; | |
76 | |
77 enum EGlyphOrientation { | |
78 GO_0DEG, GO_90DEG, GO_180DEG, GO_270DEG, GO_AUTO | |
79 }; | |
80 | |
81 enum EAlignmentBaseline { | |
82 AB_AUTO, AB_BASELINE, AB_BEFORE_EDGE, AB_TEXT_BEFORE_EDGE, | |
83 AB_MIDDLE, AB_CENTRAL, AB_AFTER_EDGE, AB_TEXT_AFTER_EDGE, | |
84 AB_IDEOGRAPHIC, AB_ALPHABETIC, AB_HANGING, AB_MATHEMATICAL | |
85 }; | |
86 | |
87 enum EDominantBaseline { | |
88 DB_AUTO, DB_USE_SCRIPT, DB_NO_CHANGE, DB_RESET_SIZE, | |
89 DB_IDEOGRAPHIC, DB_ALPHABETIC, DB_HANGING, DB_MATHEMATICAL, | |
90 DB_CENTRAL, DB_MIDDLE, DB_TEXT_AFTER_EDGE, DB_TEXT_BEFORE_EDGE | |
91 }; | |
92 | |
93 enum EVectorEffect { | |
94 VE_NONE, | |
95 VE_NON_SCALING_STROKE | |
96 }; | |
97 | |
98 enum EBufferedRendering { | |
99 BR_AUTO, | |
100 BR_DYNAMIC, | |
101 BR_STATIC | |
102 }; | |
103 | |
104 enum EMaskType { | |
105 MT_LUMINANCE, | |
106 MT_ALPHA | |
107 }; | |
108 | |
109 enum EPaintOrderType { | |
110 PT_NONE = 0, | |
111 PT_FILL = 1, | |
112 PT_STROKE = 2, | |
113 PT_MARKERS = 3 | |
114 }; | |
115 | |
116 const int kPaintOrderBitwidth = 2; | |
117 typedef unsigned EPaintOrder; | |
118 const unsigned PO_NORMAL = PT_FILL | PT_STROKE << 2 | PT_MARKERS << 4; | |
119 | |
120 // Inherited/Non-Inherited Style Datastructures | |
121 class StyleFillData : public RefCounted<StyleFillData> { | |
122 public: | |
123 static PassRefPtr<StyleFillData> create() { return adoptRef(new StyleFillDat
a); } | |
124 PassRefPtr<StyleFillData> copy() const { return adoptRef(new StyleFillData(*
this)); } | |
125 | |
126 bool operator==(const StyleFillData&) const; | |
127 bool operator!=(const StyleFillData& other) const | |
128 { | |
129 return !(*this == other); | |
130 } | |
131 | |
132 float opacity; | |
133 SVGPaintType paintType; | |
134 Color paintColor; | |
135 String paintUri; | |
136 SVGPaintType visitedLinkPaintType; | |
137 Color visitedLinkPaintColor; | |
138 String visitedLinkPaintUri; | |
139 | |
140 private: | |
141 StyleFillData(); | |
142 StyleFillData(const StyleFillData&); | |
143 }; | |
144 | |
145 class UnzoomedLength { | |
146 public: | |
147 explicit UnzoomedLength(const Length& length) : m_length(length) { } | |
148 | |
149 bool isZero() const { return m_length.isZero(); } | |
150 | |
151 bool operator==(const UnzoomedLength& other) const { return m_length == othe
r.m_length; } | |
152 bool operator!=(const UnzoomedLength& other) const { return !operator==(othe
r); } | |
153 | |
154 const Length& length() const { return m_length; } | |
155 | |
156 private: | |
157 Length m_length; | |
158 }; | |
159 | |
160 class StyleStrokeData : public RefCounted<StyleStrokeData> { | |
161 public: | |
162 static PassRefPtr<StyleStrokeData> create() | |
163 { | |
164 return adoptRef(new StyleStrokeData); | |
165 } | |
166 | |
167 PassRefPtr<StyleStrokeData> copy() const | |
168 { | |
169 return adoptRef(new StyleStrokeData(*this)); | |
170 } | |
171 | |
172 bool operator==(const StyleStrokeData&) const; | |
173 bool operator!=(const StyleStrokeData& other) const | |
174 { | |
175 return !(*this == other); | |
176 } | |
177 | |
178 float opacity; | |
179 float miterLimit; | |
180 | |
181 UnzoomedLength width; | |
182 Length dashOffset; | |
183 RefPtr<SVGDashArray> dashArray; | |
184 | |
185 SVGPaintType paintType; | |
186 Color paintColor; | |
187 String paintUri; | |
188 SVGPaintType visitedLinkPaintType; | |
189 Color visitedLinkPaintColor; | |
190 String visitedLinkPaintUri; | |
191 | |
192 private: | |
193 StyleStrokeData(); | |
194 StyleStrokeData(const StyleStrokeData&); | |
195 }; | |
196 | |
197 class StyleStopData : public RefCounted<StyleStopData> { | |
198 public: | |
199 static PassRefPtr<StyleStopData> create() { return adoptRef(new StyleStopDat
a); } | |
200 PassRefPtr<StyleStopData> copy() const { return adoptRef(new StyleStopData(*
this)); } | |
201 | |
202 bool operator==(const StyleStopData&) const; | |
203 bool operator!=(const StyleStopData& other) const | |
204 { | |
205 return !(*this == other); | |
206 } | |
207 | |
208 float opacity; | |
209 Color color; | |
210 | |
211 private: | |
212 StyleStopData(); | |
213 StyleStopData(const StyleStopData&); | |
214 }; | |
215 | |
216 // Note: the rule for this class is, *no inheritance* of these props | |
217 class StyleMiscData : public RefCounted<StyleMiscData> { | |
218 public: | |
219 static PassRefPtr<StyleMiscData> create() { return adoptRef(new StyleMiscDat
a); } | |
220 PassRefPtr<StyleMiscData> copy() const { return adoptRef(new StyleMiscData(*
this)); } | |
221 | |
222 bool operator==(const StyleMiscData&) const; | |
223 bool operator!=(const StyleMiscData& other) const | |
224 { | |
225 return !(*this == other); | |
226 } | |
227 | |
228 Color floodColor; | |
229 float floodOpacity; | |
230 Color lightingColor; | |
231 | |
232 Length baselineShiftValue; | |
233 | |
234 private: | |
235 StyleMiscData(); | |
236 StyleMiscData(const StyleMiscData&); | |
237 }; | |
238 | |
239 // Non-inherited resources | |
240 class StyleResourceData : public RefCounted<StyleResourceData> { | |
241 public: | |
242 static PassRefPtr<StyleResourceData> create() { return adoptRef(new StyleRes
ourceData); } | |
243 PassRefPtr<StyleResourceData> copy() const { return adoptRef(new StyleResour
ceData(*this)); } | |
244 | |
245 bool operator==(const StyleResourceData&) const; | |
246 bool operator!=(const StyleResourceData& other) const | |
247 { | |
248 return !(*this == other); | |
249 } | |
250 | |
251 AtomicString clipper; | |
252 AtomicString filter; | |
253 AtomicString masker; | |
254 | |
255 private: | |
256 StyleResourceData(); | |
257 StyleResourceData(const StyleResourceData&); | |
258 }; | |
259 | |
260 // Inherited resources | |
261 class StyleInheritedResourceData : public RefCounted<StyleInheritedResourceData>
{ | |
262 public: | |
263 static PassRefPtr<StyleInheritedResourceData> create() { return adoptRef(new
StyleInheritedResourceData); } | |
264 PassRefPtr<StyleInheritedResourceData> copy() const { return adoptRef(new St
yleInheritedResourceData(*this)); } | |
265 | |
266 bool operator==(const StyleInheritedResourceData&) const; | |
267 bool operator!=(const StyleInheritedResourceData& other) const | |
268 { | |
269 return !(*this == other); | |
270 } | |
271 | |
272 AtomicString markerStart; | |
273 AtomicString markerMid; | |
274 AtomicString markerEnd; | |
275 | |
276 private: | |
277 StyleInheritedResourceData(); | |
278 StyleInheritedResourceData(const StyleInheritedResourceData&); | |
279 }; | |
280 | |
281 // Positioning and sizing properties. | |
282 class StyleLayoutData : public RefCounted<StyleLayoutData> { | |
283 public: | |
284 static PassRefPtr<StyleLayoutData> create() { return adoptRef(new StyleL
ayoutData); } | |
285 PassRefPtr<StyleLayoutData> copy() const; | |
286 bool operator==(const StyleLayoutData&) const; | |
287 bool operator!=(const StyleLayoutData& other) const | |
288 { | |
289 return !(*this == other); | |
290 } | |
291 Length cx; | |
292 Length cy; | |
293 Length x; | |
294 Length y; | |
295 Length r; | |
296 Length rx; | |
297 Length ry; | |
298 private: | |
299 StyleLayoutData(); | |
300 StyleLayoutData(const StyleLayoutData&); | |
301 }; | |
302 | |
303 } // namespace blink | |
304 | |
305 #endif // SVGLayoutStyleDefs_h | |
OLD | NEW |