|
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 |
|
30 SVGSymbolElement::SVGSymbolElement(const QualifiedName& tagName, Document* doc) |
|
31 : SVGStyledElement(tagName, doc) |
|
32 , SVGLangSpace() |
|
33 , SVGExternalResourcesRequired() |
|
34 , SVGFitToViewBox() |
|
35 { |
|
36 } |
|
37 |
|
38 SVGSymbolElement::~SVGSymbolElement() |
|
39 { |
|
40 } |
|
41 |
|
42 void SVGSymbolElement::parseMappedAttribute(Attribute* 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 |
|
54 void SVGSymbolElement::svgAttributeChanged(const QualifiedName& attrName) |
|
55 { |
|
56 SVGStyledElement::svgAttributeChanged(attrName); |
|
57 |
|
58 if (attrName == SVGNames::viewBoxAttr) |
|
59 updateRelativeLengthsInformation(); |
|
60 } |
|
61 |
|
62 void SVGSymbolElement::synchronizeProperty(const QualifiedName& attrName) |
|
63 { |
|
64 SVGStyledElement::synchronizeProperty(attrName); |
|
65 |
|
66 if (attrName == anyQName()) { |
|
67 synchronizePreserveAspectRatio(); |
|
68 synchronizeViewBox(); |
|
69 synchronizeExternalResourcesRequired(); |
|
70 synchronizeViewBox(); |
|
71 synchronizePreserveAspectRatio(); |
|
72 return; |
|
73 } |
|
74 |
|
75 if (attrName == SVGNames::preserveAspectRatioAttr) |
|
76 synchronizePreserveAspectRatio(); |
|
77 else if (attrName == SVGNames::viewBoxAttr) |
|
78 synchronizeViewBox(); |
|
79 else if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) |
|
80 synchronizeExternalResourcesRequired(); |
|
81 else if (SVGFitToViewBox::isKnownAttribute(attrName)) { |
|
82 synchronizeViewBox(); |
|
83 synchronizePreserveAspectRatio(); |
|
84 } |
|
85 } |
|
86 |
|
87 bool SVGSymbolElement::selfHasRelativeLengths() const |
|
88 { |
|
89 return hasAttribute(SVGNames::viewBoxAttr); |
|
90 } |
|
91 |
|
92 } |
|
93 |
|
94 #endif // ENABLE(SVG) |