1 /*
2 Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
3 2004, 2005, 2006 Rob Buis <buis@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
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
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19 */
20
21 #include "config.h"
22 #if ENABLE(SVG)
23 #include "SVGSymbolElement.h"
24
25 #include "PlatformString.h"
26 #include "SVGFitToViewBox.h"
27
28 namespace WebCore {
29
SVGSymbolElement(const QualifiedName & tagName,Document * doc)30 SVGSymbolElement::SVGSymbolElement(const QualifiedName& tagName, Document* doc)
31 : SVGStyledElement(tagName, doc)
32 , SVGLangSpace()
33 , SVGExternalResourcesRequired()
34 , SVGFitToViewBox()
35 {
36 }
37
~SVGSymbolElement()38 SVGSymbolElement::~SVGSymbolElement()
39 {
40 }
41
parseMappedAttribute(MappedAttribute * attr)42 void SVGSymbolElement::parseMappedAttribute(MappedAttribute* attr)
43 {
44 if (SVGLangSpace::parseMappedAttribute(attr))
45 return;
46 if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
47 return;
48 if (SVGFitToViewBox::parseMappedAttribute(document(), attr))
49 return;
50
51 SVGStyledElement::parseMappedAttribute(attr);
52 }
53
synchronizeProperty(const QualifiedName & attrName)54 void SVGSymbolElement::synchronizeProperty(const QualifiedName& attrName)
55 {
56 SVGStyledElement::synchronizeProperty(attrName);
57
58 if (attrName == anyQName()) {
59 synchronizePreserveAspectRatio();
60 synchronizeViewBox();
61 synchronizeExternalResourcesRequired();
62 synchronizeViewBox();
63 synchronizePreserveAspectRatio();
64 return;
65 }
66
67 if (attrName == SVGNames::preserveAspectRatioAttr)
68 synchronizePreserveAspectRatio();
69 else if (attrName == SVGNames::viewBoxAttr)
70 synchronizeViewBox();
71 else if (SVGExternalResourcesRequired::isKnownAttribute(attrName))
72 synchronizeExternalResourcesRequired();
73 else if (SVGFitToViewBox::isKnownAttribute(attrName)) {
74 synchronizeViewBox();
75 synchronizePreserveAspectRatio();
76 }
77 }
78
79 }
80
81 #endif // ENABLE(SVG)
82