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 Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
6
7 Based on khtml code by:
8 Copyright (C) 2000-2003 Lars Knoll (knoll@kde.org)
9 (C) 2000 Antti Koivisto (koivisto@kde.org)
10 (C) 2000-2003 Dirk Mueller (mueller@kde.org)
11 (C) 2002-2003 Apple Inc.
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#pragma once
30
31#include "Length.h"
32#include "SVGLengthValue.h"
33#include "ShadowData.h"
34#include <wtf/RefCounted.h>
35#include <wtf/RefPtr.h>
36
37namespace WebCore {
38
39class CSSValue;
40class CSSValueList;
41class SVGPaint;
42
43enum class SVGPaintType : uint8_t {
44 RGBColor,
45 None,
46 CurrentColor,
47 URINone,
48 URICurrentColor,
49 URIRGBColor,
50 URI
51};
52
53enum class BaselineShift : uint8_t {
54 Baseline,
55 Sub,
56 Super,
57 Length
58};
59
60enum class TextAnchor : uint8_t {
61 Start,
62 Middle,
63 End
64};
65
66enum class ColorInterpolation : uint8_t {
67 Auto,
68 SRGB,
69 LinearRGB
70};
71
72enum class ColorRendering : uint8_t {
73 Auto,
74 OptimizeSpeed,
75 OptimizeQuality
76};
77
78enum class ShapeRendering : uint8_t {
79 Auto,
80 OptimizeSpeed,
81 CrispEdges,
82 GeometricPrecision
83};
84
85enum class GlyphOrientation : uint8_t {
86 Degrees0,
87 Degrees90,
88 Degrees180,
89 Degrees270,
90 Auto
91};
92
93enum class AlignmentBaseline : uint8_t {
94 Auto,
95 Baseline,
96 BeforeEdge,
97 TextBeforeEdge,
98 Middle,
99 Central,
100 AfterEdge,
101 TextAfterEdge,
102 Ideographic,
103 Alphabetic,
104 Hanging,
105 Mathematical
106};
107
108enum class DominantBaseline : uint8_t {
109 Auto,
110 UseScript,
111 NoChange,
112 ResetSize,
113 Ideographic,
114 Alphabetic,
115 Hanging,
116 Mathematical,
117 Central,
118 Middle,
119 TextAfterEdge,
120 TextBeforeEdge
121};
122
123enum class VectorEffect : uint8_t {
124 None,
125 NonScalingStroke
126};
127
128enum class BufferedRendering : uint8_t {
129 Auto,
130 Dynamic,
131 Static
132};
133
134enum class MaskType : uint8_t {
135 Luminance,
136 Alpha
137};
138
139// Inherited/Non-Inherited Style Datastructures
140class StyleFillData : public RefCounted<StyleFillData> {
141public:
142 static Ref<StyleFillData> create() { return adoptRef(*new StyleFillData); }
143 Ref<StyleFillData> copy() const;
144
145 bool operator==(const StyleFillData&) const;
146 bool operator!=(const StyleFillData& other) const
147 {
148 return !(*this == other);
149 }
150
151 float opacity;
152 Color paintColor;
153 Color visitedLinkPaintColor;
154 String paintUri;
155 String visitedLinkPaintUri;
156 SVGPaintType paintType;
157 SVGPaintType visitedLinkPaintType;
158
159private:
160 StyleFillData();
161 StyleFillData(const StyleFillData&);
162};
163
164class StyleStrokeData : public RefCounted<StyleStrokeData> {
165public:
166 static Ref<StyleStrokeData> create() { return adoptRef(*new StyleStrokeData); }
167 Ref<StyleStrokeData> copy() const;
168
169 bool operator==(const StyleStrokeData&) const;
170 bool operator!=(const StyleStrokeData& other) const
171 {
172 return !(*this == other);
173 }
174
175 float opacity;
176
177 Color paintColor;
178 Color visitedLinkPaintColor;
179
180 String paintUri;
181 String visitedLinkPaintUri;
182
183 Length dashOffset;
184 Vector<SVGLengthValue> dashArray;
185
186 SVGPaintType paintType;
187 SVGPaintType visitedLinkPaintType;
188
189private:
190 StyleStrokeData();
191 StyleStrokeData(const StyleStrokeData&);
192};
193
194class StyleStopData : public RefCounted<StyleStopData> {
195public:
196 static Ref<StyleStopData> create() { return adoptRef(*new StyleStopData); }
197 Ref<StyleStopData> copy() const;
198
199 bool operator==(const StyleStopData&) const;
200 bool operator!=(const StyleStopData& other) const
201 {
202 return !(*this == other);
203 }
204
205 float opacity;
206 Color color;
207
208private:
209 StyleStopData();
210 StyleStopData(const StyleStopData&);
211};
212
213class StyleTextData : public RefCounted<StyleTextData> {
214public:
215 static Ref<StyleTextData> create() { return adoptRef(*new StyleTextData); }
216 Ref<StyleTextData> copy() const;
217
218 bool operator==(const StyleTextData& other) const;
219 bool operator!=(const StyleTextData& other) const
220 {
221 return !(*this == other);
222 }
223
224 SVGLengthValue kerning;
225
226private:
227 StyleTextData();
228 StyleTextData(const StyleTextData&);
229};
230
231// Note: the rule for this class is, *no inheritance* of these props
232class StyleMiscData : public RefCounted<StyleMiscData> {
233public:
234 static Ref<StyleMiscData> create() { return adoptRef(*new StyleMiscData); }
235 Ref<StyleMiscData> copy() const;
236
237 bool operator==(const StyleMiscData&) const;
238 bool operator!=(const StyleMiscData& other) const
239 {
240 return !(*this == other);
241 }
242
243 float floodOpacity;
244 Color floodColor;
245 Color lightingColor;
246
247 // non-inherited text stuff lives here not in StyleTextData.
248 SVGLengthValue baselineShiftValue;
249
250private:
251 StyleMiscData();
252 StyleMiscData(const StyleMiscData&);
253};
254
255class StyleShadowSVGData : public RefCounted<StyleShadowSVGData> {
256public:
257 static Ref<StyleShadowSVGData> create() { return adoptRef(*new StyleShadowSVGData); }
258 Ref<StyleShadowSVGData> copy() const;
259
260 bool operator==(const StyleShadowSVGData&) const;
261 bool operator!=(const StyleShadowSVGData& other) const
262 {
263 return !(*this == other);
264 }
265
266 std::unique_ptr<ShadowData> shadow;
267
268private:
269 StyleShadowSVGData();
270 StyleShadowSVGData(const StyleShadowSVGData&);
271};
272
273// Non-inherited resources
274class StyleResourceData : public RefCounted<StyleResourceData> {
275public:
276 static Ref<StyleResourceData> create() { return adoptRef(*new StyleResourceData); }
277 Ref<StyleResourceData> copy() const;
278
279 bool operator==(const StyleResourceData&) const;
280 bool operator!=(const StyleResourceData& other) const
281 {
282 return !(*this == other);
283 }
284
285 String clipper;
286 String masker;
287
288private:
289 StyleResourceData();
290 StyleResourceData(const StyleResourceData&);
291};
292
293// Inherited resources
294class StyleInheritedResourceData : public RefCounted<StyleInheritedResourceData> {
295public:
296 static Ref<StyleInheritedResourceData> create() { return adoptRef(*new StyleInheritedResourceData); }
297 Ref<StyleInheritedResourceData> copy() const;
298
299 bool operator==(const StyleInheritedResourceData&) const;
300 bool operator!=(const StyleInheritedResourceData& other) const
301 {
302 return !(*this == other);
303 }
304
305 String markerStart;
306 String markerMid;
307 String markerEnd;
308
309private:
310 StyleInheritedResourceData();
311 StyleInheritedResourceData(const StyleInheritedResourceData&);
312};
313
314// Positioning and sizing properties.
315class StyleLayoutData : public RefCounted<StyleLayoutData> {
316public:
317 static Ref<StyleLayoutData> create() { return adoptRef(*new StyleLayoutData); }
318 Ref<StyleLayoutData> copy() const;
319
320 bool operator==(const StyleLayoutData&) const;
321 bool operator!=(const StyleLayoutData& other) const
322 {
323 return !(*this == other);
324 }
325
326 Length cx;
327 Length cy;
328 Length r;
329 Length rx;
330 Length ry;
331 Length x;
332 Length y;
333
334private:
335 StyleLayoutData();
336 StyleLayoutData(const StyleLayoutData&);
337};
338
339} // namespace WebCore
340