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