1 /*
2     Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3                   2004, 2005, 2007 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) 1999 Antti Koivisto (koivisto@kde.org)
8     Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
9     Copyright (C) 2002-2003 Dirk Mueller (mueller@kde.org)
10     Copyright (C) 2002 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 #include "config.h"
29 
30 #if ENABLE(SVG)
31 #include "SVGRenderStyleDefs.h"
32 
33 #include "RenderStyle.h"
34 #include "SVGRenderStyle.h"
35 
36 namespace WebCore {
37 
StyleFillData()38 StyleFillData::StyleFillData()
39     : opacity(SVGRenderStyle::initialFillOpacity())
40     , paintType(SVGRenderStyle::initialFillPaintType())
41     , paintColor(SVGRenderStyle::initialFillPaintColor())
42     , paintUri(SVGRenderStyle::initialFillPaintUri())
43 {
44 }
45 
StyleFillData(const StyleFillData & other)46 StyleFillData::StyleFillData(const StyleFillData& other)
47     : RefCounted<StyleFillData>()
48     , opacity(other.opacity)
49     , paintType(other.paintType)
50     , paintColor(other.paintColor)
51     , paintUri(other.paintUri)
52 {
53 }
54 
operator ==(const StyleFillData & other) const55 bool StyleFillData::operator==(const StyleFillData& other) const
56 {
57     return opacity == other.opacity
58         && paintType == other.paintType
59         && paintColor == other.paintColor
60         && paintUri == other.paintUri;
61 }
62 
StyleStrokeData()63 StyleStrokeData::StyleStrokeData()
64     : opacity(SVGRenderStyle::initialStrokeOpacity())
65     , miterLimit(SVGRenderStyle::initialStrokeMiterLimit())
66     , width(SVGRenderStyle::initialStrokeWidth())
67     , dashOffset(SVGRenderStyle::initialStrokeDashOffset())
68     , dashArray(SVGRenderStyle::initialStrokeDashArray())
69     , paintType(SVGRenderStyle::initialStrokePaintType())
70     , paintColor(SVGRenderStyle::initialStrokePaintColor())
71     , paintUri(SVGRenderStyle::initialStrokePaintUri())
72 {
73 }
74 
StyleStrokeData(const StyleStrokeData & other)75 StyleStrokeData::StyleStrokeData(const StyleStrokeData& other)
76     : RefCounted<StyleStrokeData>()
77     , opacity(other.opacity)
78     , miterLimit(other.miterLimit)
79     , width(other.width)
80     , dashOffset(other.dashOffset)
81     , dashArray(other.dashArray)
82     , paintType(other.paintType)
83     , paintColor(other.paintColor)
84     , paintUri(other.paintUri)
85 {
86 }
87 
operator ==(const StyleStrokeData & other) const88 bool StyleStrokeData::operator==(const StyleStrokeData& other) const
89 {
90     return width == other.width
91         && opacity == other.opacity
92         && miterLimit == other.miterLimit
93         && dashOffset == other.dashOffset
94         && dashArray == other.dashArray
95         && paintType == other.paintType
96         && paintColor == other.paintColor
97         && paintUri == other.paintUri;
98 }
99 
StyleStopData()100 StyleStopData::StyleStopData()
101     : opacity(SVGRenderStyle::initialStopOpacity())
102     , color(SVGRenderStyle::initialStopColor())
103 {
104 }
105 
StyleStopData(const StyleStopData & other)106 StyleStopData::StyleStopData(const StyleStopData& other)
107     : RefCounted<StyleStopData>()
108     , opacity(other.opacity)
109     , color(other.color)
110 {
111 }
112 
operator ==(const StyleStopData & other) const113 bool StyleStopData::operator==(const StyleStopData& other) const
114 {
115     return color == other.color
116         && opacity == other.opacity;
117 }
118 
StyleTextData()119 StyleTextData::StyleTextData()
120     : kerning(SVGRenderStyle::initialKerning())
121 {
122 }
123 
StyleTextData(const StyleTextData & other)124 StyleTextData::StyleTextData(const StyleTextData& other)
125     : RefCounted<StyleTextData>()
126     , kerning(other.kerning)
127 {
128 }
129 
operator ==(const StyleTextData & other) const130 bool StyleTextData::operator==(const StyleTextData& other) const
131 {
132     return kerning == other.kerning;
133 }
134 
StyleMiscData()135 StyleMiscData::StyleMiscData()
136     : floodColor(SVGRenderStyle::initialFloodColor())
137     , floodOpacity(SVGRenderStyle::initialFloodOpacity())
138     , lightingColor(SVGRenderStyle::initialLightingColor())
139     , baselineShiftValue(SVGRenderStyle::initialBaselineShiftValue())
140 {
141 }
142 
StyleMiscData(const StyleMiscData & other)143 StyleMiscData::StyleMiscData(const StyleMiscData& other)
144     : RefCounted<StyleMiscData>()
145     , floodColor(other.floodColor)
146     , floodOpacity(other.floodOpacity)
147     , lightingColor(other.lightingColor)
148     , baselineShiftValue(other.baselineShiftValue)
149 {
150 }
151 
operator ==(const StyleMiscData & other) const152 bool StyleMiscData::operator==(const StyleMiscData& other) const
153 {
154     return floodOpacity == other.floodOpacity
155         && floodColor == other.floodColor
156         && lightingColor == other.lightingColor
157         && baselineShiftValue == other.baselineShiftValue;
158 }
159 
StyleShadowSVGData()160 StyleShadowSVGData::StyleShadowSVGData()
161 {
162 }
163 
StyleShadowSVGData(const StyleShadowSVGData & other)164 StyleShadowSVGData::StyleShadowSVGData(const StyleShadowSVGData& other)
165     : RefCounted<StyleShadowSVGData>()
166     , shadow(other.shadow ? adoptPtr(new ShadowData(*other.shadow)) : nullptr)
167 {
168 }
169 
operator ==(const StyleShadowSVGData & other) const170 bool StyleShadowSVGData::operator==(const StyleShadowSVGData& other) const
171 {
172     if ((!shadow && other.shadow) || (shadow && !other.shadow))
173         return false;
174     if (shadow && other.shadow && (*shadow != *other.shadow))
175         return false;
176     return true;
177 }
178 
StyleResourceData()179 StyleResourceData::StyleResourceData()
180     : clipper(SVGRenderStyle::initialClipperResource())
181     , filter(SVGRenderStyle::initialFilterResource())
182     , masker(SVGRenderStyle::initialMaskerResource())
183 {
184 }
185 
StyleResourceData(const StyleResourceData & other)186 StyleResourceData::StyleResourceData(const StyleResourceData& other)
187     : RefCounted<StyleResourceData>()
188     , clipper(other.clipper)
189     , filter(other.filter)
190     , masker(other.masker)
191 {
192 }
193 
operator ==(const StyleResourceData & other) const194 bool StyleResourceData::operator==(const StyleResourceData& other) const
195 {
196     return clipper == other.clipper
197         && filter == other.filter
198         && masker == other.masker;
199 }
200 
StyleInheritedResourceData()201 StyleInheritedResourceData::StyleInheritedResourceData()
202     : markerStart(SVGRenderStyle::initialMarkerStartResource())
203     , markerMid(SVGRenderStyle::initialMarkerMidResource())
204     , markerEnd(SVGRenderStyle::initialMarkerEndResource())
205 {
206 }
207 
StyleInheritedResourceData(const StyleInheritedResourceData & other)208 StyleInheritedResourceData::StyleInheritedResourceData(const StyleInheritedResourceData& other)
209     : RefCounted<StyleInheritedResourceData>()
210     , markerStart(other.markerStart)
211     , markerMid(other.markerMid)
212     , markerEnd(other.markerEnd)
213 {
214 }
215 
operator ==(const StyleInheritedResourceData & other) const216 bool StyleInheritedResourceData::operator==(const StyleInheritedResourceData& other) const
217 {
218     return markerStart == other.markerStart
219         && markerMid == other.markerMid
220         && markerEnd == other.markerEnd;
221 }
222 
223 }
224 
225 #endif // ENABLE(SVG)
226