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, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
19 */ | 19 */ |
20 | 20 |
21 #include "config.h" | 21 #include "config.h" |
22 | 22 |
23 #include "core/svg/SVGViewElement.h" | 23 #include "core/svg/SVGViewElement.h" |
24 | 24 |
25 | 25 |
26 namespace WebCore { | 26 namespace WebCore { |
27 | 27 |
28 // Animated property definitions | 28 // Animated property definitions |
29 DEFINE_ANIMATED_BOOLEAN(SVGViewElement, SVGNames::externalResourcesRequiredAttr,
ExternalResourcesRequired, externalResourcesRequired) | |
30 DEFINE_ANIMATED_RECT(SVGViewElement, SVGNames::viewBoxAttr, ViewBox, viewBox) | 29 DEFINE_ANIMATED_RECT(SVGViewElement, SVGNames::viewBoxAttr, ViewBox, viewBox) |
31 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGViewElement, SVGNames::preserveAspectRati
oAttr, PreserveAspectRatio, preserveAspectRatio) | 30 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGViewElement, SVGNames::preserveAspectRati
oAttr, PreserveAspectRatio, preserveAspectRatio) |
32 | 31 |
33 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGViewElement) | 32 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGViewElement) |
34 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
35 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox) | 33 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox) |
36 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) | 34 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) |
37 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) | 35 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) |
38 END_REGISTER_ANIMATED_PROPERTIES | 36 END_REGISTER_ANIMATED_PROPERTIES |
39 | 37 |
40 inline SVGViewElement::SVGViewElement(Document& document) | 38 inline SVGViewElement::SVGViewElement(Document& document) |
41 : SVGElement(SVGNames::viewTag, document) | 39 : SVGElement(SVGNames::viewTag, document) |
42 , m_zoomAndPan(SVGZoomAndPanMagnify) | 40 , m_zoomAndPan(SVGZoomAndPanMagnify) |
43 , m_viewTarget(SVGNames::viewTargetAttr) | 41 , m_viewTarget(SVGNames::viewTargetAttr) |
44 { | 42 { |
45 ScriptWrappable::init(this); | 43 ScriptWrappable::init(this); |
46 registerAnimatedPropertiesForSVGViewElement(); | 44 registerAnimatedPropertiesForSVGViewElement(); |
47 } | 45 } |
48 | 46 |
49 PassRefPtr<SVGViewElement> SVGViewElement::create(Document& document) | 47 PassRefPtr<SVGViewElement> SVGViewElement::create(Document& document) |
50 { | 48 { |
51 return adoptRef(new SVGViewElement(document)); | 49 return adoptRef(new SVGViewElement(document)); |
52 } | 50 } |
53 | 51 |
54 bool SVGViewElement::isSupportedAttribute(const QualifiedName& attrName) | 52 bool SVGViewElement::isSupportedAttribute(const QualifiedName& attrName) |
55 { | 53 { |
56 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 54 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
57 if (supportedAttributes.isEmpty()) { | 55 if (supportedAttributes.isEmpty()) { |
58 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | |
59 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); | 56 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); |
60 SVGZoomAndPan::addSupportedAttributes(supportedAttributes); | 57 SVGZoomAndPan::addSupportedAttributes(supportedAttributes); |
61 supportedAttributes.add(SVGNames::viewTargetAttr); | 58 supportedAttributes.add(SVGNames::viewTargetAttr); |
62 } | 59 } |
63 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 60 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
64 } | 61 } |
65 | 62 |
66 void SVGViewElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 63 void SVGViewElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
67 { | 64 { |
68 if (!isSupportedAttribute(name)) { | 65 if (!isSupportedAttribute(name)) { |
69 SVGElement::parseAttribute(name, value); | 66 SVGElement::parseAttribute(name, value); |
70 return; | 67 return; |
71 } | 68 } |
72 | 69 |
73 if (name == SVGNames::viewTargetAttr) { | 70 if (name == SVGNames::viewTargetAttr) { |
74 viewTarget().reset(value); | 71 viewTarget().reset(value); |
75 return; | 72 return; |
76 } | 73 } |
77 | 74 |
78 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | |
79 return; | |
80 if (SVGFitToViewBox::parseAttribute(this, name, value)) | 75 if (SVGFitToViewBox::parseAttribute(this, name, value)) |
81 return; | 76 return; |
82 if (SVGZoomAndPan::parseAttribute(this, name, value)) | 77 if (SVGZoomAndPan::parseAttribute(this, name, value)) |
83 return; | 78 return; |
84 | 79 |
85 ASSERT_NOT_REACHED(); | 80 ASSERT_NOT_REACHED(); |
86 } | 81 } |
87 | 82 |
88 } | 83 } |
OLD | NEW |