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