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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 REGISTER_LOCAL_ANIMATED_PROPERTY(y) | 51 REGISTER_LOCAL_ANIMATED_PROPERTY(y) |
52 REGISTER_LOCAL_ANIMATED_PROPERTY(width) | 52 REGISTER_LOCAL_ANIMATED_PROPERTY(width) |
53 REGISTER_LOCAL_ANIMATED_PROPERTY(height) | 53 REGISTER_LOCAL_ANIMATED_PROPERTY(height) |
54 REGISTER_LOCAL_ANIMATED_PROPERTY(patternUnits) | 54 REGISTER_LOCAL_ANIMATED_PROPERTY(patternUnits) |
55 REGISTER_LOCAL_ANIMATED_PROPERTY(patternContentUnits) | 55 REGISTER_LOCAL_ANIMATED_PROPERTY(patternContentUnits) |
56 REGISTER_LOCAL_ANIMATED_PROPERTY(patternTransform) | 56 REGISTER_LOCAL_ANIMATED_PROPERTY(patternTransform) |
57 REGISTER_LOCAL_ANIMATED_PROPERTY(href) | 57 REGISTER_LOCAL_ANIMATED_PROPERTY(href) |
58 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | 58 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) |
59 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox) | 59 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox) |
60 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) | 60 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) |
61 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledElement) | 61 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) |
62 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) | 62 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) |
63 END_REGISTER_ANIMATED_PROPERTIES | 63 END_REGISTER_ANIMATED_PROPERTIES |
64 | 64 |
65 inline SVGPatternElement::SVGPatternElement(const QualifiedName& tagName, Docume
nt* document) | 65 inline SVGPatternElement::SVGPatternElement(const QualifiedName& tagName, Docume
nt* document) |
66 : SVGStyledElement(tagName, document) | 66 : SVGElement(tagName, document) |
67 , m_x(LengthModeWidth) | 67 , m_x(LengthModeWidth) |
68 , m_y(LengthModeHeight) | 68 , m_y(LengthModeHeight) |
69 , m_width(LengthModeWidth) | 69 , m_width(LengthModeWidth) |
70 , m_height(LengthModeHeight) | 70 , m_height(LengthModeHeight) |
71 , m_patternUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) | 71 , m_patternUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) |
72 , m_patternContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) | 72 , m_patternContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) |
73 { | 73 { |
74 ASSERT(hasTagName(SVGNames::patternTag)); | 74 ASSERT(hasTagName(SVGNames::patternTag)); |
75 ScriptWrappable::init(this); | 75 ScriptWrappable::init(this); |
76 registerAnimatedPropertiesForSVGPatternElement(); | 76 registerAnimatedPropertiesForSVGPatternElement(); |
(...skipping 21 matching lines...) Expand all Loading... |
98 supportedAttributes.add(SVGNames::heightAttr); | 98 supportedAttributes.add(SVGNames::heightAttr); |
99 } | 99 } |
100 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 100 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
101 } | 101 } |
102 | 102 |
103 void SVGPatternElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) | 103 void SVGPatternElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) |
104 { | 104 { |
105 SVGParsingError parseError = NoError; | 105 SVGParsingError parseError = NoError; |
106 | 106 |
107 if (!isSupportedAttribute(name)) | 107 if (!isSupportedAttribute(name)) |
108 SVGStyledElement::parseAttribute(name, value); | 108 SVGElement::parseAttribute(name, value); |
109 else if (name == SVGNames::patternUnitsAttr) { | 109 else if (name == SVGNames::patternUnitsAttr) { |
110 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes
::SVGUnitType>::fromString(value); | 110 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes
::SVGUnitType>::fromString(value); |
111 if (propertyValue > 0) | 111 if (propertyValue > 0) |
112 setPatternUnitsBaseValue(propertyValue); | 112 setPatternUnitsBaseValue(propertyValue); |
113 return; | 113 return; |
114 } else if (name == SVGNames::patternContentUnitsAttr) { | 114 } else if (name == SVGNames::patternContentUnitsAttr) { |
115 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes
::SVGUnitType>::fromString(value); | 115 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes
::SVGUnitType>::fromString(value); |
116 if (propertyValue > 0) | 116 if (propertyValue > 0) |
117 setPatternContentUnitsBaseValue(propertyValue); | 117 setPatternContentUnitsBaseValue(propertyValue); |
118 return; | 118 return; |
(...skipping 17 matching lines...) Expand all Loading... |
136 || SVGFitToViewBox::parseAttribute(this, name, value)) { | 136 || SVGFitToViewBox::parseAttribute(this, name, value)) { |
137 } else | 137 } else |
138 ASSERT_NOT_REACHED(); | 138 ASSERT_NOT_REACHED(); |
139 | 139 |
140 reportAttributeParsingError(parseError, name, value); | 140 reportAttributeParsingError(parseError, name, value); |
141 } | 141 } |
142 | 142 |
143 void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) | 143 void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) |
144 { | 144 { |
145 if (!isSupportedAttribute(attrName)) { | 145 if (!isSupportedAttribute(attrName)) { |
146 SVGStyledElement::svgAttributeChanged(attrName); | 146 SVGElement::svgAttributeChanged(attrName); |
147 return; | 147 return; |
148 } | 148 } |
149 | 149 |
150 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 150 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
151 | 151 |
152 if (attrName == SVGNames::xAttr | 152 if (attrName == SVGNames::xAttr |
153 || attrName == SVGNames::yAttr | 153 || attrName == SVGNames::yAttr |
154 || attrName == SVGNames::widthAttr | 154 || attrName == SVGNames::widthAttr |
155 || attrName == SVGNames::heightAttr) | 155 || attrName == SVGNames::heightAttr) |
156 updateRelativeLengthsInformation(); | 156 updateRelativeLengthsInformation(); |
157 | 157 |
158 if (RenderObject* object = renderer()) | 158 if (RenderObject* object = renderer()) |
159 object->setNeedsLayout(true); | 159 object->setNeedsLayout(true); |
160 } | 160 } |
161 | 161 |
162 void SVGPatternElement::childrenChanged(bool changedByParser, Node* beforeChange
, Node* afterChange, int childCountDelta) | 162 void SVGPatternElement::childrenChanged(bool changedByParser, Node* beforeChange
, Node* afterChange, int childCountDelta) |
163 { | 163 { |
164 SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange
, childCountDelta); | 164 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil
dCountDelta); |
165 | 165 |
166 if (changedByParser) | 166 if (changedByParser) |
167 return; | 167 return; |
168 | 168 |
169 if (RenderObject* object = renderer()) | 169 if (RenderObject* object = renderer()) |
170 object->setNeedsLayout(true); | 170 object->setNeedsLayout(true); |
171 } | 171 } |
172 | 172 |
173 RenderObject* SVGPatternElement::createRenderer(RenderStyle*) | 173 RenderObject* SVGPatternElement::createRenderer(RenderStyle*) |
174 { | 174 { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 bool SVGPatternElement::selfHasRelativeLengths() const | 241 bool SVGPatternElement::selfHasRelativeLengths() const |
242 { | 242 { |
243 return xCurrentValue().isRelative() | 243 return xCurrentValue().isRelative() |
244 || yCurrentValue().isRelative() | 244 || yCurrentValue().isRelative() |
245 || widthCurrentValue().isRelative() | 245 || widthCurrentValue().isRelative() |
246 || heightCurrentValue().isRelative(); | 246 || heightCurrentValue().isRelative(); |
247 } | 247 } |
248 | 248 |
249 } | 249 } |
OLD | NEW |