Home | History | Annotate | Download | only in style
      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     class CSSValue;
     96     class CSSValueList;
     97     class SVGPaint;
     98 
     99     // Inherited/Non-Inherited Style Datastructures
    100     class StyleFillData : public RefCounted<StyleFillData> {
    101     public:
    102         static PassRefPtr<StyleFillData> create() { return adoptRef(new StyleFillData); }
    103         PassRefPtr<StyleFillData> copy() const { return adoptRef(new StyleFillData(*this)); }
    104 
    105         bool operator==(const StyleFillData&) const;
    106         bool operator!=(const StyleFillData& other) const
    107         {
    108             return !(*this == other);
    109         }
    110 
    111         float opacity;
    112         SVGPaint::SVGPaintType paintType;
    113         Color paintColor;
    114         String paintUri;
    115         SVGPaint::SVGPaintType visitedLinkPaintType;
    116         Color visitedLinkPaintColor;
    117         String visitedLinkPaintUri;
    118 
    119     private:
    120         StyleFillData();
    121         StyleFillData(const StyleFillData&);
    122     };
    123 
    124     class StyleStrokeData : public RefCounted<StyleStrokeData> {
    125     public:
    126         static PassRefPtr<StyleStrokeData> create() { return adoptRef(new StyleStrokeData); }
    127         PassRefPtr<StyleStrokeData> copy() const { return adoptRef(new StyleStrokeData(*this)); }
    128 
    129         bool operator==(const StyleStrokeData&) const;
    130         bool operator!=(const StyleStrokeData& other) const
    131         {
    132             return !(*this == other);
    133         }
    134 
    135         float opacity;
    136         float miterLimit;
    137 
    138         SVGLength width;
    139         SVGLength dashOffset;
    140         Vector<SVGLength> dashArray;
    141 
    142         SVGPaint::SVGPaintType paintType;
    143         Color paintColor;
    144         String paintUri;
    145         SVGPaint::SVGPaintType visitedLinkPaintType;
    146         Color visitedLinkPaintColor;
    147         String visitedLinkPaintUri;
    148 
    149     private:
    150         StyleStrokeData();
    151         StyleStrokeData(const StyleStrokeData&);
    152     };
    153 
    154     class StyleStopData : public RefCounted<StyleStopData> {
    155     public:
    156         static PassRefPtr<StyleStopData> create() { return adoptRef(new StyleStopData); }
    157         PassRefPtr<StyleStopData> copy() const { return adoptRef(new StyleStopData(*this)); }
    158 
    159         bool operator==(const StyleStopData&) const;
    160         bool operator!=(const StyleStopData& other) const
    161         {
    162             return !(*this == other);
    163         }
    164 
    165         float opacity;
    166         Color color;
    167 
    168     private:
    169         StyleStopData();
    170         StyleStopData(const StyleStopData&);
    171     };
    172 
    173     class StyleTextData : public RefCounted<StyleTextData> {
    174     public:
    175         static PassRefPtr<StyleTextData> create() { return adoptRef(new StyleTextData); }
    176         PassRefPtr<StyleTextData> copy() const { return adoptRef(new StyleTextData(*this)); }
    177 
    178         bool operator==(const StyleTextData& other) const;
    179         bool operator!=(const StyleTextData& other) const
    180         {
    181             return !(*this == other);
    182         }
    183 
    184         SVGLength kerning;
    185 
    186     private:
    187         StyleTextData();
    188         StyleTextData(const StyleTextData&);
    189     };
    190 
    191     // Note: the rule for this class is, *no inheritance* of these props
    192     class StyleMiscData : public RefCounted<StyleMiscData> {
    193     public:
    194         static PassRefPtr<StyleMiscData> create() { return adoptRef(new StyleMiscData); }
    195         PassRefPtr<StyleMiscData> copy() const { return adoptRef(new StyleMiscData(*this)); }
    196 
    197         bool operator==(const StyleMiscData&) const;
    198         bool operator!=(const StyleMiscData& other) const
    199         {
    200             return !(*this == other);
    201         }
    202 
    203         Color floodColor;
    204         float floodOpacity;
    205         Color lightingColor;
    206 
    207         // non-inherited text stuff lives here not in StyleTextData.
    208         SVGLength baselineShiftValue;
    209 
    210     private:
    211         StyleMiscData();
    212         StyleMiscData(const StyleMiscData&);
    213     };
    214 
    215     // Non-inherited resources
    216     class StyleResourceData : public RefCounted<StyleResourceData> {
    217     public:
    218         static PassRefPtr<StyleResourceData> create() { return adoptRef(new StyleResourceData); }
    219         PassRefPtr<StyleResourceData> copy() const { return adoptRef(new StyleResourceData(*this)); }
    220 
    221         bool operator==(const StyleResourceData&) const;
    222         bool operator!=(const StyleResourceData& other) const
    223         {
    224             return !(*this == other);
    225         }
    226 
    227         String clipper;
    228         String filter;
    229         String masker;
    230 
    231     private:
    232         StyleResourceData();
    233         StyleResourceData(const StyleResourceData&);
    234     };
    235 
    236     // Inherited resources
    237     class StyleInheritedResourceData : public RefCounted<StyleInheritedResourceData> {
    238     public:
    239         static PassRefPtr<StyleInheritedResourceData> create() { return adoptRef(new StyleInheritedResourceData); }
    240         PassRefPtr<StyleInheritedResourceData> copy() const { return adoptRef(new StyleInheritedResourceData(*this)); }
    241 
    242         bool operator==(const StyleInheritedResourceData&) const;
    243         bool operator!=(const StyleInheritedResourceData& other) const
    244         {
    245             return !(*this == other);
    246         }
    247 
    248         String markerStart;
    249         String markerMid;
    250         String markerEnd;
    251 
    252     private:
    253         StyleInheritedResourceData();
    254         StyleInheritedResourceData(const StyleInheritedResourceData&);
    255     };
    256 
    257 } // namespace WebCore
    258 
    259 #endif // SVGRenderStyleDefs_h
    260