OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 5 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 renderer->invalidateCacheAndMarkForLayout(); | 110 renderer->invalidateCacheAndMarkForLayout(); |
111 } | 111 } |
112 | 112 |
113 RenderObject* SVGLinearGradientElement::createRenderer(RenderStyle*) | 113 RenderObject* SVGLinearGradientElement::createRenderer(RenderStyle*) |
114 { | 114 { |
115 return new RenderSVGResourceLinearGradient(this); | 115 return new RenderSVGResourceLinearGradient(this); |
116 } | 116 } |
117 | 117 |
118 static void setGradientAttributes(SVGGradientElement* element, LinearGradientAtt
ributes& attributes, bool isLinear = true) | 118 static void setGradientAttributes(SVGGradientElement* element, LinearGradientAtt
ributes& attributes, bool isLinear = true) |
119 { | 119 { |
120 if (!attributes.hasSpreadMethod() && element->hasAttribute(SVGNames::spreadM
ethodAttr)) | 120 if (!attributes.hasSpreadMethod() && element->spreadMethodSpecified()) |
121 attributes.setSpreadMethod(element->spreadMethodCurrentValue()); | 121 attributes.setSpreadMethod(element->spreadMethodCurrentValue()); |
122 | 122 |
123 if (!attributes.hasGradientUnits() && element->hasAttribute(SVGNames::gradie
ntUnitsAttr)) | 123 if (!attributes.hasGradientUnits() && element->gradientUnitsSpecified()) |
124 attributes.setGradientUnits(element->gradientUnitsCurrentValue()); | 124 attributes.setGradientUnits(element->gradientUnitsCurrentValue()); |
125 | 125 |
126 if (!attributes.hasGradientTransform() && element->hasAttribute(SVGNames::gr
adientTransformAttr)) { | 126 if (!attributes.hasGradientTransform() && element->gradientTransformSpecifie
d()) { |
127 AffineTransform transform; | 127 AffineTransform transform; |
128 element->gradientTransformCurrentValue().concatenate(transform); | 128 element->gradientTransformCurrentValue().concatenate(transform); |
129 attributes.setGradientTransform(transform); | 129 attributes.setGradientTransform(transform); |
130 } | 130 } |
131 | 131 |
132 if (!attributes.hasStops()) { | 132 if (!attributes.hasStops()) { |
133 const Vector<Gradient::ColorStop>& stops(element->buildStops()); | 133 const Vector<Gradient::ColorStop>& stops(element->buildStops()); |
134 if (!stops.isEmpty()) | 134 if (!stops.isEmpty()) |
135 attributes.setStops(stops); | 135 attributes.setStops(stops); |
136 } | 136 } |
137 | 137 |
138 if (isLinear) { | 138 if (isLinear) { |
139 SVGLinearGradientElement* linear = toSVGLinearGradientElement(element); | 139 SVGLinearGradientElement* linear = toSVGLinearGradientElement(element); |
140 | 140 |
141 if (!attributes.hasX1() && element->hasAttribute(SVGNames::x1Attr)) | 141 if (!attributes.hasX1() && linear->x1()->isSpecified()) |
142 attributes.setX1(linear->x1()->currentValue()); | 142 attributes.setX1(linear->x1()->currentValue()); |
143 | 143 |
144 if (!attributes.hasY1() && element->hasAttribute(SVGNames::y1Attr)) | 144 if (!attributes.hasY1() && linear->y1()->isSpecified()) |
145 attributes.setY1(linear->y1()->currentValue()); | 145 attributes.setY1(linear->y1()->currentValue()); |
146 | 146 |
147 if (!attributes.hasX2() && element->hasAttribute(SVGNames::x2Attr)) | 147 if (!attributes.hasX2() && linear->x2()->isSpecified()) |
148 attributes.setX2(linear->x2()->currentValue()); | 148 attributes.setX2(linear->x2()->currentValue()); |
149 | 149 |
150 if (!attributes.hasY2() && element->hasAttribute(SVGNames::y2Attr)) | 150 if (!attributes.hasY2() && linear->y2()->isSpecified()) |
151 attributes.setY2(linear->y2()->currentValue()); | 151 attributes.setY2(linear->y2()->currentValue()); |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 bool SVGLinearGradientElement::collectGradientAttributes(LinearGradientAttribute
s& attributes) | 155 bool SVGLinearGradientElement::collectGradientAttributes(LinearGradientAttribute
s& attributes) |
156 { | 156 { |
157 if (!renderer()) | 157 if (!renderer()) |
158 return false; | 158 return false; |
159 | 159 |
160 HashSet<SVGGradientElement*> processedGradients; | 160 HashSet<SVGGradientElement*> processedGradients; |
(...skipping 28 matching lines...) Expand all Loading... |
189 | 189 |
190 bool SVGLinearGradientElement::selfHasRelativeLengths() const | 190 bool SVGLinearGradientElement::selfHasRelativeLengths() const |
191 { | 191 { |
192 return m_x1->currentValue()->isRelative() | 192 return m_x1->currentValue()->isRelative() |
193 || m_y1->currentValue()->isRelative() | 193 || m_y1->currentValue()->isRelative() |
194 || m_x2->currentValue()->isRelative() | 194 || m_x2->currentValue()->isRelative() |
195 || m_y2->currentValue()->isRelative(); | 195 || m_y2->currentValue()->isRelative(); |
196 } | 196 } |
197 | 197 |
198 } | 198 } |
OLD | NEW |