File indexing completed on 2024-04-28 15:24:20
0001 /* 0002 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 0003 2004, 2005 Rob Buis <buis@kde.org> 0004 0005 Based on khtml code by: 0006 Copyright (C) 2000-2003 Lars Knoll (knoll@kde.org) 0007 (C) 2000 Antti Koivisto (koivisto@kde.org) 0008 (C) 2000-2003 Dirk Mueller (mueller@kde.org) 0009 (C) 2002-2003 Apple Computer, Inc. 0010 0011 This file is part of the KDE project 0012 0013 This library is free software; you can redistribute it and/or 0014 modify it under the terms of the GNU Library General Public 0015 License as published by the Free Software Foundation; either 0016 version 2 of the License, or (at your option) any later version. 0017 0018 This library is distributed in the hope that it will be useful, 0019 but WITHOUT ANY WARRANTY; without even the implied warranty of 0020 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0021 Library General Public License for more details. 0022 0023 You should have received a copy of the GNU Library General Public License 0024 along with this library; see the file COPYING.LIB. If not, write to 0025 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0026 Boston, MA 02110-1301, USA. 0027 */ 0028 0029 #ifndef SVGRenderStyleDefs_h 0030 #define SVGRenderStyleDefs_h 0031 0032 #include "dom/dom_string.h" 0033 #include "css/css_valueimpl.h" 0034 #include "css/css_svgvalueimpl.h" 0035 0036 #include <QColor> 0037 #include <wtf/RefCounted.h> 0038 #include <wtf/RefPtr.h> 0039 #include <wtf/PassRefPtr.h> 0040 0041 // Helper macros for 'SVGRenderStyle' 0042 #define SVG_RS_DEFINE_ATTRIBUTE(Data, Type, Name, Initial) \ 0043 void set##Type(Data val) { svg_noninherited_flags.f._##Name = val; } \ 0044 Data Name() const { return (Data) svg_noninherited_flags.f._##Name; } \ 0045 static Data initial##Type() { return Initial; } 0046 0047 #define SVG_RS_DEFINE_ATTRIBUTE_INHERITED(Data, Type, Name, Initial) \ 0048 void set##Type(Data val) { svg_inherited_flags._##Name = val; } \ 0049 Data Name() const { return (Data) svg_inherited_flags._##Name; } \ 0050 static Data initial##Type() { return Initial; } 0051 0052 // "Helper" macros for SVG's RenderStyle properties 0053 // FIXME: These are impossible to work with or debug. 0054 #define SVG_RS_DEFINE_ATTRIBUTE_DATAREF(Data, Group, Variable, Type, Name) \ 0055 Data Name() const { return Group->Variable; } \ 0056 void set##Type(Data obj) { SVG_RS_SET_VARIABLE(Group, Variable, obj) } 0057 0058 #define SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Data, Group, Variable, Type, Name, Initial) \ 0059 SVG_RS_DEFINE_ATTRIBUTE_DATAREF(Data, Group, Variable, Type, Name) \ 0060 static Data initial##Type() { return Initial; } 0061 0062 #define SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(Data, Group, Variable, Type, Name, Initial) \ 0063 Data* Name() const { return Group->Variable.get(); } \ 0064 void set##Type(PassRefPtr<Data> obj) { \ 0065 if(!(Group->Variable == obj)) \ 0066 Group.access()->Variable = obj; \ 0067 } \ 0068 static Data* initial##Type() { return Initial; } 0069 0070 #define SVG_RS_SET_VARIABLE(Group, Variable, Value) \ 0071 if(!(Group->Variable == Value)) \ 0072 Group.access()->Variable = Value; 0073 0074 using DOM::SVGPaintImpl; 0075 using DOM::CSSValueImpl; 0076 using DOM::CSSValueListImpl; 0077 0078 namespace khtml 0079 { 0080 enum EBaselineShift { 0081 BS_BASELINE, BS_SUB, BS_SUPER, BS_LENGTH 0082 }; 0083 0084 enum ETextAnchor { 0085 TA_START, TA_MIDDLE, TA_END 0086 }; 0087 0088 enum EColorInterpolation { 0089 CI_AUTO, CI_SRGB, CI_LINEARRGB 0090 }; 0091 0092 enum EColorRendering { 0093 CR_AUTO, CR_OPTIMIZESPEED, CR_OPTIMIZEQUALITY 0094 }; 0095 0096 enum EImageRendering { 0097 IR_AUTO, IR_OPTIMIZESPEED, IR_OPTIMIZEQUALITY 0098 }; 0099 0100 enum EShapeRendering { 0101 SR_AUTO, SR_OPTIMIZESPEED, SR_CRISPEDGES, SR_GEOMETRICPRECISION 0102 }; 0103 0104 enum ETextRendering { 0105 TR_AUTO, TR_OPTIMIZESPEED, TR_OPTIMIZELEGIBILITY, TR_GEOMETRICPRECISION 0106 }; 0107 0108 enum EWritingMode { 0109 WM_LRTB, WM_LR, WM_RLTB, WM_RL, WM_TBRL, WM_TB 0110 }; 0111 0112 enum EGlyphOrientation { 0113 GO_0DEG, GO_90DEG, GO_180DEG, GO_270DEG, GO_AUTO 0114 }; 0115 0116 enum EAlignmentBaseline { 0117 AB_AUTO, AB_BASELINE, AB_BEFORE_EDGE, AB_TEXT_BEFORE_EDGE, 0118 AB_MIDDLE, AB_CENTRAL, AB_AFTER_EDGE, AB_TEXT_AFTER_EDGE, 0119 AB_IDEOGRAPHIC, AB_ALPHABETIC, AB_HANGING, AB_MATHEMATICAL 0120 }; 0121 0122 enum EDominantBaseline { 0123 DB_AUTO, DB_USE_SCRIPT, DB_NO_CHANGE, DB_RESET_SIZE, 0124 DB_IDEOGRAPHIC, DB_ALPHABETIC, DB_HANGING, DB_MATHEMATICAL, 0125 DB_CENTRAL, DB_MIDDLE, DB_TEXT_AFTER_EDGE, DB_TEXT_BEFORE_EDGE 0126 }; 0127 0128 enum EPointerEvents { 0129 PE_NONE, PE_STROKE, PE_FILL, PE_PAINTED, PE_VISIBLE, 0130 PE_VISIBLE_STROKE, PE_VISIBLE_FILL, PE_VISIBLE_PAINTED, PE_ALL 0131 }; 0132 0133 // Inherited/Non-Inherited Style Datastructures 0134 class StyleFillData : public RefCounted<StyleFillData> 0135 { 0136 public: 0137 bool operator==(const StyleFillData &other) const; 0138 bool operator!=(const StyleFillData &other) const 0139 { 0140 return !(*this == other); 0141 } 0142 0143 float opacity; 0144 RefPtr<SVGPaintImpl> paint; 0145 0146 StyleFillData(); 0147 StyleFillData(const StyleFillData &); 0148 }; 0149 0150 class StyleStrokeData : public RefCounted<StyleStrokeData> 0151 { 0152 public: 0153 bool operator==(const StyleStrokeData &) const; 0154 bool operator!=(const StyleStrokeData &other) const 0155 { 0156 return !(*this == other); 0157 } 0158 0159 float opacity; 0160 float miterLimit; 0161 0162 RefPtr<CSSValueImpl> width; 0163 RefPtr<CSSValueImpl> dashOffset; 0164 0165 RefPtr<SVGPaintImpl> paint; 0166 RefPtr<CSSValueListImpl> dashArray; 0167 0168 StyleStrokeData(); 0169 StyleStrokeData(const StyleStrokeData &); 0170 }; 0171 0172 class StyleStopData : public RefCounted<StyleStopData> 0173 { 0174 public: 0175 bool operator==(const StyleStopData &other) const; 0176 bool operator!=(const StyleStopData &other) const 0177 { 0178 return !(*this == other); 0179 } 0180 0181 float opacity; 0182 QColor color; 0183 0184 StyleStopData(); 0185 StyleStopData(const StyleStopData &); 0186 }; 0187 0188 class StyleTextData : public RefCounted<StyleTextData> 0189 { 0190 public: 0191 bool operator==(const StyleTextData &other) const; 0192 bool operator!=(const StyleTextData &other) const 0193 { 0194 return !(*this == other); 0195 } 0196 0197 RefPtr<CSSValueImpl> kerning; 0198 0199 StyleTextData(); 0200 StyleTextData(const StyleTextData &other); 0201 }; 0202 0203 class StyleClipData : public RefCounted<StyleClipData> 0204 { 0205 public: 0206 bool operator==(const StyleClipData &other) const; 0207 bool operator!=(const StyleClipData &other) const 0208 { 0209 return !(*this == other); 0210 } 0211 0212 DOMString clipPath; 0213 0214 StyleClipData(); 0215 StyleClipData(const StyleClipData &); 0216 }; 0217 0218 class StyleMaskData : public RefCounted<StyleMaskData> 0219 { 0220 public: 0221 bool operator==(const StyleMaskData &other) const; 0222 bool operator!=(const StyleMaskData &other) const 0223 { 0224 return !(*this == other); 0225 } 0226 0227 DOMString maskElement; 0228 0229 StyleMaskData(); 0230 StyleMaskData(const StyleMaskData &); 0231 }; 0232 0233 class StyleMarkerData : public RefCounted<StyleMarkerData> 0234 { 0235 public: 0236 bool operator==(const StyleMarkerData &other) const; 0237 bool operator!=(const StyleMarkerData &other) const 0238 { 0239 return !(*this == other); 0240 } 0241 0242 DOMString startMarker; 0243 DOMString midMarker; 0244 DOMString endMarker; 0245 0246 StyleMarkerData(); 0247 StyleMarkerData(const StyleMarkerData &); 0248 }; 0249 0250 // Note : the rule for this class is, *no inheritance* of these props 0251 class StyleMiscData : public RefCounted<StyleMiscData> 0252 { 0253 public: 0254 bool operator==(const StyleMiscData &other) const; 0255 bool operator!=(const StyleMiscData &other) const 0256 { 0257 return !(*this == other); 0258 } 0259 0260 DOMString filter; 0261 QColor floodColor; 0262 float floodOpacity; 0263 0264 QColor lightingColor; 0265 0266 // non-inherited text stuff lives here not in StyleTextData. 0267 RefPtr<CSSValueImpl> baselineShiftValue; 0268 0269 StyleMiscData(); 0270 StyleMiscData(const StyleMiscData &); 0271 }; 0272 0273 } 0274 0275 #endif // SVGRenderStyleDefs_h 0276