]>
git.saurik.com Git - iphone-api.git/blob - WebCore/SVGRenderStyleDefs.h
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
35 #include "PlatformString.h"
36 #include <wtf/RefCounted.h>
37 #include <wtf/RefPtr.h>
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; }
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; }
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) }
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; }
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; \
66 static Data* initial##Type() { return Initial; }
68 #define SVG_RS_SET_VARIABLE(Group, Variable, Value) \
69 if(!(Group->Variable == Value)) \
70 Group.access()->Variable = Value;
75 BS_BASELINE
, BS_SUB
, BS_SUPER
, BS_LENGTH
79 TA_START
, TA_MIDDLE
, TA_END
82 enum EColorInterpolation
{
83 CI_AUTO
, CI_SRGB
, CI_LINEARRGB
86 enum EColorRendering
{
87 CR_AUTO
, CR_OPTIMIZESPEED
, CR_OPTIMIZEQUALITY
90 enum EImageRendering
{
91 IR_AUTO
, IR_OPTIMIZESPEED
, IR_OPTIMIZEQUALITY
94 enum EShapeRendering
{
95 SR_AUTO
, SR_OPTIMIZESPEED
, SR_CRISPEDGES
, SR_GEOMETRICPRECISION
99 TR_AUTO
, TR_OPTIMIZESPEED
, TR_OPTIMIZELEGIBILITY
, TR_GEOMETRICPRECISION
103 WM_LRTB
, WM_LR
, WM_RLTB
, WM_RL
, WM_TBRL
, WM_TB
106 enum EGlyphOrientation
{
107 GO_0DEG
, GO_90DEG
, GO_180DEG
, GO_270DEG
, GO_AUTO
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
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
126 // Inherited/Non-Inherited Style Datastructures
127 class StyleFillData
: public RefCounted
<StyleFillData
> {
129 static PassRefPtr
<StyleFillData
> create() { return adoptRef(new StyleFillData
); }
130 PassRefPtr
<StyleFillData
> copy() const { return adoptRef(new StyleFillData(*this)); }
132 bool operator==(const StyleFillData
&other
) const;
133 bool operator!=(const StyleFillData
&other
) const
135 return !(*this == other
);
139 RefPtr
<SVGPaint
> paint
;
143 StyleFillData(const StyleFillData
&);
146 class StyleStrokeData
: public RefCounted
<StyleStrokeData
> {
148 static PassRefPtr
<StyleStrokeData
> create() { return adoptRef(new StyleStrokeData
); }
149 PassRefPtr
<StyleStrokeData
> copy() const { return adoptRef(new StyleStrokeData(*this)); }
151 bool operator==(const StyleStrokeData
&) const;
152 bool operator!=(const StyleStrokeData
& other
) const
154 return !(*this == other
);
160 RefPtr
<CSSValue
> width
;
161 RefPtr
<CSSValue
> dashOffset
;
163 RefPtr
<SVGPaint
> paint
;
164 RefPtr
<CSSValueList
> dashArray
;
168 StyleStrokeData(const StyleStrokeData
&);
171 class StyleStopData
: public RefCounted
<StyleStopData
> {
173 static PassRefPtr
<StyleStopData
> create() { return adoptRef(new StyleStopData
); }
174 PassRefPtr
<StyleStopData
> copy() const { return adoptRef(new StyleStopData(*this)); }
176 bool operator==(const StyleStopData
&other
) const;
177 bool operator!=(const StyleStopData
&other
) const
179 return !(*this == other
);
187 StyleStopData(const StyleStopData
&);
190 class StyleTextData
: public RefCounted
<StyleTextData
> {
192 static PassRefPtr
<StyleTextData
> create() { return adoptRef(new StyleTextData
); }
193 PassRefPtr
<StyleTextData
> copy() const { return adoptRef(new StyleTextData(*this)); }
195 bool operator==(const StyleTextData
& other
) const;
196 bool operator!=(const StyleTextData
& other
) const
198 return !(*this == other
);
201 RefPtr
<CSSValue
> kerning
;
205 StyleTextData(const StyleTextData
& other
);
208 class StyleClipData
: public RefCounted
<StyleClipData
> {
210 static PassRefPtr
<StyleClipData
> create() { return adoptRef(new StyleClipData
); }
211 PassRefPtr
<StyleClipData
> copy() const { return adoptRef(new StyleClipData(*this)); }
213 bool operator==(const StyleClipData
&other
) const;
214 bool operator!=(const StyleClipData
&other
) const
216 return !(*this == other
);
223 StyleClipData(const StyleClipData
&);
226 class StyleMaskData
: public RefCounted
<StyleMaskData
> {
228 static PassRefPtr
<StyleMaskData
> create() { return adoptRef(new StyleMaskData
); }
229 PassRefPtr
<StyleMaskData
> copy() const { return adoptRef(new StyleMaskData(*this)); }
231 bool operator==(const StyleMaskData
&other
) const;
232 bool operator!=(const StyleMaskData
&other
) const { return !(*this == other
); }
238 StyleMaskData(const StyleMaskData
&);
241 class StyleMarkerData
: public RefCounted
<StyleMarkerData
> {
243 static PassRefPtr
<StyleMarkerData
> create() { return adoptRef(new StyleMarkerData
); }
244 PassRefPtr
<StyleMarkerData
> copy() const { return adoptRef(new StyleMarkerData(*this)); }
246 bool operator==(const StyleMarkerData
&other
) const;
247 bool operator!=(const StyleMarkerData
&other
) const
249 return !(*this == other
);
258 StyleMarkerData(const StyleMarkerData
&);
261 // Note : the rule for this class is, *no inheritance* of these props
262 class StyleMiscData
: public RefCounted
<StyleMiscData
> {
264 static PassRefPtr
<StyleMiscData
> create() { return adoptRef(new StyleMiscData
); }
265 PassRefPtr
<StyleMiscData
> copy() const { return adoptRef(new StyleMiscData(*this)); }
267 bool operator==(const StyleMiscData
&other
) const;
268 bool operator!=(const StyleMiscData
&other
) const
270 return !(*this == other
);
279 // non-inherited text stuff lives here not in StyleTextData.
280 RefPtr
<CSSValue
> baselineShiftValue
;
284 StyleMiscData(const StyleMiscData
&);
287 } // namespace WebCore
289 #endif // ENABLE(SVG)
290 #endif // SVGRenderStyleDefs_h