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 , m_zoomAndPan(SVGZoomAndPanMagnify) | 37 , m_zoomAndPan(SVGZoomAndPanMagnify) |
39 { | 38 { |
40 ScriptWrappable::init(this); | 39 ScriptWrappable::init(this); |
41 | 40 |
42 addToPropertyMap(m_viewBox); | |
43 addToPropertyMap(m_preserveAspectRatio); | |
44 addToPropertyMap(m_viewTarget); | 41 addToPropertyMap(m_viewTarget); |
45 registerAnimatedPropertiesForSVGViewElement(); | 42 registerAnimatedPropertiesForSVGViewElement(); |
46 } | 43 } |
47 | 44 |
48 PassRefPtr<SVGViewElement> SVGViewElement::create(Document& document) | 45 PassRefPtr<SVGViewElement> SVGViewElement::create(Document& document) |
49 { | 46 { |
50 return adoptRef(new SVGViewElement(document)); | 47 return adoptRef(new SVGViewElement(document)); |
51 } | 48 } |
52 | 49 |
53 bool SVGViewElement::isSupportedAttribute(const QualifiedName& attrName) | 50 bool SVGViewElement::isSupportedAttribute(const QualifiedName& attrName) |
54 { | 51 { |
55 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 52 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
56 if (supportedAttributes.isEmpty()) { | 53 if (supportedAttributes.isEmpty()) { |
57 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); | 54 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); |
58 SVGZoomAndPan::addSupportedAttributes(supportedAttributes); | 55 SVGZoomAndPan::addSupportedAttributes(supportedAttributes); |
59 supportedAttributes.add(SVGNames::viewTargetAttr); | 56 supportedAttributes.add(SVGNames::viewTargetAttr); |
60 } | 57 } |
61 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 58 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
62 } | 59 } |
63 | 60 |
64 void SVGViewElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 61 void SVGViewElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
65 { | 62 { |
66 if (!isSupportedAttribute(name)) { | 63 if (!isSupportedAttribute(name)) { |
67 SVGElement::parseAttribute(name, value); | 64 SVGElement::parseAttribute(name, value); |
68 return; | 65 return; |
69 } | 66 } |
70 | 67 |
71 if (SVGFitToViewBox::parseAttribute(this, name, value)) | |
72 return; | |
73 if (SVGZoomAndPan::parseAttribute(this, name, value)) | |
74 return; | |
75 | |
76 SVGParsingError parseError = NoError; | 68 SVGParsingError parseError = NoError; |
77 | 69 |
78 if (name == SVGNames::viewTargetAttr) | 70 if (SVGFitToViewBox::parseAttribute(name, value, document(), parseError)) { |
| 71 } else if (SVGZoomAndPan::parseAttribute(this, name, value)) { |
| 72 } else if (name == SVGNames::viewTargetAttr) { |
79 m_viewTarget->setBaseValueAsString(value, parseError); | 73 m_viewTarget->setBaseValueAsString(value, parseError); |
80 else | 74 } else { |
81 ASSERT_NOT_REACHED(); | 75 ASSERT_NOT_REACHED(); |
| 76 } |
82 | 77 |
83 reportAttributeParsingError(parseError, name, value); | 78 reportAttributeParsingError(parseError, name, value); |
84 } | 79 } |
85 | 80 |
86 } | 81 } |
OLD | NEW |