initial import
[vuplus_webkit] / Source / WebCore / rendering / style / SVGRenderStyleDefs.h
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 SVGRenderStyleDefs_h
29 #define SVGRenderStyleDefs_h
30
31 #if ENABLE(SVG)
32 #include "SVGLength.h"
33 #include "SVGPaint.h"
34 #include "ShadowData.h"
35 #include <wtf/OwnPtr.h>
36 #include <wtf/PassOwnPtr.h>
37 #include <wtf/RefCounted.h>
38 #include <wtf/RefPtr.h>
39
40 namespace WebCore {
41
42     enum EBaselineShift {
43         BS_BASELINE, BS_SUB, BS_SUPER, BS_LENGTH
44     };
45
46     enum ETextAnchor {
47         TA_START, TA_MIDDLE, TA_END
48     };
49
50     enum EColorInterpolation {
51         CI_AUTO, CI_SRGB, CI_LINEARRGB
52     };
53
54     enum EColorRendering {
55         CR_AUTO, CR_OPTIMIZESPEED, CR_OPTIMIZEQUALITY
56     };
57     enum EShapeRendering {
58         SR_AUTO, SR_OPTIMIZESPEED, SR_CRISPEDGES, SR_GEOMETRICPRECISION
59     };
60
61     enum SVGWritingMode {
62         WM_LRTB, WM_LR, WM_RLTB, WM_RL, WM_TBRL, WM_TB
63     };
64
65     enum EGlyphOrientation {
66         GO_0DEG, GO_90DEG, GO_180DEG, GO_270DEG, GO_AUTO
67     };
68
69     enum EAlignmentBaseline {
70         AB_AUTO, AB_BASELINE, AB_BEFORE_EDGE, AB_TEXT_BEFORE_EDGE,
71         AB_MIDDLE, AB_CENTRAL, AB_AFTER_EDGE, AB_TEXT_AFTER_EDGE,
72         AB_IDEOGRAPHIC, AB_ALPHABETIC, AB_HANGING, AB_MATHEMATICAL
73     };
74
75     enum EDominantBaseline {
76         DB_AUTO, DB_USE_SCRIPT, DB_NO_CHANGE, DB_RESET_SIZE,
77         DB_IDEOGRAPHIC, DB_ALPHABETIC, DB_HANGING, DB_MATHEMATICAL,
78         DB_CENTRAL, DB_MIDDLE, DB_TEXT_AFTER_EDGE, DB_TEXT_BEFORE_EDGE
79     };
80     
81     enum EVectorEffect {
82         VE_NONE,
83         VE_NON_SCALING_STROKE
84     };
85
86     class CSSValue;
87     class CSSValueList;
88     class SVGPaint;
89
90     // Inherited/Non-Inherited Style Datastructures
91     class StyleFillData : public RefCounted<StyleFillData> {
92     public:
93         static PassRefPtr<StyleFillData> create() { return adoptRef(new StyleFillData); }
94         PassRefPtr<StyleFillData> copy() const { return adoptRef(new StyleFillData(*this)); }
95
96         bool operator==(const StyleFillData&) const;
97         bool operator!=(const StyleFillData& other) const
98         {
99             return !(*this == other);
100         }
101
102         float opacity;
103         SVGPaint::SVGPaintType paintType;
104         Color paintColor;
105         String paintUri;
106
107     private:
108         StyleFillData();
109         StyleFillData(const StyleFillData&);
110     };
111
112     class StyleStrokeData : public RefCounted<StyleStrokeData> {
113     public:
114         static PassRefPtr<StyleStrokeData> create() { return adoptRef(new StyleStrokeData); }
115         PassRefPtr<StyleStrokeData> copy() const { return adoptRef(new StyleStrokeData(*this)); }
116
117         bool operator==(const StyleStrokeData&) const;
118         bool operator!=(const StyleStrokeData& other) const
119         {
120             return !(*this == other);
121         }
122
123         float opacity;
124         float miterLimit;
125
126         SVGLength width;
127         SVGLength dashOffset;
128         Vector<SVGLength> dashArray;
129
130         SVGPaint::SVGPaintType paintType;
131         Color paintColor;
132         String paintUri;
133
134     private:        
135         StyleStrokeData();
136         StyleStrokeData(const StyleStrokeData&);
137     };
138
139     class StyleStopData : public RefCounted<StyleStopData> {
140     public:
141         static PassRefPtr<StyleStopData> create() { return adoptRef(new StyleStopData); }
142         PassRefPtr<StyleStopData> copy() const { return adoptRef(new StyleStopData(*this)); }
143
144         bool operator==(const StyleStopData&) const;
145         bool operator!=(const StyleStopData& other) const
146         {
147             return !(*this == other);
148         }
149
150         float opacity;
151         Color color;
152
153     private:        
154         StyleStopData();
155         StyleStopData(const StyleStopData&);
156     };
157
158     class StyleTextData : public RefCounted<StyleTextData> {
159     public:
160         static PassRefPtr<StyleTextData> create() { return adoptRef(new StyleTextData); }
161         PassRefPtr<StyleTextData> copy() const { return adoptRef(new StyleTextData(*this)); }
162         
163         bool operator==(const StyleTextData& other) const;
164         bool operator!=(const StyleTextData& other) const
165         {
166             return !(*this == other);
167         }
168
169         SVGLength kerning;
170
171     private:
172         StyleTextData();
173         StyleTextData(const StyleTextData&);
174     };
175
176     // Note: the rule for this class is, *no inheritance* of these props
177     class StyleMiscData : public RefCounted<StyleMiscData> {
178     public:
179         static PassRefPtr<StyleMiscData> create() { return adoptRef(new StyleMiscData); }
180         PassRefPtr<StyleMiscData> copy() const { return adoptRef(new StyleMiscData(*this)); }
181
182         bool operator==(const StyleMiscData&) const;
183         bool operator!=(const StyleMiscData& other) const
184         {
185             return !(*this == other);
186         }
187
188         Color floodColor;
189         float floodOpacity;
190         Color lightingColor;
191
192         // non-inherited text stuff lives here not in StyleTextData.
193         SVGLength baselineShiftValue;
194
195     private:
196         StyleMiscData();
197         StyleMiscData(const StyleMiscData&);
198     };
199
200     class StyleShadowSVGData : public RefCounted<StyleShadowSVGData> {
201     public:
202         static PassRefPtr<StyleShadowSVGData> create() { return adoptRef(new StyleShadowSVGData); }
203         PassRefPtr<StyleShadowSVGData> copy() const { return adoptRef(new StyleShadowSVGData(*this)); }
204
205         bool operator==(const StyleShadowSVGData&) const;
206         bool operator!=(const StyleShadowSVGData& other) const
207         {
208             return !(*this == other);
209         }
210
211         OwnPtr<ShadowData> shadow;
212
213     private:
214         StyleShadowSVGData();
215         StyleShadowSVGData(const StyleShadowSVGData&);
216     };
217
218     // Non-inherited resources
219     class StyleResourceData : public RefCounted<StyleResourceData> {
220     public:
221         static PassRefPtr<StyleResourceData> create() { return adoptRef(new StyleResourceData); }
222         PassRefPtr<StyleResourceData> copy() const { return adoptRef(new StyleResourceData(*this)); }
223
224         bool operator==(const StyleResourceData&) const;
225         bool operator!=(const StyleResourceData& other) const
226         {
227             return !(*this == other);
228         }
229
230         String clipper;
231         String filter;
232         String masker;
233
234     private:
235         StyleResourceData();
236         StyleResourceData(const StyleResourceData&);
237     };
238
239     // Inherited resources
240     class StyleInheritedResourceData : public RefCounted<StyleInheritedResourceData> {
241     public:
242         static PassRefPtr<StyleInheritedResourceData> create() { return adoptRef(new StyleInheritedResourceData); }
243         PassRefPtr<StyleInheritedResourceData> copy() const { return adoptRef(new StyleInheritedResourceData(*this)); }
244
245         bool operator==(const StyleInheritedResourceData&) const;
246         bool operator!=(const StyleInheritedResourceData& other) const
247         {
248             return !(*this == other);
249         }
250
251         String markerStart;
252         String markerMid;
253         String markerEnd;
254
255     private:
256         StyleInheritedResourceData();
257         StyleInheritedResourceData(const StyleInheritedResourceData&);
258     };
259
260 } // namespace WebCore
261
262 #endif // ENABLE(SVG)
263 #endif // SVGRenderStyleDefs_h