OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005 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 * | 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 18 matching lines...) Expand all Loading... |
29 namespace WebCore { | 29 namespace WebCore { |
30 | 30 |
31 // Animated property definitions | 31 // Animated property definitions |
32 | 32 |
33 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSymbolElement) | 33 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSymbolElement) |
34 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) | 34 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) |
35 END_REGISTER_ANIMATED_PROPERTIES | 35 END_REGISTER_ANIMATED_PROPERTIES |
36 | 36 |
37 inline SVGSymbolElement::SVGSymbolElement(Document& document) | 37 inline SVGSymbolElement::SVGSymbolElement(Document& document) |
38 : SVGElement(SVGNames::symbolTag, document) | 38 : SVGElement(SVGNames::symbolTag, document) |
39 , m_viewBox(SVGAnimatedRect::create(this, SVGNames::viewBoxAttr)) | 39 , SVGFitToViewBox(this) |
40 , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(this, SVGName
s::preserveAspectRatioAttr, SVGPreserveAspectRatio::create())) | |
41 { | 40 { |
42 ScriptWrappable::init(this); | 41 ScriptWrappable::init(this); |
43 | 42 |
44 addToPropertyMap(m_viewBox); | |
45 addToPropertyMap(m_preserveAspectRatio); | |
46 registerAnimatedPropertiesForSVGSymbolElement(); | 43 registerAnimatedPropertiesForSVGSymbolElement(); |
47 } | 44 } |
48 | 45 |
49 PassRefPtr<SVGSymbolElement> SVGSymbolElement::create(Document& document) | 46 PassRefPtr<SVGSymbolElement> SVGSymbolElement::create(Document& document) |
50 { | 47 { |
51 return adoptRef(new SVGSymbolElement(document)); | 48 return adoptRef(new SVGSymbolElement(document)); |
52 } | 49 } |
53 | 50 |
54 bool SVGSymbolElement::isSupportedAttribute(const QualifiedName& attrName) | 51 bool SVGSymbolElement::isSupportedAttribute(const QualifiedName& attrName) |
55 { | 52 { |
56 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 53 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
57 if (supportedAttributes.isEmpty()) | 54 if (supportedAttributes.isEmpty()) |
58 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); | 55 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); |
59 | 56 |
60 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 57 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
61 } | 58 } |
62 | 59 |
63 void SVGSymbolElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 60 void SVGSymbolElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
64 { | 61 { |
65 if (!isSupportedAttribute(name)) { | 62 if (!isSupportedAttribute(name)) { |
66 SVGElement::parseAttribute(name, value); | 63 SVGElement::parseAttribute(name, value); |
67 return; | 64 return; |
68 } | 65 } |
69 | 66 |
70 if (SVGFitToViewBox::parseAttribute(this, name, value)) | 67 SVGParsingError parseError = NoError; |
71 return; | 68 if (SVGFitToViewBox::parseAttribute(name, value, document(), parseError)) { |
| 69 } else { |
| 70 ASSERT_NOT_REACHED(); |
| 71 } |
72 | 72 |
73 ASSERT_NOT_REACHED(); | 73 reportAttributeParsingError(parseError, name, value); |
74 } | 74 } |
75 | 75 |
76 void SVGSymbolElement::svgAttributeChanged(const QualifiedName& attrName) | 76 void SVGSymbolElement::svgAttributeChanged(const QualifiedName& attrName) |
77 { | 77 { |
78 if (!isSupportedAttribute(attrName)) { | 78 if (!isSupportedAttribute(attrName)) { |
79 SVGElement::svgAttributeChanged(attrName); | 79 SVGElement::svgAttributeChanged(attrName); |
80 return; | 80 return; |
81 } | 81 } |
82 | 82 |
83 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 83 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
84 | 84 |
85 // Every other property change is ignored. | 85 // Every other property change is ignored. |
86 if (attrName == SVGNames::viewBoxAttr) | 86 if (attrName == SVGNames::viewBoxAttr) |
87 updateRelativeLengthsInformation(); | 87 updateRelativeLengthsInformation(); |
88 } | 88 } |
89 | 89 |
90 bool SVGSymbolElement::selfHasRelativeLengths() const | 90 bool SVGSymbolElement::selfHasRelativeLengths() const |
91 { | 91 { |
92 return hasAttribute(SVGNames::viewBoxAttr); | 92 return hasAttribute(SVGNames::viewBoxAttr); |
93 } | 93 } |
94 | 94 |
95 RenderObject* SVGSymbolElement::createRenderer(RenderStyle*) | 95 RenderObject* SVGSymbolElement::createRenderer(RenderStyle*) |
96 { | 96 { |
97 return new RenderSVGHiddenContainer(this); | 97 return new RenderSVGHiddenContainer(this); |
98 } | 98 } |
99 | 99 |
100 } | 100 } |
OLD | NEW |