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