File indexing completed on 2024-04-28 15:24:19
0001 /* 0002 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 0003 2004, 2005, 2007 Rob Buis <buis@kde.org> 0004 0005 Based on khtml code by: 0006 Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) 0007 Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) 0008 Copyright (C) 2002-2003 Dirk Mueller (mueller@kde.org) 0009 Copyright (C) 2002 Apple Computer, Inc. 0010 0011 This file is part of the KDE project 0012 0013 This library is free software; you can redistribute it and/or 0014 modify it under the terms of the GNU Library General Public 0015 License as published by the Free Software Foundation; either 0016 version 2 of the License, or (at your option) any later version. 0017 0018 This library is distributed in the hope that it will be useful, 0019 but WITHOUT ANY WARRANTY; without even the implied warranty of 0020 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0021 Library General Public License for more details. 0022 0023 You should have received a copy of the GNU Library General Public License 0024 along with this library; see the file COPYING.LIB. If not, write to 0025 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0026 Boston, MA 02110-1301, USA. 0027 */ 0028 0029 #include "wtf/Platform.h" 0030 #if ENABLE(SVG) 0031 #include "SVGRenderStyleDefs.h" 0032 0033 #include "RenderStyle.h" 0034 #include "SVGRenderStyle.h" 0035 0036 using namespace khtml; 0037 0038 StyleFillData::StyleFillData() 0039 { 0040 paint = SVGRenderStyle::initialFillPaint(); 0041 opacity = SVGRenderStyle::initialFillOpacity(); 0042 } 0043 0044 StyleFillData::StyleFillData(const StyleFillData &other) 0045 : RefCounted<StyleFillData>() 0046 { 0047 paint = other.paint; 0048 opacity = other.opacity; 0049 } 0050 0051 bool StyleFillData::operator==(const StyleFillData &other) const 0052 { 0053 if (opacity != other.opacity) { 0054 return false; 0055 } 0056 0057 if (!paint || !other.paint) { 0058 return paint == other.paint; 0059 } 0060 0061 if (paint->paintType() != other.paint->paintType()) { 0062 return false; 0063 } 0064 0065 if (paint->paintType() == SVGPaintImpl::SVG_PAINTTYPE_URI) { 0066 return paint->uri() == other.paint->uri(); 0067 } 0068 0069 if (paint->paintType() == SVGPaintImpl::SVG_PAINTTYPE_RGBCOLOR) { 0070 return paint->color() == other.paint->color(); 0071 } 0072 0073 return paint == other.paint; 0074 } 0075 0076 StyleStrokeData::StyleStrokeData() 0077 { 0078 width = SVGRenderStyle::initialStrokeWidth(); 0079 paint = SVGRenderStyle::initialStrokePaint(); 0080 opacity = SVGRenderStyle::initialStrokeOpacity(); 0081 miterLimit = SVGRenderStyle::initialStrokeMiterLimit(); 0082 dashOffset = SVGRenderStyle::initialStrokeDashOffset(); 0083 dashArray = SVGRenderStyle::initialStrokeDashArray(); 0084 } 0085 0086 StyleStrokeData::StyleStrokeData(const StyleStrokeData &other) 0087 : RefCounted<StyleStrokeData>() 0088 { 0089 width = other.width; 0090 paint = other.paint; 0091 opacity = other.opacity; 0092 miterLimit = other.miterLimit; 0093 dashOffset = other.dashOffset; 0094 dashArray = other.dashArray; 0095 } 0096 0097 bool StyleStrokeData::operator==(const StyleStrokeData &other) const 0098 { 0099 return (paint == other.paint) && 0100 (width == other.width) && 0101 (opacity == other.opacity) && 0102 (miterLimit == other.miterLimit) && 0103 (dashOffset == other.dashOffset) && 0104 (dashArray == other.dashArray); 0105 } 0106 0107 StyleStopData::StyleStopData() 0108 { 0109 color = SVGRenderStyle::initialStopColor(); 0110 opacity = SVGRenderStyle::initialStopOpacity(); 0111 } 0112 0113 StyleStopData::StyleStopData(const StyleStopData &other) 0114 : RefCounted<StyleStopData>() 0115 { 0116 color = other.color; 0117 opacity = other.opacity; 0118 } 0119 0120 bool StyleStopData::operator==(const StyleStopData &other) const 0121 { 0122 return (color == other.color) && 0123 (opacity == other.opacity); 0124 } 0125 0126 StyleTextData::StyleTextData() 0127 { 0128 kerning = SVGRenderStyle::initialKerning(); 0129 } 0130 0131 StyleTextData::StyleTextData(const StyleTextData &other) 0132 : RefCounted<StyleTextData>() 0133 { 0134 kerning = other.kerning; 0135 } 0136 0137 bool StyleTextData::operator==(const StyleTextData &other) const 0138 { 0139 return kerning == other.kerning; 0140 } 0141 0142 StyleClipData::StyleClipData() 0143 { 0144 clipPath = SVGRenderStyle::initialClipPath(); 0145 } 0146 0147 StyleClipData::StyleClipData(const StyleClipData &other) 0148 : RefCounted<StyleClipData>() 0149 { 0150 clipPath = other.clipPath; 0151 } 0152 0153 bool StyleClipData::operator==(const StyleClipData &other) const 0154 { 0155 return (clipPath == other.clipPath); 0156 } 0157 0158 StyleMaskData::StyleMaskData() 0159 { 0160 maskElement = SVGRenderStyle::initialMaskElement(); 0161 } 0162 0163 StyleMaskData::StyleMaskData(const StyleMaskData &other) 0164 : RefCounted<StyleMaskData>() 0165 { 0166 maskElement = other.maskElement; 0167 } 0168 0169 bool StyleMaskData::operator==(const StyleMaskData &other) const 0170 { 0171 return (maskElement == other.maskElement); 0172 } 0173 0174 StyleMarkerData::StyleMarkerData() 0175 { 0176 startMarker = SVGRenderStyle::initialStartMarker(); 0177 midMarker = SVGRenderStyle::initialMidMarker(); 0178 endMarker = SVGRenderStyle::initialEndMarker(); 0179 } 0180 0181 StyleMarkerData::StyleMarkerData(const StyleMarkerData &other) 0182 : RefCounted<StyleMarkerData>() 0183 { 0184 startMarker = other.startMarker; 0185 midMarker = other.midMarker; 0186 endMarker = other.endMarker; 0187 } 0188 0189 bool StyleMarkerData::operator==(const StyleMarkerData &other) const 0190 { 0191 return (startMarker == other.startMarker && midMarker == other.midMarker && endMarker == other.endMarker); 0192 } 0193 0194 StyleMiscData::StyleMiscData() 0195 { 0196 floodColor = SVGRenderStyle::initialFloodColor(); 0197 floodOpacity = SVGRenderStyle::initialFloodOpacity(); 0198 lightingColor = SVGRenderStyle::initialLightingColor(); 0199 baselineShiftValue = SVGRenderStyle::initialBaselineShiftValue(); 0200 } 0201 0202 StyleMiscData::StyleMiscData(const StyleMiscData &other) 0203 : RefCounted<StyleMiscData>() 0204 { 0205 filter = other.filter; 0206 floodColor = other.floodColor; 0207 floodOpacity = other.floodOpacity; 0208 lightingColor = other.lightingColor; 0209 baselineShiftValue = other.baselineShiftValue; 0210 } 0211 0212 bool StyleMiscData::operator==(const StyleMiscData &other) const 0213 { 0214 return filter == other.filter 0215 && floodOpacity == other.floodOpacity 0216 && floodColor == other.floodColor 0217 && lightingColor == other.lightingColor 0218 && baselineShiftValue == other.baselineShiftValue; 0219 } 0220 0221 #endif // ENABLE(SVG) 0222