OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007, 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) Research In Motion Limited 2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 object->setNeedsLayout(); | 161 object->setNeedsLayout(); |
162 } | 162 } |
163 | 163 |
164 RenderObject* SVGPatternElement::createRenderer(RenderStyle*) | 164 RenderObject* SVGPatternElement::createRenderer(RenderStyle*) |
165 { | 165 { |
166 return new RenderSVGResourcePattern(this); | 166 return new RenderSVGResourcePattern(this); |
167 } | 167 } |
168 | 168 |
169 static void setPatternAttributes(const SVGPatternElement* element, PatternAttrib
utes& attributes) | 169 static void setPatternAttributes(const SVGPatternElement* element, PatternAttrib
utes& attributes) |
170 { | 170 { |
171 if (!attributes.hasX() && element->hasAttribute(SVGNames::xAttr)) | 171 if (!attributes.hasX() && element->x()->isSpecified()) |
172 attributes.setX(element->x()->currentValue()); | 172 attributes.setX(element->x()->currentValue()); |
173 | 173 |
174 if (!attributes.hasY() && element->hasAttribute(SVGNames::yAttr)) | 174 if (!attributes.hasY() && element->y()->isSpecified()) |
175 attributes.setY(element->y()->currentValue()); | 175 attributes.setY(element->y()->currentValue()); |
176 | 176 |
177 if (!attributes.hasWidth() && element->hasAttribute(SVGNames::widthAttr)) | 177 if (!attributes.hasWidth() && element->width()->isSpecified()) |
178 attributes.setWidth(element->width()->currentValue()); | 178 attributes.setWidth(element->width()->currentValue()); |
179 | 179 |
180 if (!attributes.hasHeight() && element->hasAttribute(SVGNames::heightAttr)) | 180 if (!attributes.hasHeight() && element->height()->isSpecified()) |
181 attributes.setHeight(element->height()->currentValue()); | 181 attributes.setHeight(element->height()->currentValue()); |
182 | 182 |
183 if (!attributes.hasViewBox() && element->hasAttribute(SVGNames::viewBoxAttr)
&& element->viewBox()->currentValue()->isValid()) | 183 if (!attributes.hasViewBox() && element->viewBox()->isSpecified() && element
->viewBox()->currentValue()->isValid()) |
184 attributes.setViewBox(element->viewBox()->currentValue()->value()); | 184 attributes.setViewBox(element->viewBox()->currentValue()->value()); |
185 | 185 |
186 if (!attributes.hasPreserveAspectRatio() && element->hasAttribute(SVGNames::
preserveAspectRatioAttr)) | 186 if (!attributes.hasPreserveAspectRatio() && element->preserveAspectRatioSpec
ified()) |
187 attributes.setPreserveAspectRatio(element->preserveAspectRatioCurrentVal
ue()); | 187 attributes.setPreserveAspectRatio(element->preserveAspectRatioCurrentVal
ue()); |
188 | 188 |
189 if (!attributes.hasPatternUnits() && element->hasAttribute(SVGNames::pattern
UnitsAttr)) | 189 if (!attributes.hasPatternUnits() && element->patternUnitsSpecified()) |
190 attributes.setPatternUnits(element->patternUnitsCurrentValue()); | 190 attributes.setPatternUnits(element->patternUnitsCurrentValue()); |
191 | 191 |
192 if (!attributes.hasPatternContentUnits() && element->hasAttribute(SVGNames::
patternContentUnitsAttr)) | 192 if (!attributes.hasPatternContentUnits() && element->patternContentUnitsSpec
ified()) |
193 attributes.setPatternContentUnits(element->patternContentUnitsCurrentVal
ue()); | 193 attributes.setPatternContentUnits(element->patternContentUnitsCurrentVal
ue()); |
194 | 194 |
195 if (!attributes.hasPatternTransform() && element->hasAttribute(SVGNames::pat
ternTransformAttr)) { | 195 if (!attributes.hasPatternTransform() && element->patternTransformSpecified(
)) { |
196 AffineTransform transform; | 196 AffineTransform transform; |
197 element->patternTransformCurrentValue().concatenate(transform); | 197 element->patternTransformCurrentValue().concatenate(transform); |
198 attributes.setPatternTransform(transform); | 198 attributes.setPatternTransform(transform); |
199 } | 199 } |
200 | 200 |
201 if (!attributes.hasPatternContentElement() && element->childElementCount()) | 201 if (!attributes.hasPatternContentElement() && element->childElementCount()) |
202 attributes.setPatternContentElement(element); | 202 attributes.setPatternContentElement(element); |
203 } | 203 } |
204 | 204 |
205 void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes)
const | 205 void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes)
const |
(...skipping 30 matching lines...) Expand all Loading... |
236 | 236 |
237 bool SVGPatternElement::selfHasRelativeLengths() const | 237 bool SVGPatternElement::selfHasRelativeLengths() const |
238 { | 238 { |
239 return m_x->currentValue()->isRelative() | 239 return m_x->currentValue()->isRelative() |
240 || m_y->currentValue()->isRelative() | 240 || m_y->currentValue()->isRelative() |
241 || m_width->currentValue()->isRelative() | 241 || m_width->currentValue()->isRelative() |
242 || m_height->currentValue()->isRelative(); | 242 || m_height->currentValue()->isRelative(); |
243 } | 243 } |
244 | 244 |
245 } | 245 } |
OLD | NEW |