1 /* 2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann (at) kde.org> 3 2004, 2005, 2007 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) 1999 Antti Koivisto (koivisto (at) kde.org) 8 Copyright (C) 1999-2003 Lars Knoll (knoll (at) kde.org) 9 Copyright (C) 2002-2003 Dirk Mueller (mueller (at) 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 #include "core/rendering/style/SVGRenderStyleDefs.h" 31 32 #include "core/rendering/style/SVGRenderStyle.h" 33 34 namespace blink { 35 36 StyleFillData::StyleFillData() 37 : opacity(SVGRenderStyle::initialFillOpacity()) 38 , paintType(SVGRenderStyle::initialFillPaintType()) 39 , paintColor(SVGRenderStyle::initialFillPaintColor()) 40 , paintUri(SVGRenderStyle::initialFillPaintUri()) 41 , visitedLinkPaintType(SVGRenderStyle::initialStrokePaintType()) 42 , visitedLinkPaintColor(SVGRenderStyle::initialFillPaintColor()) 43 , visitedLinkPaintUri(SVGRenderStyle::initialFillPaintUri()) 44 { 45 } 46 47 StyleFillData::StyleFillData(const StyleFillData& other) 48 : RefCounted<StyleFillData>() 49 , opacity(other.opacity) 50 , paintType(other.paintType) 51 , paintColor(other.paintColor) 52 , paintUri(other.paintUri) 53 , visitedLinkPaintType(other.visitedLinkPaintType) 54 , visitedLinkPaintColor(other.visitedLinkPaintColor) 55 , visitedLinkPaintUri(other.visitedLinkPaintUri) 56 { 57 } 58 59 bool StyleFillData::operator==(const StyleFillData& other) const 60 { 61 return opacity == other.opacity 62 && paintType == other.paintType 63 && paintColor == other.paintColor 64 && paintUri == other.paintUri 65 && visitedLinkPaintType == other.visitedLinkPaintType 66 && visitedLinkPaintColor == other.visitedLinkPaintColor 67 && visitedLinkPaintUri == other.visitedLinkPaintUri; 68 } 69 70 StyleStrokeData::StyleStrokeData() 71 : opacity(SVGRenderStyle::initialStrokeOpacity()) 72 , miterLimit(SVGRenderStyle::initialStrokeMiterLimit()) 73 , width(SVGRenderStyle::initialStrokeWidth()) 74 , dashOffset(SVGRenderStyle::initialStrokeDashOffset()) 75 , dashArray(SVGRenderStyle::initialStrokeDashArray()) 76 , paintType(SVGRenderStyle::initialStrokePaintType()) 77 , paintColor(SVGRenderStyle::initialStrokePaintColor()) 78 , paintUri(SVGRenderStyle::initialStrokePaintUri()) 79 , visitedLinkPaintType(SVGRenderStyle::initialStrokePaintType()) 80 , visitedLinkPaintColor(SVGRenderStyle::initialStrokePaintColor()) 81 , visitedLinkPaintUri(SVGRenderStyle::initialStrokePaintUri()) 82 { 83 } 84 85 StyleStrokeData::StyleStrokeData(const StyleStrokeData& other) 86 : RefCounted<StyleStrokeData>() 87 , opacity(other.opacity) 88 , miterLimit(other.miterLimit) 89 , width(other.width->clone()) 90 , dashOffset(other.dashOffset->clone()) 91 , dashArray(other.dashArray->clone()) 92 , paintType(other.paintType) 93 , paintColor(other.paintColor) 94 , paintUri(other.paintUri) 95 , visitedLinkPaintType(other.visitedLinkPaintType) 96 , visitedLinkPaintColor(other.visitedLinkPaintColor) 97 , visitedLinkPaintUri(other.visitedLinkPaintUri) 98 { 99 } 100 101 bool StyleStrokeData::operator==(const StyleStrokeData& other) const 102 { 103 return *width == *other.width 104 && opacity == other.opacity 105 && miterLimit == other.miterLimit 106 && *dashOffset == *other.dashOffset 107 && *dashArray == *other.dashArray 108 && paintType == other.paintType 109 && paintColor == other.paintColor 110 && paintUri == other.paintUri 111 && visitedLinkPaintType == other.visitedLinkPaintType 112 && visitedLinkPaintColor == other.visitedLinkPaintColor 113 && visitedLinkPaintUri == other.visitedLinkPaintUri; 114 } 115 116 StyleStopData::StyleStopData() 117 : opacity(SVGRenderStyle::initialStopOpacity()) 118 , color(SVGRenderStyle::initialStopColor()) 119 { 120 } 121 122 StyleStopData::StyleStopData(const StyleStopData& other) 123 : RefCounted<StyleStopData>() 124 , opacity(other.opacity) 125 , color(other.color) 126 { 127 } 128 129 bool StyleStopData::operator==(const StyleStopData& other) const 130 { 131 return color == other.color 132 && opacity == other.opacity; 133 } 134 135 StyleMiscData::StyleMiscData() 136 : floodColor(SVGRenderStyle::initialFloodColor()) 137 , floodOpacity(SVGRenderStyle::initialFloodOpacity()) 138 , lightingColor(SVGRenderStyle::initialLightingColor()) 139 , baselineShiftValue(SVGRenderStyle::initialBaselineShiftValue()) 140 { 141 } 142 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->clone()) 149 { 150 } 151 152 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 160 StyleResourceData::StyleResourceData() 161 : clipper(SVGRenderStyle::initialClipperResource()) 162 , filter(SVGRenderStyle::initialFilterResource()) 163 , masker(SVGRenderStyle::initialMaskerResource()) 164 { 165 } 166 167 StyleResourceData::StyleResourceData(const StyleResourceData& other) 168 : RefCounted<StyleResourceData>() 169 , clipper(other.clipper) 170 , filter(other.filter) 171 , masker(other.masker) 172 { 173 } 174 175 bool StyleResourceData::operator==(const StyleResourceData& other) const 176 { 177 return clipper == other.clipper 178 && filter == other.filter 179 && masker == other.masker; 180 } 181 182 StyleInheritedResourceData::StyleInheritedResourceData() 183 : markerStart(SVGRenderStyle::initialMarkerStartResource()) 184 , markerMid(SVGRenderStyle::initialMarkerMidResource()) 185 , markerEnd(SVGRenderStyle::initialMarkerEndResource()) 186 { 187 } 188 189 StyleInheritedResourceData::StyleInheritedResourceData(const StyleInheritedResourceData& other) 190 : RefCounted<StyleInheritedResourceData>() 191 , markerStart(other.markerStart) 192 , markerMid(other.markerMid) 193 , markerEnd(other.markerEnd) 194 { 195 } 196 197 bool StyleInheritedResourceData::operator==(const StyleInheritedResourceData& other) const 198 { 199 return markerStart == other.markerStart 200 && markerMid == other.markerMid 201 && markerEnd == other.markerEnd; 202 } 203 204 } 205