OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 for (unsigned i = 0; i < nchars; ++i) | 207 for (unsigned i = 0; i < nchars; ++i) |
208 end = end.next(); | 208 end = end.next(); |
209 | 209 |
210 selection->setSelection(VisibleSelection(start, end)); | 210 selection->setSelection(VisibleSelection(start, end)); |
211 } | 211 } |
212 | 212 |
213 bool SVGTextContentElement::isSupportedAttribute(const QualifiedName& attrName) | 213 bool SVGTextContentElement::isSupportedAttribute(const QualifiedName& attrName) |
214 { | 214 { |
215 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 215 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
216 if (supportedAttributes.isEmpty()) { | 216 if (supportedAttributes.isEmpty()) { |
217 SVGTests::addSupportedAttributes(supportedAttributes); | |
218 SVGLangSpace::addSupportedAttributes(supportedAttributes); | 217 SVGLangSpace::addSupportedAttributes(supportedAttributes); |
219 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | 218 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); |
220 supportedAttributes.add(SVGNames::lengthAdjustAttr); | 219 supportedAttributes.add(SVGNames::lengthAdjustAttr); |
221 supportedAttributes.add(SVGNames::textLengthAttr); | 220 supportedAttributes.add(SVGNames::textLengthAttr); |
222 } | 221 } |
223 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 222 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
224 } | 223 } |
225 | 224 |
226 bool SVGTextContentElement::isPresentationAttribute(const QualifiedName& name) c
onst | 225 bool SVGTextContentElement::isPresentationAttribute(const QualifiedName& name) c
onst |
227 { | 226 { |
(...skipping 21 matching lines...) Expand all Loading... |
249 SVGParsingError parseError = NoError; | 248 SVGParsingError parseError = NoError; |
250 | 249 |
251 if (!isSupportedAttribute(name)) | 250 if (!isSupportedAttribute(name)) |
252 SVGGraphicsElement::parseAttribute(name, value); | 251 SVGGraphicsElement::parseAttribute(name, value); |
253 else if (name == SVGNames::lengthAdjustAttr) { | 252 else if (name == SVGNames::lengthAdjustAttr) { |
254 SVGLengthAdjustType propertyValue = SVGPropertyTraits<SVGLengthAdjustTyp
e>::fromString(value); | 253 SVGLengthAdjustType propertyValue = SVGPropertyTraits<SVGLengthAdjustTyp
e>::fromString(value); |
255 if (propertyValue > 0) | 254 if (propertyValue > 0) |
256 setLengthAdjustBaseValue(propertyValue); | 255 setLengthAdjustBaseValue(propertyValue); |
257 } else if (name == SVGNames::textLengthAttr) { | 256 } else if (name == SVGNames::textLengthAttr) { |
258 m_textLength.value = SVGLength::construct(LengthModeOther, value, parseE
rror, ForbidNegativeLengths); | 257 m_textLength.value = SVGLength::construct(LengthModeOther, value, parseE
rror, ForbidNegativeLengths); |
259 } else if (SVGTests::parseAttribute(name, value) | 258 } else if (SVGExternalResourcesRequired::parseAttribute(name, value)) { |
260 || SVGExternalResourcesRequired::parseAttribute(name, value)) { | |
261 } else if (SVGLangSpace::parseAttribute(name, value)) { | 259 } else if (SVGLangSpace::parseAttribute(name, value)) { |
262 } else | 260 } else |
263 ASSERT_NOT_REACHED(); | 261 ASSERT_NOT_REACHED(); |
264 | 262 |
265 reportAttributeParsingError(parseError, name, value); | 263 reportAttributeParsingError(parseError, name, value); |
266 } | 264 } |
267 | 265 |
268 void SVGTextContentElement::svgAttributeChanged(const QualifiedName& attrName) | 266 void SVGTextContentElement::svgAttributeChanged(const QualifiedName& attrName) |
269 { | 267 { |
270 if (!isSupportedAttribute(attrName)) { | 268 if (!isSupportedAttribute(attrName)) { |
271 SVGGraphicsElement::svgAttributeChanged(attrName); | 269 SVGGraphicsElement::svgAttributeChanged(attrName); |
272 return; | 270 return; |
273 } | 271 } |
274 | 272 |
275 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 273 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
276 | 274 |
277 if (SVGTests::handleAttributeChange(this, attrName)) | |
278 return; | |
279 | |
280 if (attrName == SVGNames::textLengthAttr) | 275 if (attrName == SVGNames::textLengthAttr) |
281 m_specifiedTextLength = m_textLength.value; | 276 m_specifiedTextLength = m_textLength.value; |
282 | 277 |
283 if (RenderObject* renderer = this->renderer()) | 278 if (RenderObject* renderer = this->renderer()) |
284 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 279 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
285 } | 280 } |
286 | 281 |
287 bool SVGTextContentElement::selfHasRelativeLengths() const | 282 bool SVGTextContentElement::selfHasRelativeLengths() const |
288 { | 283 { |
289 // Any element of the <text> subtree is advertized as using relative lengths
. | 284 // Any element of the <text> subtree is advertized as using relative lengths
. |
(...skipping 13 matching lines...) Expand all Loading... |
303 SVGElement* element = toSVGElement(renderer->node()); | 298 SVGElement* element = toSVGElement(renderer->node()); |
304 ASSERT(element); | 299 ASSERT(element); |
305 | 300 |
306 if (!element->isTextContent()) | 301 if (!element->isTextContent()) |
307 return 0; | 302 return 0; |
308 | 303 |
309 return toSVGTextContentElement(element); | 304 return toSVGTextContentElement(element); |
310 } | 305 } |
311 | 306 |
312 } | 307 } |
OLD | NEW |