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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 SVGNames::textLengthAttr, | 46 SVGNames::textLengthAttr, |
47 SVGNames::textLengthAttr.localName(
), | 47 SVGNames::textLengthAttr.localName(
), |
48 &SVGTextContentElement::synchronize
TextLength, | 48 &SVGTextContentElement::synchronize
TextLength, |
49 &SVGTextContentElement::lookupOrCre
ateTextLengthWrapper); | 49 &SVGTextContentElement::lookupOrCre
ateTextLengthWrapper); |
50 } | 50 } |
51 return s_propertyInfo; | 51 return s_propertyInfo; |
52 } | 52 } |
53 | 53 |
54 // Animated property definitions | 54 // Animated property definitions |
55 DEFINE_ANIMATED_ENUMERATION(SVGTextContentElement, SVGNames::lengthAdjustAttr, L
engthAdjust, lengthAdjust, SVGLengthAdjustType) | 55 DEFINE_ANIMATED_ENUMERATION(SVGTextContentElement, SVGNames::lengthAdjustAttr, L
engthAdjust, lengthAdjust, SVGLengthAdjustType) |
56 DEFINE_ANIMATED_BOOLEAN(SVGTextContentElement, SVGNames::externalResourcesRequir
edAttr, ExternalResourcesRequired, externalResourcesRequired) | |
57 | 56 |
58 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextContentElement) | 57 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextContentElement) |
59 REGISTER_LOCAL_ANIMATED_PROPERTY(textLength) | 58 REGISTER_LOCAL_ANIMATED_PROPERTY(textLength) |
60 REGISTER_LOCAL_ANIMATED_PROPERTY(lengthAdjust) | 59 REGISTER_LOCAL_ANIMATED_PROPERTY(lengthAdjust) |
61 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
62 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) | 60 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
63 END_REGISTER_ANIMATED_PROPERTIES | 61 END_REGISTER_ANIMATED_PROPERTIES |
64 | 62 |
65 SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Docum
ent& document) | 63 SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Docum
ent& document) |
66 : SVGGraphicsElement(tagName, document) | 64 : SVGGraphicsElement(tagName, document) |
67 , m_textLength(LengthModeOther) | 65 , m_textLength(LengthModeOther) |
68 , m_specifiedTextLength(LengthModeOther) | 66 , m_specifiedTextLength(LengthModeOther) |
69 , m_lengthAdjust(SVGLengthAdjustSpacing) | 67 , m_lengthAdjust(SVGLengthAdjustSpacing) |
70 { | 68 { |
71 ScriptWrappable::init(this); | 69 ScriptWrappable::init(this); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 for (unsigned i = 0; i < nchars; ++i) | 204 for (unsigned i = 0; i < nchars; ++i) |
207 end = end.next(); | 205 end = end.next(); |
208 | 206 |
209 document().frame()->selection().setSelection(VisibleSelection(start, end)); | 207 document().frame()->selection().setSelection(VisibleSelection(start, end)); |
210 } | 208 } |
211 | 209 |
212 bool SVGTextContentElement::isSupportedAttribute(const QualifiedName& attrName) | 210 bool SVGTextContentElement::isSupportedAttribute(const QualifiedName& attrName) |
213 { | 211 { |
214 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 212 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
215 if (supportedAttributes.isEmpty()) { | 213 if (supportedAttributes.isEmpty()) { |
216 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | |
217 supportedAttributes.add(SVGNames::lengthAdjustAttr); | 214 supportedAttributes.add(SVGNames::lengthAdjustAttr); |
218 supportedAttributes.add(SVGNames::textLengthAttr); | 215 supportedAttributes.add(SVGNames::textLengthAttr); |
219 supportedAttributes.add(XMLNames::spaceAttr); | 216 supportedAttributes.add(XMLNames::spaceAttr); |
220 } | 217 } |
221 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 218 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
222 } | 219 } |
223 | 220 |
224 bool SVGTextContentElement::isPresentationAttribute(const QualifiedName& name) c
onst | 221 bool SVGTextContentElement::isPresentationAttribute(const QualifiedName& name) c
onst |
225 { | 222 { |
226 if (name.matches(XMLNames::spaceAttr)) | 223 if (name.matches(XMLNames::spaceAttr)) |
(...skipping 20 matching lines...) Expand all Loading... |
247 SVGParsingError parseError = NoError; | 244 SVGParsingError parseError = NoError; |
248 | 245 |
249 if (!isSupportedAttribute(name)) | 246 if (!isSupportedAttribute(name)) |
250 SVGGraphicsElement::parseAttribute(name, value); | 247 SVGGraphicsElement::parseAttribute(name, value); |
251 else if (name == SVGNames::lengthAdjustAttr) { | 248 else if (name == SVGNames::lengthAdjustAttr) { |
252 SVGLengthAdjustType propertyValue = SVGPropertyTraits<SVGLengthAdjustTyp
e>::fromString(value); | 249 SVGLengthAdjustType propertyValue = SVGPropertyTraits<SVGLengthAdjustTyp
e>::fromString(value); |
253 if (propertyValue > 0) | 250 if (propertyValue > 0) |
254 setLengthAdjustBaseValue(propertyValue); | 251 setLengthAdjustBaseValue(propertyValue); |
255 } else if (name == SVGNames::textLengthAttr) { | 252 } else if (name == SVGNames::textLengthAttr) { |
256 m_textLength.value = SVGLength::construct(LengthModeOther, value, parseE
rror, ForbidNegativeLengths); | 253 m_textLength.value = SVGLength::construct(LengthModeOther, value, parseE
rror, ForbidNegativeLengths); |
257 } else if (SVGExternalResourcesRequired::parseAttribute(name, value)) { | |
258 } else if (name.matches(XMLNames::spaceAttr)) { | 254 } else if (name.matches(XMLNames::spaceAttr)) { |
259 } else | 255 } else |
260 ASSERT_NOT_REACHED(); | 256 ASSERT_NOT_REACHED(); |
261 | 257 |
262 reportAttributeParsingError(parseError, name, value); | 258 reportAttributeParsingError(parseError, name, value); |
263 } | 259 } |
264 | 260 |
265 void SVGTextContentElement::svgAttributeChanged(const QualifiedName& attrName) | 261 void SVGTextContentElement::svgAttributeChanged(const QualifiedName& attrName) |
266 { | 262 { |
267 if (!isSupportedAttribute(attrName)) { | 263 if (!isSupportedAttribute(attrName)) { |
(...skipping 29 matching lines...) Expand all Loading... |
297 SVGElement* element = toSVGElement(renderer->node()); | 293 SVGElement* element = toSVGElement(renderer->node()); |
298 ASSERT(element); | 294 ASSERT(element); |
299 | 295 |
300 if (!element->isTextContent()) | 296 if (!element->isTextContent()) |
301 return 0; | 297 return 0; |
302 | 298 |
303 return toSVGTextContentElement(element); | 299 return toSVGTextContentElement(element); |
304 } | 300 } |
305 | 301 |
306 } | 302 } |
OLD | NEW |