fix logic
[personal-kdelibs.git] / khtml / rendering / SVGRenderStyleDefs.h
blob714a2dba318952d91addfebe7bf666edfc336d4b
1 /*
2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 2004, 2005 Rob Buis <buis@kde.org>
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.
11 This file is part of the KDE project
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.
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.
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.
29 #ifndef SVGRenderStyleDefs_h
30 #define SVGRenderStyleDefs_h
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>
39 // KHTML API compat
40 #include <wtf/PassRefPtr.h>
41 #include "CSSValue.h"
42 #include "CSSValueList.h"
44 // Helper macros for 'SVGRenderStyle'
45 #define SVG_RS_DEFINE_ATTRIBUTE(Data, Type, Name, Initial) \
46 void set##Type(Data val) { svg_noninherited_flags.f._##Name = val; } \
47 Data Name() const { return (Data) svg_noninherited_flags.f._##Name; } \
48 static Data initial##Type() { return Initial; }
50 #define SVG_RS_DEFINE_ATTRIBUTE_INHERITED(Data, Type, Name, Initial) \
51 void set##Type(Data val) { svg_inherited_flags._##Name = val; } \
52 Data Name() const { return (Data) svg_inherited_flags._##Name; } \
53 static Data initial##Type() { return Initial; }
55 // "Helper" macros for SVG's RenderStyle properties
56 // FIXME: These are impossible to work with or debug.
57 #define SVG_RS_DEFINE_ATTRIBUTE_DATAREF(Data, Group, Variable, Type, Name) \
58 Data Name() const { return Group->Variable; } \
59 void set##Type(Data obj) { SVG_RS_SET_VARIABLE(Group, Variable, obj) }
61 #define SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Data, Group, Variable, Type, Name, Initial) \
62 SVG_RS_DEFINE_ATTRIBUTE_DATAREF(Data, Group, Variable, Type, Name) \
63 static Data initial##Type() { return Initial; }
65 #define SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(Data, Group, Variable, Type, Name, Initial) \
66 Data* Name() const { return Group->Variable.get(); } \
67 void set##Type(PassRefPtr<Data> obj) { \
68 if(!(Group->Variable == obj)) \
69 Group.access()->Variable = obj; \
70 } \
71 static Data* initial##Type() { return Initial; }
73 #define SVG_RS_SET_VARIABLE(Group, Variable, Value) \
74 if(!(Group->Variable == Value)) \
75 Group.access()->Variable = Value;
77 namespace WebCore
79 enum EBaselineShift {
80 BS_BASELINE, BS_SUB, BS_SUPER, BS_LENGTH
83 enum ETextAnchor {
84 TA_START, TA_MIDDLE, TA_END
87 enum EColorInterpolation {
88 CI_AUTO, CI_SRGB, CI_LINEARRGB
91 enum EColorRendering {
92 CR_AUTO, CR_OPTIMIZESPEED, CR_OPTIMIZEQUALITY
95 enum EImageRendering {
96 IR_AUTO, IR_OPTIMIZESPEED, IR_OPTIMIZEQUALITY
99 enum EShapeRendering {
100 SR_AUTO, SR_OPTIMIZESPEED, SR_CRISPEDGES, SR_GEOMETRICPRECISION
103 enum ETextRendering {
104 TR_AUTO, TR_OPTIMIZESPEED, TR_OPTIMIZELEGIBILITY, TR_GEOMETRICPRECISION
107 enum EWritingMode {
108 WM_LRTB, WM_LR, WM_RLTB, WM_RL, WM_TBRL, WM_TB
111 enum EGlyphOrientation {
112 GO_0DEG, GO_90DEG, GO_180DEG, GO_270DEG, GO_AUTO
115 enum EAlignmentBaseline {
116 AB_AUTO, AB_BASELINE, AB_BEFORE_EDGE, AB_TEXT_BEFORE_EDGE,
117 AB_MIDDLE, AB_CENTRAL, AB_AFTER_EDGE, AB_TEXT_AFTER_EDGE,
118 AB_IDEOGRAPHIC, AB_ALPHABETIC, AB_HANGING, AB_MATHEMATICAL
121 enum EDominantBaseline {
122 DB_AUTO, DB_USE_SCRIPT, DB_NO_CHANGE, DB_RESET_SIZE,
123 DB_IDEOGRAPHIC, DB_ALPHABETIC, DB_HANGING, DB_MATHEMATICAL,
124 DB_CENTRAL, DB_MIDDLE, DB_TEXT_AFTER_EDGE, DB_TEXT_BEFORE_EDGE
127 enum EPointerEvents {
128 PE_NONE, PE_STROKE, PE_FILL, PE_PAINTED, PE_VISIBLE,
129 PE_VISIBLE_STROKE, PE_VISIBLE_FILL, PE_VISIBLE_PAINTED, PE_ALL
132 //class CSSValue;
133 //class CSSValueList;
134 class SVGPaint;
136 // Inherited/Non-Inherited Style Datastructures
137 class StyleFillData : public RefCounted<StyleFillData> {
138 public:
139 static PassRefPtr<StyleFillData> create() { return adoptRef(new StyleFillData); }
140 PassRefPtr<StyleFillData> copy() const { return adoptRef(new StyleFillData(*this)); }
142 bool operator==(const StyleFillData &other) const;
143 bool operator!=(const StyleFillData &other) const
145 return !(*this == other);
148 float opacity;
149 RefPtr<SVGPaint> paint;
151 private:
152 StyleFillData();
153 StyleFillData(const StyleFillData&);
156 class StyleStrokeData : public RefCounted<StyleStrokeData> {
157 public:
158 static PassRefPtr<StyleStrokeData> create() { return adoptRef(new StyleStrokeData); }
159 PassRefPtr<StyleStrokeData> copy() const { return adoptRef(new StyleStrokeData(*this)); }
161 bool operator==(const StyleStrokeData&) const;
162 bool operator!=(const StyleStrokeData& other) const
164 return !(*this == other);
167 float opacity;
168 float miterLimit;
170 RefPtr<CSSValue> width;
171 RefPtr<CSSValue> dashOffset;
173 RefPtr<SVGPaint> paint;
174 RefPtr<CSSValueList> dashArray;
176 private:
177 StyleStrokeData();
178 StyleStrokeData(const StyleStrokeData&);
181 class StyleStopData : public RefCounted<StyleStopData> {
182 public:
183 static PassRefPtr<StyleStopData> create() { return adoptRef(new StyleStopData); }
184 PassRefPtr<StyleStopData> copy() const { return adoptRef(new StyleStopData(*this)); }
186 bool operator==(const StyleStopData &other) const;
187 bool operator!=(const StyleStopData &other) const
189 return !(*this == other);
192 float opacity;
193 Color color;
195 private:
196 StyleStopData();
197 StyleStopData(const StyleStopData&);
200 class StyleTextData : public RefCounted<StyleTextData> {
201 public:
202 static PassRefPtr<StyleTextData> create() { return adoptRef(new StyleTextData); }
203 PassRefPtr<StyleTextData> copy() const { return adoptRef(new StyleTextData(*this)); }
205 bool operator==(const StyleTextData& other) const;
206 bool operator!=(const StyleTextData& other) const
208 return !(*this == other);
211 RefPtr<CSSValue> kerning;
213 private:
214 StyleTextData();
215 StyleTextData(const StyleTextData& other);
218 class StyleClipData : public RefCounted<StyleClipData> {
219 public:
220 static PassRefPtr<StyleClipData> create() { return adoptRef(new StyleClipData); }
221 PassRefPtr<StyleClipData> copy() const { return adoptRef(new StyleClipData(*this)); }
223 bool operator==(const StyleClipData &other) const;
224 bool operator!=(const StyleClipData &other) const
226 return !(*this == other);
229 String clipPath;
231 private:
232 StyleClipData();
233 StyleClipData(const StyleClipData&);
236 class StyleMaskData : public RefCounted<StyleMaskData> {
237 public:
238 static PassRefPtr<StyleMaskData> create() { return adoptRef(new StyleMaskData); }
239 PassRefPtr<StyleMaskData> copy() const { return adoptRef(new StyleMaskData(*this)); }
241 bool operator==(const StyleMaskData &other) const;
242 bool operator!=(const StyleMaskData &other) const { return !(*this == other); }
244 String maskElement;
246 private:
247 StyleMaskData();
248 StyleMaskData(const StyleMaskData&);
251 class StyleMarkerData : public RefCounted<StyleMarkerData> {
252 public:
253 static PassRefPtr<StyleMarkerData> create() { return adoptRef(new StyleMarkerData); }
254 PassRefPtr<StyleMarkerData> copy() const { return adoptRef(new StyleMarkerData(*this)); }
256 bool operator==(const StyleMarkerData &other) const;
257 bool operator!=(const StyleMarkerData &other) const
259 return !(*this == other);
262 String startMarker;
263 String midMarker;
264 String endMarker;
266 private:
267 StyleMarkerData();
268 StyleMarkerData(const StyleMarkerData&);
271 // Note : the rule for this class is, *no inheritance* of these props
272 class StyleMiscData : public RefCounted<StyleMiscData> {
273 public:
274 static PassRefPtr<StyleMiscData> create() { return adoptRef(new StyleMiscData); }
275 PassRefPtr<StyleMiscData> copy() const { return adoptRef(new StyleMiscData(*this)); }
277 bool operator==(const StyleMiscData &other) const;
278 bool operator!=(const StyleMiscData &other) const
280 return !(*this == other);
283 String filter;
284 Color floodColor;
285 float floodOpacity;
287 Color lightingColor;
289 // non-inherited text stuff lives here not in StyleTextData.
290 RefPtr<CSSValue> baselineShiftValue;
292 private:
293 StyleMiscData();
294 StyleMiscData(const StyleMiscData&);
297 } // namespace WebCore
299 #endif // ENABLE(SVG)
300 #endif // SVGRenderStyleDefs_h
302 // vim:ts=4