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 15 matching lines...) Expand all Loading... |
26 #include "XLinkNames.h" | 26 #include "XLinkNames.h" |
27 #include "core/dom/ElementTraversal.h" | 27 #include "core/dom/ElementTraversal.h" |
28 #include "core/rendering/svg/RenderSVGResourcePattern.h" | 28 #include "core/rendering/svg/RenderSVGResourcePattern.h" |
29 #include "core/svg/PatternAttributes.h" | 29 #include "core/svg/PatternAttributes.h" |
30 #include "core/svg/SVGElementInstance.h" | 30 #include "core/svg/SVGElementInstance.h" |
31 #include "platform/transforms/AffineTransform.h" | 31 #include "platform/transforms/AffineTransform.h" |
32 | 32 |
33 namespace WebCore { | 33 namespace WebCore { |
34 | 34 |
35 // Animated property definitions | 35 // Animated property definitions |
36 DEFINE_ANIMATED_TRANSFORM_LIST(SVGPatternElement, SVGNames::patternTransformAttr
, PatternTransform, patternTransform) | |
37 | |
38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPatternElement) | 36 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPatternElement) |
39 REGISTER_LOCAL_ANIMATED_PROPERTY(patternTransform) | |
40 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) | 37 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) |
41 END_REGISTER_ANIMATED_PROPERTIES | 38 END_REGISTER_ANIMATED_PROPERTIES |
42 | 39 |
43 inline SVGPatternElement::SVGPatternElement(Document& document) | 40 inline SVGPatternElement::SVGPatternElement(Document& document) |
44 : SVGElement(SVGNames::patternTag, document) | 41 : SVGElement(SVGNames::patternTag, document) |
45 , SVGURIReference(this) | 42 , SVGURIReference(this) |
46 , SVGTests(this) | 43 , SVGTests(this) |
47 , SVGFitToViewBox(this) | 44 , SVGFitToViewBox(this) |
48 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth))) | 45 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth))) |
49 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight))) | 46 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight))) |
50 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth))) | 47 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth))) |
51 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight))) | 48 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight))) |
| 49 , m_patternTransform(SVGAnimatedTransformList::create(this, SVGNames::patter
nTransformAttr, SVGTransformList::create())) |
52 , m_patternUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create(t
his, SVGNames::patternUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)) | 50 , m_patternUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create(t
his, SVGNames::patternUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)) |
53 , m_patternContentUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::c
reate(this, SVGNames::patternContentUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_USERS
PACEONUSE)) | 51 , m_patternContentUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::c
reate(this, SVGNames::patternContentUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_USERS
PACEONUSE)) |
54 { | 52 { |
55 ScriptWrappable::init(this); | 53 ScriptWrappable::init(this); |
56 | 54 |
57 addToPropertyMap(m_x); | 55 addToPropertyMap(m_x); |
58 addToPropertyMap(m_y); | 56 addToPropertyMap(m_y); |
59 addToPropertyMap(m_width); | 57 addToPropertyMap(m_width); |
60 addToPropertyMap(m_height); | 58 addToPropertyMap(m_height); |
| 59 addToPropertyMap(m_patternTransform); |
61 addToPropertyMap(m_patternUnits); | 60 addToPropertyMap(m_patternUnits); |
62 addToPropertyMap(m_patternContentUnits); | 61 addToPropertyMap(m_patternContentUnits); |
63 registerAnimatedPropertiesForSVGPatternElement(); | 62 registerAnimatedPropertiesForSVGPatternElement(); |
64 } | 63 } |
65 | 64 |
66 PassRefPtr<SVGPatternElement> SVGPatternElement::create(Document& document) | 65 PassRefPtr<SVGPatternElement> SVGPatternElement::create(Document& document) |
67 { | 66 { |
68 return adoptRef(new SVGPatternElement(document)); | 67 return adoptRef(new SVGPatternElement(document)); |
69 } | 68 } |
70 | 69 |
(...skipping 19 matching lines...) Expand all Loading... |
90 { | 89 { |
91 SVGParsingError parseError = NoError; | 90 SVGParsingError parseError = NoError; |
92 | 91 |
93 if (!isSupportedAttribute(name)) { | 92 if (!isSupportedAttribute(name)) { |
94 SVGElement::parseAttribute(name, value); | 93 SVGElement::parseAttribute(name, value); |
95 } else if (name == SVGNames::patternUnitsAttr) { | 94 } else if (name == SVGNames::patternUnitsAttr) { |
96 m_patternUnits->setBaseValueAsString(value, parseError); | 95 m_patternUnits->setBaseValueAsString(value, parseError); |
97 } else if (name == SVGNames::patternContentUnitsAttr) { | 96 } else if (name == SVGNames::patternContentUnitsAttr) { |
98 m_patternContentUnits->setBaseValueAsString(value, parseError); | 97 m_patternContentUnits->setBaseValueAsString(value, parseError); |
99 } else if (name == SVGNames::patternTransformAttr) { | 98 } else if (name == SVGNames::patternTransformAttr) { |
100 SVGTransformList newList; | 99 m_patternTransform->setBaseValueAsString(value, parseError); |
101 newList.parse(value); | |
102 detachAnimatedPatternTransformListWrappers(newList.size()); | |
103 setPatternTransformBaseValue(newList); | |
104 return; | |
105 } else if (name == SVGNames::xAttr) { | 100 } else if (name == SVGNames::xAttr) { |
106 m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 101 m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); |
107 } else if (name == SVGNames::yAttr) { | 102 } else if (name == SVGNames::yAttr) { |
108 m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 103 m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); |
109 } else if (name == SVGNames::widthAttr) { | 104 } else if (name == SVGNames::widthAttr) { |
110 m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError); | 105 m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError); |
111 } else if (name == SVGNames::heightAttr) { | 106 } else if (name == SVGNames::heightAttr) { |
112 m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError)
; | 107 m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError)
; |
113 } else if (SVGURIReference::parseAttribute(name, value, parseError)) { | 108 } else if (SVGURIReference::parseAttribute(name, value, parseError)) { |
114 } else if (SVGTests::parseAttribute(name, value)) { | 109 } else if (SVGTests::parseAttribute(name, value)) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 170 |
176 if (!attributes.hasPreserveAspectRatio() && element->preserveAspectRatio()->
isSpecified()) | 171 if (!attributes.hasPreserveAspectRatio() && element->preserveAspectRatio()->
isSpecified()) |
177 attributes.setPreserveAspectRatio(element->preserveAspectRatio()->curren
tValue()); | 172 attributes.setPreserveAspectRatio(element->preserveAspectRatio()->curren
tValue()); |
178 | 173 |
179 if (!attributes.hasPatternUnits() && element->patternUnits()->isSpecified()) | 174 if (!attributes.hasPatternUnits() && element->patternUnits()->isSpecified()) |
180 attributes.setPatternUnits(element->patternUnits()->currentValue()->enum
Value()); | 175 attributes.setPatternUnits(element->patternUnits()->currentValue()->enum
Value()); |
181 | 176 |
182 if (!attributes.hasPatternContentUnits() && element->patternContentUnits()->
isSpecified()) | 177 if (!attributes.hasPatternContentUnits() && element->patternContentUnits()->
isSpecified()) |
183 attributes.setPatternContentUnits(element->patternContentUnits()->curren
tValue()->enumValue()); | 178 attributes.setPatternContentUnits(element->patternContentUnits()->curren
tValue()->enumValue()); |
184 | 179 |
185 if (!attributes.hasPatternTransform() && element->patternTransformSpecified(
)) { | 180 if (!attributes.hasPatternTransform() && element->patternTransform()->isSpec
ified()) { |
186 AffineTransform transform; | 181 AffineTransform transform; |
187 element->patternTransformCurrentValue().concatenate(transform); | 182 element->patternTransform()->currentValue()->concatenate(transform); |
188 attributes.setPatternTransform(transform); | 183 attributes.setPatternTransform(transform); |
189 } | 184 } |
190 | 185 |
191 if (!attributes.hasPatternContentElement() && ElementTraversal::firstWithin(
*element)) | 186 if (!attributes.hasPatternContentElement() && ElementTraversal::firstWithin(
*element)) |
192 attributes.setPatternContentElement(element); | 187 attributes.setPatternContentElement(element); |
193 } | 188 } |
194 | 189 |
195 void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes)
const | 190 void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes)
const |
196 { | 191 { |
197 HashSet<const SVGPatternElement*> processedPatterns; | 192 HashSet<const SVGPatternElement*> processedPatterns; |
(...skipping 15 matching lines...) Expand all Loading... |
213 return; | 208 return; |
214 } | 209 } |
215 } | 210 } |
216 | 211 |
217 ASSERT_NOT_REACHED(); | 212 ASSERT_NOT_REACHED(); |
218 } | 213 } |
219 | 214 |
220 AffineTransform SVGPatternElement::localCoordinateSpaceTransform(SVGElement::CTM
Scope) const | 215 AffineTransform SVGPatternElement::localCoordinateSpaceTransform(SVGElement::CTM
Scope) const |
221 { | 216 { |
222 AffineTransform matrix; | 217 AffineTransform matrix; |
223 patternTransformCurrentValue().concatenate(matrix); | 218 m_patternTransform->currentValue()->concatenate(matrix); |
224 return matrix; | 219 return matrix; |
225 } | 220 } |
226 | 221 |
227 bool SVGPatternElement::selfHasRelativeLengths() const | 222 bool SVGPatternElement::selfHasRelativeLengths() const |
228 { | 223 { |
229 return m_x->currentValue()->isRelative() | 224 return m_x->currentValue()->isRelative() |
230 || m_y->currentValue()->isRelative() | 225 || m_y->currentValue()->isRelative() |
231 || m_width->currentValue()->isRelative() | 226 || m_width->currentValue()->isRelative() |
232 || m_height->currentValue()->isRelative(); | 227 || m_height->currentValue()->isRelative(); |
233 } | 228 } |
234 | 229 |
235 } | 230 } |
OLD | NEW |