• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2     Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3                   2004, 2005, 2007 Rob Buis <buis@kde.org>
4 
5     Based on khtml code by:
6     Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
7     Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
8     Copyright (C) 2002-2003 Dirk Mueller (mueller@kde.org)
9     Copyright (C) 2002 Apple Computer, Inc.
10 
11     This file is part of the KDE project
12 
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.
17 
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.
22 
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.
27 */
28 
29 #include "config.h"
30 #if ENABLE(SVG)
31 #include "SVGRenderStyleDefs.h"
32 
33 #include "RenderStyle.h"
34 #include "SVGRenderStyle.h"
35 
36 using namespace WebCore;
37 
StyleFillData()38 StyleFillData::StyleFillData()
39 {
40     paint = SVGRenderStyle::initialFillPaint();
41     opacity = SVGRenderStyle::initialFillOpacity();
42 }
43 
StyleFillData(const StyleFillData & other)44 StyleFillData::StyleFillData(const StyleFillData& other)
45     : RefCounted<StyleFillData>()
46 {
47     paint = other.paint;
48     opacity = other.opacity;
49 }
50 
operator ==(const StyleFillData & other) const51 bool StyleFillData::operator==(const StyleFillData &other) const
52 {
53     if (opacity != other.opacity)
54         return false;
55 
56     if (!paint || !other.paint)
57         return paint == other.paint;
58 
59     if (paint->paintType() != other.paint->paintType())
60         return false;
61 
62     if (paint->paintType() == SVGPaint::SVG_PAINTTYPE_URI)
63         return paint->uri() == other.paint->uri();
64 
65     if (paint->paintType() == SVGPaint::SVG_PAINTTYPE_RGBCOLOR)
66         return paint->color() == other.paint->color();
67 
68     return paint == other.paint;
69 }
70 
StyleStrokeData()71 StyleStrokeData::StyleStrokeData()
72 {
73     width = SVGRenderStyle::initialStrokeWidth();
74     paint = SVGRenderStyle::initialStrokePaint();
75     opacity = SVGRenderStyle::initialStrokeOpacity();
76     miterLimit = SVGRenderStyle::initialStrokeMiterLimit();
77     dashOffset = SVGRenderStyle::initialStrokeDashOffset();
78     dashArray = SVGRenderStyle::initialStrokeDashArray();
79 }
80 
StyleStrokeData(const StyleStrokeData & other)81 StyleStrokeData::StyleStrokeData(const StyleStrokeData& other)
82     : RefCounted<StyleStrokeData>()
83 {
84     width = other.width;
85     paint = other.paint;
86     opacity = other.opacity;
87     miterLimit = other.miterLimit;
88     dashOffset = other.dashOffset;
89     dashArray = other.dashArray;
90 }
91 
operator ==(const StyleStrokeData & other) const92 bool StyleStrokeData::operator==(const StyleStrokeData &other) const
93 {
94     return (paint == other.paint) &&
95            (width == other.width) &&
96            (opacity == other.opacity) &&
97            (miterLimit == other.miterLimit) &&
98            (dashOffset == other.dashOffset) &&
99            (dashArray == other.dashArray);
100 }
101 
StyleStopData()102 StyleStopData::StyleStopData()
103 {
104     color = SVGRenderStyle::initialStopColor();
105     opacity = SVGRenderStyle::initialStopOpacity();
106 }
107 
StyleStopData(const StyleStopData & other)108 StyleStopData::StyleStopData(const StyleStopData& other)
109     : RefCounted<StyleStopData>()
110 {
111     color = other.color;
112     opacity = other.opacity;
113 }
114 
operator ==(const StyleStopData & other) const115 bool StyleStopData::operator==(const StyleStopData &other) const
116 {
117     return (color == other.color) &&
118            (opacity == other.opacity);
119 }
120 
StyleTextData()121 StyleTextData::StyleTextData()
122 {
123     kerning = SVGRenderStyle::initialKerning();
124 }
125 
StyleTextData(const StyleTextData & other)126 StyleTextData::StyleTextData(const StyleTextData& other)
127     : RefCounted<StyleTextData>()
128 {
129     kerning = other.kerning;
130 }
131 
operator ==(const StyleTextData & other) const132 bool StyleTextData::operator==(const StyleTextData& other) const
133 {
134     return kerning == other.kerning;
135 }
136 
StyleClipData()137 StyleClipData::StyleClipData()
138 {
139     clipPath = SVGRenderStyle::initialClipPath();
140 }
141 
StyleClipData(const StyleClipData & other)142 StyleClipData::StyleClipData(const StyleClipData& other)
143     : RefCounted<StyleClipData>()
144 {
145     clipPath = other.clipPath;
146 }
147 
operator ==(const StyleClipData & other) const148 bool StyleClipData::operator==(const StyleClipData &other) const
149 {
150     return (clipPath == other.clipPath);
151 }
152 
StyleMaskData()153 StyleMaskData::StyleMaskData()
154 {
155     maskElement = SVGRenderStyle::initialMaskElement();
156 }
157 
StyleMaskData(const StyleMaskData & other)158 StyleMaskData::StyleMaskData(const StyleMaskData& other)
159     : RefCounted<StyleMaskData>()
160 {
161     maskElement = other.maskElement;
162 }
163 
operator ==(const StyleMaskData & other) const164 bool StyleMaskData::operator==(const StyleMaskData &other) const
165 {
166     return (maskElement == other.maskElement);
167 }
168 
StyleMarkerData()169 StyleMarkerData::StyleMarkerData()
170 {
171     startMarker = SVGRenderStyle::initialStartMarker();
172     midMarker = SVGRenderStyle::initialMidMarker();
173     endMarker = SVGRenderStyle::initialEndMarker();
174 }
175 
StyleMarkerData(const StyleMarkerData & other)176 StyleMarkerData::StyleMarkerData(const StyleMarkerData& other)
177     : RefCounted<StyleMarkerData>()
178 {
179     startMarker = other.startMarker;
180     midMarker = other.midMarker;
181     endMarker = other.endMarker;
182 }
183 
operator ==(const StyleMarkerData & other) const184 bool StyleMarkerData::operator==(const StyleMarkerData &other) const
185 {
186     return (startMarker == other.startMarker && midMarker == other.midMarker && endMarker == other.endMarker);
187 }
188 
StyleMiscData()189 StyleMiscData::StyleMiscData()
190 {
191     floodColor = SVGRenderStyle::initialFloodColor();
192     floodOpacity = SVGRenderStyle::initialFloodOpacity();
193     lightingColor = SVGRenderStyle::initialLightingColor();
194     baselineShiftValue = SVGRenderStyle::initialBaselineShiftValue();
195 }
196 
StyleMiscData(const StyleMiscData & other)197 StyleMiscData::StyleMiscData(const StyleMiscData& other)
198     : RefCounted<StyleMiscData>()
199 {
200     filter = other.filter;
201     floodColor = other.floodColor;
202     floodOpacity = other.floodOpacity;
203     lightingColor = other.lightingColor;
204     baselineShiftValue = other.baselineShiftValue;
205 }
206 
operator ==(const StyleMiscData & other) const207 bool StyleMiscData::operator==(const StyleMiscData &other) const
208 {
209     return filter == other.filter
210            && floodOpacity == other.floodOpacity
211            && floodColor == other.floodColor
212            && lightingColor == other.lightingColor
213            && baselineShiftValue == other.baselineShiftValue;
214 }
215 
216 #endif // ENABLE(SVG)
217 
218 // vim:ts=4:noet
219