]> git.saurik.com Git - iphone-api.git/blob - WebCore/SVGRenderStyleDefs.h
Adding the WebCore headers (for Cydget).
[iphone-api.git] / WebCore / SVGRenderStyleDefs.h
1 /*
2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 2004, 2005 Rob Buis <buis@kde.org>
4
5 Based on khtml code by:
6 Copyright (C) 2000-2003 Lars Knoll (knoll@kde.org)
7 (C) 2000 Antti Koivisto (koivisto@kde.org)
8 (C) 2000-2003 Dirk Mueller (mueller@kde.org)
9 (C) 2002-2003 Apple Computer, Inc.
10
11 This file is part of the KDE project
12
13 This library is free software; you can redistribute it and/or
14 modify it under the terms of the GNU Library General Public
15 License as published by the Free Software Foundation; either
16 version 2 of the License, or (at your option) any later version.
17
18 This library is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Library General Public License for more details.
22
23 You should have received a copy of the GNU Library General Public License
24 along with this library; see the file COPYING.LIB. If not, write to
25 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 Boston, MA 02110-1301, USA.
27 */
28
29 #ifndef SVGRenderStyleDefs_h
30 #define SVGRenderStyleDefs_h
31
32 #if ENABLE(SVG)
33 #include "Color.h"
34 #include "Path.h"
35 #include "PlatformString.h"
36 #include <wtf/RefCounted.h>
37 #include <wtf/RefPtr.h>
38
39 // Helper macros for 'SVGRenderStyle'
40 #define SVG_RS_DEFINE_ATTRIBUTE(Data, Type, Name, Initial) \
41 void set##Type(Data val) { svg_noninherited_flags.f._##Name = val; } \
42 Data Name() const { return (Data) svg_noninherited_flags.f._##Name; } \
43 static Data initial##Type() { return Initial; }
44
45 #define SVG_RS_DEFINE_ATTRIBUTE_INHERITED(Data, Type, Name, Initial) \
46 void set##Type(Data val) { svg_inherited_flags._##Name = val; } \
47 Data Name() const { return (Data) svg_inherited_flags._##Name; } \
48 static Data initial##Type() { return Initial; }
49
50 // "Helper" macros for SVG's RenderStyle properties
51 // FIXME: These are impossible to work with or debug.
52 #define SVG_RS_DEFINE_ATTRIBUTE_DATAREF(Data, Group, Variable, Type, Name) \
53 Data Name() const { return Group->Variable; } \
54 void set##Type(Data obj) { SVG_RS_SET_VARIABLE(Group, Variable, obj) }
55
56 #define SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Data, Group, Variable, Type, Name, Initial) \
57 SVG_RS_DEFINE_ATTRIBUTE_DATAREF(Data, Group, Variable, Type, Name) \
58 static Data initial##Type() { return Initial; }
59
60 #define SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(Data, Group, Variable, Type, Name, Initial) \
61 Data* Name() const { return Group->Variable.get(); } \
62 void set##Type(PassRefPtr<Data> obj) { \
63 if(!(Group->Variable == obj)) \
64 Group.access()->Variable = obj; \
65 } \
66 static Data* initial##Type() { return Initial; }
67
68 #define SVG_RS_SET_VARIABLE(Group, Variable, Value) \
69 if(!(Group->Variable == Value)) \
70 Group.access()->Variable = Value;
71
72 namespace WebCore {
73
74 enum EBaselineShift {
75 BS_BASELINE, BS_SUB, BS_SUPER, BS_LENGTH
76 };
77
78 enum ETextAnchor {
79 TA_START, TA_MIDDLE, TA_END
80 };
81
82 enum EColorInterpolation {
83 CI_AUTO, CI_SRGB, CI_LINEARRGB
84 };
85
86 enum EColorRendering {
87 CR_AUTO, CR_OPTIMIZESPEED, CR_OPTIMIZEQUALITY
88 };
89
90 enum EImageRendering {
91 IR_AUTO, IR_OPTIMIZESPEED, IR_OPTIMIZEQUALITY
92 };
93
94 enum EShapeRendering {
95 SR_AUTO, SR_OPTIMIZESPEED, SR_CRISPEDGES, SR_GEOMETRICPRECISION
96 };
97
98 enum ETextRendering {
99 TR_AUTO, TR_OPTIMIZESPEED, TR_OPTIMIZELEGIBILITY, TR_GEOMETRICPRECISION
100 };
101
102 enum EWritingMode {
103 WM_LRTB, WM_LR, WM_RLTB, WM_RL, WM_TBRL, WM_TB
104 };
105
106 enum EGlyphOrientation {
107 GO_0DEG, GO_90DEG, GO_180DEG, GO_270DEG, GO_AUTO
108 };
109
110 enum EAlignmentBaseline {
111 AB_AUTO, AB_BASELINE, AB_BEFORE_EDGE, AB_TEXT_BEFORE_EDGE,
112 AB_MIDDLE, AB_CENTRAL, AB_AFTER_EDGE, AB_TEXT_AFTER_EDGE,
113 AB_IDEOGRAPHIC, AB_ALPHABETIC, AB_HANGING, AB_MATHEMATICAL
114 };
115
116 enum EDominantBaseline {
117 DB_AUTO, DB_USE_SCRIPT, DB_NO_CHANGE, DB_RESET_SIZE,
118 DB_IDEOGRAPHIC, DB_ALPHABETIC, DB_HANGING, DB_MATHEMATICAL,
119 DB_CENTRAL, DB_MIDDLE, DB_TEXT_AFTER_EDGE, DB_TEXT_BEFORE_EDGE
120 };
121
122 class CSSValue;
123 class CSSValueList;
124 class SVGPaint;
125
126 // Inherited/Non-Inherited Style Datastructures
127 class StyleFillData : public RefCounted<StyleFillData> {
128 public:
129 static PassRefPtr<StyleFillData> create() { return adoptRef(new StyleFillData); }
130 PassRefPtr<StyleFillData> copy() const { return adoptRef(new StyleFillData(*this)); }
131
132 bool operator==(const StyleFillData &other) const;
133 bool operator!=(const StyleFillData &other) const
134 {
135 return !(*this == other);
136 }
137
138 float opacity;
139 RefPtr<SVGPaint> paint;
140
141 private:
142 StyleFillData();
143 StyleFillData(const StyleFillData&);
144 };
145
146 class StyleStrokeData : public RefCounted<StyleStrokeData> {
147 public:
148 static PassRefPtr<StyleStrokeData> create() { return adoptRef(new StyleStrokeData); }
149 PassRefPtr<StyleStrokeData> copy() const { return adoptRef(new StyleStrokeData(*this)); }
150
151 bool operator==(const StyleStrokeData&) const;
152 bool operator!=(const StyleStrokeData& other) const
153 {
154 return !(*this == other);
155 }
156
157 float opacity;
158 float miterLimit;
159
160 RefPtr<CSSValue> width;
161 RefPtr<CSSValue> dashOffset;
162
163 RefPtr<SVGPaint> paint;
164 RefPtr<CSSValueList> dashArray;
165
166 private:
167 StyleStrokeData();
168 StyleStrokeData(const StyleStrokeData&);
169 };
170
171 class StyleStopData : public RefCounted<StyleStopData> {
172 public:
173 static PassRefPtr<StyleStopData> create() { return adoptRef(new StyleStopData); }
174 PassRefPtr<StyleStopData> copy() const { return adoptRef(new StyleStopData(*this)); }
175
176 bool operator==(const StyleStopData &other) const;
177 bool operator!=(const StyleStopData &other) const
178 {
179 return !(*this == other);
180 }
181
182 float opacity;
183 Color color;
184
185 private:
186 StyleStopData();
187 StyleStopData(const StyleStopData&);
188 };
189
190 class StyleTextData : public RefCounted<StyleTextData> {
191 public:
192 static PassRefPtr<StyleTextData> create() { return adoptRef(new StyleTextData); }
193 PassRefPtr<StyleTextData> copy() const { return adoptRef(new StyleTextData(*this)); }
194
195 bool operator==(const StyleTextData& other) const;
196 bool operator!=(const StyleTextData& other) const
197 {
198 return !(*this == other);
199 }
200
201 RefPtr<CSSValue> kerning;
202
203 private:
204 StyleTextData();
205 StyleTextData(const StyleTextData& other);
206 };
207
208 class StyleClipData : public RefCounted<StyleClipData> {
209 public:
210 static PassRefPtr<StyleClipData> create() { return adoptRef(new StyleClipData); }
211 PassRefPtr<StyleClipData> copy() const { return adoptRef(new StyleClipData(*this)); }
212
213 bool operator==(const StyleClipData &other) const;
214 bool operator!=(const StyleClipData &other) const
215 {
216 return !(*this == other);
217 }
218
219 String clipPath;
220
221 private:
222 StyleClipData();
223 StyleClipData(const StyleClipData&);
224 };
225
226 class StyleMaskData : public RefCounted<StyleMaskData> {
227 public:
228 static PassRefPtr<StyleMaskData> create() { return adoptRef(new StyleMaskData); }
229 PassRefPtr<StyleMaskData> copy() const { return adoptRef(new StyleMaskData(*this)); }
230
231 bool operator==(const StyleMaskData &other) const;
232 bool operator!=(const StyleMaskData &other) const { return !(*this == other); }
233
234 String maskElement;
235
236 private:
237 StyleMaskData();
238 StyleMaskData(const StyleMaskData&);
239 };
240
241 class StyleMarkerData : public RefCounted<StyleMarkerData> {
242 public:
243 static PassRefPtr<StyleMarkerData> create() { return adoptRef(new StyleMarkerData); }
244 PassRefPtr<StyleMarkerData> copy() const { return adoptRef(new StyleMarkerData(*this)); }
245
246 bool operator==(const StyleMarkerData &other) const;
247 bool operator!=(const StyleMarkerData &other) const
248 {
249 return !(*this == other);
250 }
251
252 String startMarker;
253 String midMarker;
254 String endMarker;
255
256 private:
257 StyleMarkerData();
258 StyleMarkerData(const StyleMarkerData&);
259 };
260
261 // Note : the rule for this class is, *no inheritance* of these props
262 class StyleMiscData : public RefCounted<StyleMiscData> {
263 public:
264 static PassRefPtr<StyleMiscData> create() { return adoptRef(new StyleMiscData); }
265 PassRefPtr<StyleMiscData> copy() const { return adoptRef(new StyleMiscData(*this)); }
266
267 bool operator==(const StyleMiscData &other) const;
268 bool operator!=(const StyleMiscData &other) const
269 {
270 return !(*this == other);
271 }
272
273 String filter;
274 Color floodColor;
275 float floodOpacity;
276
277 Color lightingColor;
278
279 // non-inherited text stuff lives here not in StyleTextData.
280 RefPtr<CSSValue> baselineShiftValue;
281
282 private:
283 StyleMiscData();
284 StyleMiscData(const StyleMiscData&);
285 };
286
287 } // namespace WebCore
288
289 #endif // ENABLE(SVG)
290 #endif // SVGRenderStyleDefs_h
291
292 // vim:ts=4:noet