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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 | 52 |
53 // Animated property definitions | 53 // Animated property definitions |
54 DEFINE_ANIMATED_ENUMERATION(SVGTextContentElement, SVGNames::lengthAdjustAttr, L
engthAdjust, lengthAdjust, SVGLengthAdjustType) | 54 DEFINE_ANIMATED_ENUMERATION(SVGTextContentElement, SVGNames::lengthAdjustAttr, L
engthAdjust, lengthAdjust, SVGLengthAdjustType) |
55 DEFINE_ANIMATED_BOOLEAN(SVGTextContentElement, SVGNames::externalResourcesRequir
edAttr, ExternalResourcesRequired, externalResourcesRequired) | 55 DEFINE_ANIMATED_BOOLEAN(SVGTextContentElement, SVGNames::externalResourcesRequir
edAttr, ExternalResourcesRequired, externalResourcesRequired) |
56 | 56 |
57 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextContentElement) | 57 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextContentElement) |
58 REGISTER_LOCAL_ANIMATED_PROPERTY(textLength) | 58 REGISTER_LOCAL_ANIMATED_PROPERTY(textLength) |
59 REGISTER_LOCAL_ANIMATED_PROPERTY(lengthAdjust) | 59 REGISTER_LOCAL_ANIMATED_PROPERTY(lengthAdjust) |
60 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | 60 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) |
61 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledElement) | 61 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
62 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) | |
63 END_REGISTER_ANIMATED_PROPERTIES | 62 END_REGISTER_ANIMATED_PROPERTIES |
64 | 63 |
65 SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Docum
ent* document) | 64 SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Docum
ent* document) |
66 : SVGStyledElement(tagName, document) | 65 : SVGGraphicsElement(tagName, document) |
67 , m_textLength(LengthModeOther) | 66 , m_textLength(LengthModeOther) |
68 , m_specifiedTextLength(LengthModeOther) | 67 , m_specifiedTextLength(LengthModeOther) |
69 , m_lengthAdjust(SVGLengthAdjustSpacing) | 68 , m_lengthAdjust(SVGLengthAdjustSpacing) |
70 { | 69 { |
71 ScriptWrappable::init(this); | 70 ScriptWrappable::init(this); |
72 registerAnimatedPropertiesForSVGTextContentElement(); | 71 registerAnimatedPropertiesForSVGTextContentElement(); |
73 } | 72 } |
74 | 73 |
75 void SVGTextContentElement::synchronizeTextLength(SVGElement* contextElement) | 74 void SVGTextContentElement::synchronizeTextLength(SVGElement* contextElement) |
76 { | 75 { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 supportedAttributes.add(SVGNames::lengthAdjustAttr); | 220 supportedAttributes.add(SVGNames::lengthAdjustAttr); |
222 supportedAttributes.add(SVGNames::textLengthAttr); | 221 supportedAttributes.add(SVGNames::textLengthAttr); |
223 } | 222 } |
224 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 223 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
225 } | 224 } |
226 | 225 |
227 bool SVGTextContentElement::isPresentationAttribute(const QualifiedName& name) c
onst | 226 bool SVGTextContentElement::isPresentationAttribute(const QualifiedName& name) c
onst |
228 { | 227 { |
229 if (name.matches(XMLNames::spaceAttr)) | 228 if (name.matches(XMLNames::spaceAttr)) |
230 return true; | 229 return true; |
231 return SVGStyledElement::isPresentationAttribute(name); | 230 return SVGGraphicsElement::isPresentationAttribute(name); |
232 } | 231 } |
233 | 232 |
234 void SVGTextContentElement::collectStyleForPresentationAttribute(const Qualified
Name& name, const AtomicString& value, MutableStylePropertySet* style) | 233 void SVGTextContentElement::collectStyleForPresentationAttribute(const Qualified
Name& name, const AtomicString& value, MutableStylePropertySet* style) |
235 { | 234 { |
236 if (!isSupportedAttribute(name)) | 235 if (!isSupportedAttribute(name)) |
237 SVGStyledElement::collectStyleForPresentationAttribute(name, value, styl
e); | 236 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st
yle); |
238 else if (name.matches(XMLNames::spaceAttr)) { | 237 else if (name.matches(XMLNames::spaceAttr)) { |
239 DEFINE_STATIC_LOCAL(const AtomicString, preserveString, ("preserve", Ato
micString::ConstructFromLiteral)); | 238 DEFINE_STATIC_LOCAL(const AtomicString, preserveString, ("preserve", Ato
micString::ConstructFromLiteral)); |
240 | 239 |
241 if (value == preserveString) | 240 if (value == preserveString) |
242 addPropertyToPresentationAttributeStyle(style, CSSPropertyWhiteSpace
, CSSValuePre); | 241 addPropertyToPresentationAttributeStyle(style, CSSPropertyWhiteSpace
, CSSValuePre); |
243 else | 242 else |
244 addPropertyToPresentationAttributeStyle(style, CSSPropertyWhiteSpace
, CSSValueNowrap); | 243 addPropertyToPresentationAttributeStyle(style, CSSPropertyWhiteSpace
, CSSValueNowrap); |
245 } | 244 } |
246 } | 245 } |
247 | 246 |
248 void SVGTextContentElement::parseAttribute(const QualifiedName& name, const Atom
icString& value) | 247 void SVGTextContentElement::parseAttribute(const QualifiedName& name, const Atom
icString& value) |
249 { | 248 { |
250 SVGParsingError parseError = NoError; | 249 SVGParsingError parseError = NoError; |
251 | 250 |
252 if (!isSupportedAttribute(name)) | 251 if (!isSupportedAttribute(name)) |
253 SVGStyledElement::parseAttribute(name, value); | 252 SVGGraphicsElement::parseAttribute(name, value); |
254 else if (name == SVGNames::lengthAdjustAttr) { | 253 else if (name == SVGNames::lengthAdjustAttr) { |
255 SVGLengthAdjustType propertyValue = SVGPropertyTraits<SVGLengthAdjustTyp
e>::fromString(value); | 254 SVGLengthAdjustType propertyValue = SVGPropertyTraits<SVGLengthAdjustTyp
e>::fromString(value); |
256 if (propertyValue > 0) | 255 if (propertyValue > 0) |
257 setLengthAdjustBaseValue(propertyValue); | 256 setLengthAdjustBaseValue(propertyValue); |
258 } else if (name == SVGNames::textLengthAttr) { | 257 } else if (name == SVGNames::textLengthAttr) { |
259 m_textLength.value = SVGLength::construct(LengthModeOther, value, parseE
rror, ForbidNegativeLengths); | 258 m_textLength.value = SVGLength::construct(LengthModeOther, value, parseE
rror, ForbidNegativeLengths); |
260 } else if (SVGTests::parseAttribute(name, value) | 259 } else if (SVGTests::parseAttribute(name, value) |
261 || SVGExternalResourcesRequired::parseAttribute(name, value)) { | 260 || SVGExternalResourcesRequired::parseAttribute(name, value)) { |
262 } else if (SVGLangSpace::parseAttribute(name, value)) { | 261 } else if (SVGLangSpace::parseAttribute(name, value)) { |
263 } else | 262 } else |
264 ASSERT_NOT_REACHED(); | 263 ASSERT_NOT_REACHED(); |
265 | 264 |
266 reportAttributeParsingError(parseError, name, value); | 265 reportAttributeParsingError(parseError, name, value); |
267 } | 266 } |
268 | 267 |
269 void SVGTextContentElement::svgAttributeChanged(const QualifiedName& attrName) | 268 void SVGTextContentElement::svgAttributeChanged(const QualifiedName& attrName) |
270 { | 269 { |
271 if (!isSupportedAttribute(attrName)) { | 270 if (!isSupportedAttribute(attrName)) { |
272 SVGStyledElement::svgAttributeChanged(attrName); | 271 SVGGraphicsElement::svgAttributeChanged(attrName); |
273 return; | 272 return; |
274 } | 273 } |
275 | 274 |
276 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 275 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
277 | 276 |
278 if (SVGTests::handleAttributeChange(this, attrName)) | 277 if (SVGTests::handleAttributeChange(this, attrName)) |
279 return; | 278 return; |
280 | 279 |
281 if (attrName == SVGNames::textLengthAttr) | 280 if (attrName == SVGNames::textLengthAttr) |
282 m_specifiedTextLength = m_textLength.value; | 281 m_specifiedTextLength = m_textLength.value; |
(...skipping 21 matching lines...) Expand all Loading... |
304 SVGElement* element = toSVGElement(renderer->node()); | 303 SVGElement* element = toSVGElement(renderer->node()); |
305 ASSERT(element); | 304 ASSERT(element); |
306 | 305 |
307 if (!element->isTextContent()) | 306 if (!element->isTextContent()) |
308 return 0; | 307 return 0; |
309 | 308 |
310 return toSVGTextContentElement(element); | 309 return toSVGTextContentElement(element); |
311 } | 310 } |
312 | 311 |
313 } | 312 } |
OLD | NEW |