KHtml

SVGRenderStyleDefs.cpp
1 /*
2  Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <[email protected]>
3  2004, 2005, 2007 Rob Buis <[email protected]>
4 
5  Based on khtml code by:
6  Copyright (C) 1999 Antti Koivisto ([email protected])
7  Copyright (C) 1999-2003 Lars Knoll ([email protected])
8  Copyright (C) 2002-2003 Dirk Mueller ([email protected])
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 "wtf/Platform.h"
30 #if ENABLE(SVG)
31 #include "SVGRenderStyleDefs.h"
32 
33 #include "RenderStyle.h"
34 #include "SVGRenderStyle.h"
35 
36 using namespace khtml;
37 
38 StyleFillData::StyleFillData()
39 {
40  paint = SVGRenderStyle::initialFillPaint();
41  opacity = SVGRenderStyle::initialFillOpacity();
42 }
43 
44 StyleFillData::StyleFillData(const StyleFillData &other)
45  : RefCounted<StyleFillData>()
46 {
47  paint = other.paint;
48  opacity = other.opacity;
49 }
50 
51 bool StyleFillData::operator==(const StyleFillData &other) const
52 {
53  if (opacity != other.opacity) {
54  return false;
55  }
56 
57  if (!paint || !other.paint) {
58  return paint == other.paint;
59  }
60 
61  if (paint->paintType() != other.paint->paintType()) {
62  return false;
63  }
64 
65  if (paint->paintType() == SVGPaintImpl::SVG_PAINTTYPE_URI) {
66  return paint->uri() == other.paint->uri();
67  }
68 
69  if (paint->paintType() == SVGPaintImpl::SVG_PAINTTYPE_RGBCOLOR) {
70  return paint->color() == other.paint->color();
71  }
72 
73  return paint == other.paint;
74 }
75 
76 StyleStrokeData::StyleStrokeData()
77 {
78  width = SVGRenderStyle::initialStrokeWidth();
79  paint = SVGRenderStyle::initialStrokePaint();
80  opacity = SVGRenderStyle::initialStrokeOpacity();
81  miterLimit = SVGRenderStyle::initialStrokeMiterLimit();
82  dashOffset = SVGRenderStyle::initialStrokeDashOffset();
83  dashArray = SVGRenderStyle::initialStrokeDashArray();
84 }
85 
86 StyleStrokeData::StyleStrokeData(const StyleStrokeData &other)
87  : RefCounted<StyleStrokeData>()
88 {
89  width = other.width;
90  paint = other.paint;
91  opacity = other.opacity;
92  miterLimit = other.miterLimit;
93  dashOffset = other.dashOffset;
94  dashArray = other.dashArray;
95 }
96 
97 bool StyleStrokeData::operator==(const StyleStrokeData &other) const
98 {
99  return (paint == other.paint) &&
100  (width == other.width) &&
101  (opacity == other.opacity) &&
102  (miterLimit == other.miterLimit) &&
103  (dashOffset == other.dashOffset) &&
104  (dashArray == other.dashArray);
105 }
106 
107 StyleStopData::StyleStopData()
108 {
109  color = SVGRenderStyle::initialStopColor();
110  opacity = SVGRenderStyle::initialStopOpacity();
111 }
112 
113 StyleStopData::StyleStopData(const StyleStopData &other)
114  : RefCounted<StyleStopData>()
115 {
116  color = other.color;
117  opacity = other.opacity;
118 }
119 
120 bool StyleStopData::operator==(const StyleStopData &other) const
121 {
122  return (color == other.color) &&
123  (opacity == other.opacity);
124 }
125 
126 StyleTextData::StyleTextData()
127 {
128  kerning = SVGRenderStyle::initialKerning();
129 }
130 
131 StyleTextData::StyleTextData(const StyleTextData &other)
132  : RefCounted<StyleTextData>()
133 {
134  kerning = other.kerning;
135 }
136 
137 bool StyleTextData::operator==(const StyleTextData &other) const
138 {
139  return kerning == other.kerning;
140 }
141 
142 StyleClipData::StyleClipData()
143 {
144  clipPath = SVGRenderStyle::initialClipPath();
145 }
146 
147 StyleClipData::StyleClipData(const StyleClipData &other)
148  : RefCounted<StyleClipData>()
149 {
150  clipPath = other.clipPath;
151 }
152 
153 bool StyleClipData::operator==(const StyleClipData &other) const
154 {
155  return (clipPath == other.clipPath);
156 }
157 
158 StyleMaskData::StyleMaskData()
159 {
160  maskElement = SVGRenderStyle::initialMaskElement();
161 }
162 
163 StyleMaskData::StyleMaskData(const StyleMaskData &other)
164  : RefCounted<StyleMaskData>()
165 {
166  maskElement = other.maskElement;
167 }
168 
169 bool StyleMaskData::operator==(const StyleMaskData &other) const
170 {
171  return (maskElement == other.maskElement);
172 }
173 
174 StyleMarkerData::StyleMarkerData()
175 {
176  startMarker = SVGRenderStyle::initialStartMarker();
177  midMarker = SVGRenderStyle::initialMidMarker();
178  endMarker = SVGRenderStyle::initialEndMarker();
179 }
180 
181 StyleMarkerData::StyleMarkerData(const StyleMarkerData &other)
182  : RefCounted<StyleMarkerData>()
183 {
184  startMarker = other.startMarker;
185  midMarker = other.midMarker;
186  endMarker = other.endMarker;
187 }
188 
189 bool StyleMarkerData::operator==(const StyleMarkerData &other) const
190 {
191  return (startMarker == other.startMarker && midMarker == other.midMarker && endMarker == other.endMarker);
192 }
193 
194 StyleMiscData::StyleMiscData()
195 {
196  floodColor = SVGRenderStyle::initialFloodColor();
197  floodOpacity = SVGRenderStyle::initialFloodOpacity();
198  lightingColor = SVGRenderStyle::initialLightingColor();
199  baselineShiftValue = SVGRenderStyle::initialBaselineShiftValue();
200 }
201 
202 StyleMiscData::StyleMiscData(const StyleMiscData &other)
203  : RefCounted<StyleMiscData>()
204 {
205  filter = other.filter;
206  floodColor = other.floodColor;
207  floodOpacity = other.floodOpacity;
208  lightingColor = other.lightingColor;
209  baselineShiftValue = other.baselineShiftValue;
210 }
211 
212 bool StyleMiscData::operator==(const StyleMiscData &other) const
213 {
214  return filter == other.filter
215  && floodOpacity == other.floodOpacity
216  && floodColor == other.floodColor
217  && lightingColor == other.lightingColor
218  && baselineShiftValue == other.baselineShiftValue;
219 }
220 
221 #endif // ENABLE(SVG)
222 
This file is part of the HTML rendering engine for KDE.
QFuture< void > filter(Sequence &sequence, KeepFunctor filterFunction)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 22:48:02 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.