OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> | 4 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> |
5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 5 * Copyright (C) 2009 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 REGISTER_LOCAL_ANIMATED_PROPERTY(y) | 53 REGISTER_LOCAL_ANIMATED_PROPERTY(y) |
54 REGISTER_LOCAL_ANIMATED_PROPERTY(width) | 54 REGISTER_LOCAL_ANIMATED_PROPERTY(width) |
55 REGISTER_LOCAL_ANIMATED_PROPERTY(height) | 55 REGISTER_LOCAL_ANIMATED_PROPERTY(height) |
56 REGISTER_LOCAL_ANIMATED_PROPERTY(filterResX) | 56 REGISTER_LOCAL_ANIMATED_PROPERTY(filterResX) |
57 REGISTER_LOCAL_ANIMATED_PROPERTY(filterResY) | 57 REGISTER_LOCAL_ANIMATED_PROPERTY(filterResY) |
58 REGISTER_LOCAL_ANIMATED_PROPERTY(href) | 58 REGISTER_LOCAL_ANIMATED_PROPERTY(href) |
59 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | 59 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) |
60 END_REGISTER_ANIMATED_PROPERTIES | 60 END_REGISTER_ANIMATED_PROPERTIES |
61 | 61 |
62 inline SVGFilterElement::SVGFilterElement(const QualifiedName& tagName, Document
* document) | 62 inline SVGFilterElement::SVGFilterElement(const QualifiedName& tagName, Document
* document) |
63 : SVGStyledElement(tagName, document) | 63 : SVGElement(tagName, document) |
64 , m_filterUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) | 64 , m_filterUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) |
65 , m_primitiveUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) | 65 , m_primitiveUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) |
66 , m_x(LengthModeWidth, "-10%") | 66 , m_x(LengthModeWidth, "-10%") |
67 , m_y(LengthModeHeight, "-10%") | 67 , m_y(LengthModeHeight, "-10%") |
68 , m_width(LengthModeWidth, "120%") | 68 , m_width(LengthModeWidth, "120%") |
69 , m_height(LengthModeHeight, "120%") | 69 , m_height(LengthModeHeight, "120%") |
70 { | 70 { |
71 // Spec: If the x/y attribute is not specified, the effect is as if a value
of "-10%" were specified. | 71 // Spec: If the x/y attribute is not specified, the effect is as if a value
of "-10%" were specified. |
72 // Spec: If the width/height attribute is not specified, the effect is as if
a value of "120%" were specified. | 72 // Spec: If the width/height attribute is not specified, the effect is as if
a value of "120%" were specified. |
73 ASSERT(hasTagName(SVGNames::filterTag)); | 73 ASSERT(hasTagName(SVGNames::filterTag)); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 supportedAttributes.add(SVGNames::filterResAttr); | 116 supportedAttributes.add(SVGNames::filterResAttr); |
117 } | 117 } |
118 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 118 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
119 } | 119 } |
120 | 120 |
121 void SVGFilterElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 121 void SVGFilterElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
122 { | 122 { |
123 SVGParsingError parseError = NoError; | 123 SVGParsingError parseError = NoError; |
124 | 124 |
125 if (!isSupportedAttribute(name)) | 125 if (!isSupportedAttribute(name)) |
126 SVGStyledElement::parseAttribute(name, value); | 126 SVGElement::parseAttribute(name, value); |
127 else if (name == SVGNames::filterUnitsAttr) { | 127 else if (name == SVGNames::filterUnitsAttr) { |
128 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes
::SVGUnitType>::fromString(value); | 128 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes
::SVGUnitType>::fromString(value); |
129 if (propertyValue > 0) | 129 if (propertyValue > 0) |
130 setFilterUnitsBaseValue(propertyValue); | 130 setFilterUnitsBaseValue(propertyValue); |
131 } else if (name == SVGNames::primitiveUnitsAttr) { | 131 } else if (name == SVGNames::primitiveUnitsAttr) { |
132 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes
::SVGUnitType>::fromString(value); | 132 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes
::SVGUnitType>::fromString(value); |
133 if (propertyValue > 0) | 133 if (propertyValue > 0) |
134 setPrimitiveUnitsBaseValue(propertyValue); | 134 setPrimitiveUnitsBaseValue(propertyValue); |
135 } else if (name == SVGNames::xAttr) | 135 } else if (name == SVGNames::xAttr) |
136 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); | 136 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); |
(...skipping 13 matching lines...) Expand all Loading... |
150 || SVGExternalResourcesRequired::parseAttribute(name, value)) { | 150 || SVGExternalResourcesRequired::parseAttribute(name, value)) { |
151 } else | 151 } else |
152 ASSERT_NOT_REACHED(); | 152 ASSERT_NOT_REACHED(); |
153 | 153 |
154 reportAttributeParsingError(parseError, name, value); | 154 reportAttributeParsingError(parseError, name, value); |
155 } | 155 } |
156 | 156 |
157 void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName) | 157 void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName) |
158 { | 158 { |
159 if (!isSupportedAttribute(attrName)) { | 159 if (!isSupportedAttribute(attrName)) { |
160 SVGStyledElement::svgAttributeChanged(attrName); | 160 SVGElement::svgAttributeChanged(attrName); |
161 return; | 161 return; |
162 } | 162 } |
163 | 163 |
164 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 164 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
165 | 165 |
166 if (attrName == SVGNames::xAttr | 166 if (attrName == SVGNames::xAttr |
167 || attrName == SVGNames::yAttr | 167 || attrName == SVGNames::yAttr |
168 || attrName == SVGNames::widthAttr | 168 || attrName == SVGNames::widthAttr |
169 || attrName == SVGNames::heightAttr) | 169 || attrName == SVGNames::heightAttr) |
170 updateRelativeLengthsInformation(); | 170 updateRelativeLengthsInformation(); |
171 | 171 |
172 if (RenderObject* object = renderer()) | 172 if (RenderObject* object = renderer()) |
173 object->setNeedsLayout(true); | 173 object->setNeedsLayout(true); |
174 } | 174 } |
175 | 175 |
176 void SVGFilterElement::childrenChanged(bool changedByParser, Node* beforeChange,
Node* afterChange, int childCountDelta) | 176 void SVGFilterElement::childrenChanged(bool changedByParser, Node* beforeChange,
Node* afterChange, int childCountDelta) |
177 { | 177 { |
178 SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange
, childCountDelta); | 178 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil
dCountDelta); |
179 | 179 |
180 if (changedByParser) | 180 if (changedByParser) |
181 return; | 181 return; |
182 | 182 |
183 if (RenderObject* object = renderer()) | 183 if (RenderObject* object = renderer()) |
184 object->setNeedsLayout(true); | 184 object->setNeedsLayout(true); |
185 } | 185 } |
186 | 186 |
187 RenderObject* SVGFilterElement::createRenderer(RenderStyle*) | 187 RenderObject* SVGFilterElement::createRenderer(RenderStyle*) |
188 { | 188 { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 230 |
231 bool SVGFilterElement::selfHasRelativeLengths() const | 231 bool SVGFilterElement::selfHasRelativeLengths() const |
232 { | 232 { |
233 return xCurrentValue().isRelative() | 233 return xCurrentValue().isRelative() |
234 || yCurrentValue().isRelative() | 234 || yCurrentValue().isRelative() |
235 || widthCurrentValue().isRelative() | 235 || widthCurrentValue().isRelative() |
236 || heightCurrentValue().isRelative(); | 236 || heightCurrentValue().isRelative(); |
237 } | 237 } |
238 | 238 |
239 } | 239 } |
OLD | NEW |