| 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 30 matching lines...) Expand all Loading... |
| 41 { | 41 { |
| 42 DEFINE_STATIC_LOCAL(SVGEnumerationStringEntries, entries, ()); | 42 DEFINE_STATIC_LOCAL(SVGEnumerationStringEntries, entries, ()); |
| 43 if (entries.isEmpty()) { | 43 if (entries.isEmpty()) { |
| 44 entries.append(std::make_pair(SVGLengthAdjustUnknown, emptyString())); | 44 entries.append(std::make_pair(SVGLengthAdjustUnknown, emptyString())); |
| 45 entries.append(std::make_pair(SVGLengthAdjustSpacing, "spacing")); | 45 entries.append(std::make_pair(SVGLengthAdjustSpacing, "spacing")); |
| 46 entries.append(std::make_pair(SVGLengthAdjustSpacingAndGlyphs, "spacingA
ndGlyphs")); | 46 entries.append(std::make_pair(SVGLengthAdjustSpacingAndGlyphs, "spacingA
ndGlyphs")); |
| 47 } | 47 } |
| 48 return entries; | 48 return entries; |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Animated property definitions | |
| 52 | |
| 53 // SVGTextContentElement's 'textLength' attribute needs special handling. | 51 // SVGTextContentElement's 'textLength' attribute needs special handling. |
| 54 // It should return getComputedTextLength() when textLength is not specified man
ually. | 52 // It should return getComputedTextLength() when textLength is not specified man
ually. |
| 55 class SVGAnimatedTextLength FINAL : public SVGAnimatedLength { | 53 class SVGAnimatedTextLength FINAL : public SVGAnimatedLength { |
| 56 public: | 54 public: |
| 57 static PassRefPtr<SVGAnimatedTextLength> create(SVGTextContentElement* conte
xtElement) | 55 static PassRefPtr<SVGAnimatedTextLength> create(SVGTextContentElement* conte
xtElement) |
| 58 { | 56 { |
| 59 return adoptRef(new SVGAnimatedTextLength(contextElement)); | 57 return adoptRef(new SVGAnimatedTextLength(contextElement)); |
| 60 } | 58 } |
| 61 | 59 |
| 62 virtual SVGLengthTearOff* baseVal() OVERRIDE | 60 virtual SVGLengthTearOff* baseVal() OVERRIDE |
| 63 { | 61 { |
| 64 SVGTextContentElement* textContentElement = toSVGTextContentElement(cont
extElement()); | 62 SVGTextContentElement* textContentElement = toSVGTextContentElement(cont
extElement()); |
| 65 if (!textContentElement->textLengthIsSpecifiedByUser()) | 63 if (!textContentElement->textLengthIsSpecifiedByUser()) |
| 66 baseValue()->newValueSpecifiedUnits(LengthTypeNumber, textContentEle
ment->getComputedTextLength()); | 64 baseValue()->newValueSpecifiedUnits(LengthTypeNumber, textContentEle
ment->getComputedTextLength()); |
| 67 | 65 |
| 68 return SVGAnimatedLength::baseVal(); | 66 return SVGAnimatedLength::baseVal(); |
| 69 } | 67 } |
| 70 | 68 |
| 71 private: | 69 private: |
| 72 SVGAnimatedTextLength(SVGTextContentElement* contextElement) | 70 SVGAnimatedTextLength(SVGTextContentElement* contextElement) |
| 73 : SVGAnimatedLength(contextElement, SVGNames::textLengthAttr, SVGLength:
:create(LengthModeOther)) | 71 : SVGAnimatedLength(contextElement, SVGNames::textLengthAttr, SVGLength:
:create(LengthModeOther)) |
| 74 { | 72 { |
| 75 } | 73 } |
| 76 }; | 74 }; |
| 77 | 75 |
| 78 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextContentElement) | |
| 79 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) | |
| 80 END_REGISTER_ANIMATED_PROPERTIES | |
| 81 | 76 |
| 82 SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Docum
ent& document) | 77 SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Docum
ent& document) |
| 83 : SVGGraphicsElement(tagName, document) | 78 : SVGGraphicsElement(tagName, document) |
| 84 , m_textLength(SVGAnimatedTextLength::create(this)) | 79 , m_textLength(SVGAnimatedTextLength::create(this)) |
| 85 , m_textLengthIsSpecifiedByUser(false) | 80 , m_textLengthIsSpecifiedByUser(false) |
| 86 , m_lengthAdjust(SVGAnimatedEnumeration<SVGLengthAdjustType>::create(this, S
VGNames::lengthAdjustAttr, SVGLengthAdjustSpacing)) | 81 , m_lengthAdjust(SVGAnimatedEnumeration<SVGLengthAdjustType>::create(this, S
VGNames::lengthAdjustAttr, SVGLengthAdjustSpacing)) |
| 87 { | 82 { |
| 88 ScriptWrappable::init(this); | 83 ScriptWrappable::init(this); |
| 89 | 84 |
| 90 addToPropertyMap(m_textLength); | 85 addToPropertyMap(m_textLength); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 SVGElement* element = toSVGElement(renderer->node()); | 281 SVGElement* element = toSVGElement(renderer->node()); |
| 287 ASSERT(element); | 282 ASSERT(element); |
| 288 | 283 |
| 289 if (!element->isTextContent()) | 284 if (!element->isTextContent()) |
| 290 return 0; | 285 return 0; |
| 291 | 286 |
| 292 return toSVGTextContentElement(element); | 287 return toSVGTextContentElement(element); |
| 293 } | 288 } |
| 294 | 289 |
| 295 } | 290 } |
| OLD | NEW |