OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2007 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 14 matching lines...) Expand all Loading... |
25 namespace WebCore { | 25 namespace WebCore { |
26 | 26 |
27 // Animated property definitions | 27 // Animated property definitions |
28 | 28 |
29 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGViewElement) | 29 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGViewElement) |
30 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) | 30 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) |
31 END_REGISTER_ANIMATED_PROPERTIES | 31 END_REGISTER_ANIMATED_PROPERTIES |
32 | 32 |
33 inline SVGViewElement::SVGViewElement(Document& document) | 33 inline SVGViewElement::SVGViewElement(Document& document) |
34 : SVGElement(SVGNames::viewTag, document) | 34 : SVGElement(SVGNames::viewTag, document) |
35 , m_viewBox(SVGAnimatedRect::create(this, SVGNames::viewBoxAttr)) | 35 , SVGFitToViewBox(this) |
36 , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(this, SVGName
s::preserveAspectRatioAttr, SVGPreserveAspectRatio::create())) | |
37 , m_viewTarget(SVGStaticStringList::create(this, SVGNames::viewTargetAttr)) | 36 , m_viewTarget(SVGStaticStringList::create(this, SVGNames::viewTargetAttr)) |
38 { | 37 { |
39 ScriptWrappable::init(this); | 38 ScriptWrappable::init(this); |
40 | 39 |
41 addToPropertyMap(m_viewBox); | |
42 addToPropertyMap(m_preserveAspectRatio); | |
43 addToPropertyMap(m_viewTarget); | 40 addToPropertyMap(m_viewTarget); |
44 registerAnimatedPropertiesForSVGViewElement(); | 41 registerAnimatedPropertiesForSVGViewElement(); |
45 } | 42 } |
46 | 43 |
47 PassRefPtr<SVGViewElement> SVGViewElement::create(Document& document) | 44 PassRefPtr<SVGViewElement> SVGViewElement::create(Document& document) |
48 { | 45 { |
49 return adoptRef(new SVGViewElement(document)); | 46 return adoptRef(new SVGViewElement(document)); |
50 } | 47 } |
51 | 48 |
52 bool SVGViewElement::isSupportedAttribute(const QualifiedName& attrName) | 49 bool SVGViewElement::isSupportedAttribute(const QualifiedName& attrName) |
53 { | 50 { |
54 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 51 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
55 if (supportedAttributes.isEmpty()) { | 52 if (supportedAttributes.isEmpty()) { |
56 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); | 53 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); |
57 SVGZoomAndPan::addSupportedAttributes(supportedAttributes); | 54 SVGZoomAndPan::addSupportedAttributes(supportedAttributes); |
58 supportedAttributes.add(SVGNames::viewTargetAttr); | 55 supportedAttributes.add(SVGNames::viewTargetAttr); |
59 } | 56 } |
60 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 57 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
61 } | 58 } |
62 | 59 |
63 void SVGViewElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 60 void SVGViewElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& 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)) | |
71 return; | |
72 if (SVGZoomAndPan::parseAttribute(name, value)) | |
73 return; | |
74 | |
75 SVGParsingError parseError = NoError; | 67 SVGParsingError parseError = NoError; |
76 | 68 |
77 if (name == SVGNames::viewTargetAttr) | 69 if (SVGFitToViewBox::parseAttribute(name, value, document(), parseError)) { |
| 70 } else if (SVGZoomAndPan::parseAttribute(name, value)) { |
| 71 } else if (name == SVGNames::viewTargetAttr) { |
78 m_viewTarget->setBaseValueAsString(value, parseError); | 72 m_viewTarget->setBaseValueAsString(value, parseError); |
79 else | 73 } else { |
80 ASSERT_NOT_REACHED(); | 74 ASSERT_NOT_REACHED(); |
| 75 } |
81 | 76 |
82 reportAttributeParsingError(parseError, name, value); | 77 reportAttributeParsingError(parseError, name, value); |
83 } | 78 } |
84 | 79 |
85 } | 80 } |
OLD | NEW |