OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "XLinkNames.h" | 25 #include "XLinkNames.h" |
26 #include "core/dom/Document.h" | 26 #include "core/dom/Document.h" |
27 #include "core/svg/SVGAnimateMotionElement.h" | 27 #include "core/svg/SVGAnimateMotionElement.h" |
28 #include "core/svg/SVGDocumentExtensions.h" | 28 #include "core/svg/SVGDocumentExtensions.h" |
29 #include "core/svg/SVGPathElement.h" | 29 #include "core/svg/SVGPathElement.h" |
30 | 30 |
31 namespace WebCore { | 31 namespace WebCore { |
32 | 32 |
33 // Animated property definitions | 33 // Animated property definitions |
34 DEFINE_ANIMATED_STRING(SVGMPathElement, XLinkNames::hrefAttr, Href, href) | 34 DEFINE_ANIMATED_STRING(SVGMPathElement, XLinkNames::hrefAttr, Href, href) |
35 DEFINE_ANIMATED_BOOLEAN(SVGMPathElement, SVGNames::externalResourcesRequiredAttr
, ExternalResourcesRequired, externalResourcesRequired) | |
36 | 35 |
37 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMPathElement) | 36 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMPathElement) |
38 REGISTER_LOCAL_ANIMATED_PROPERTY(href) | 37 REGISTER_LOCAL_ANIMATED_PROPERTY(href) |
39 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
40 END_REGISTER_ANIMATED_PROPERTIES | 38 END_REGISTER_ANIMATED_PROPERTIES |
41 | 39 |
42 inline SVGMPathElement::SVGMPathElement(const QualifiedName& tagName, Document&
document) | 40 inline SVGMPathElement::SVGMPathElement(const QualifiedName& tagName, Document&
document) |
43 : SVGElement(tagName, document) | 41 : SVGElement(tagName, document) |
44 { | 42 { |
45 ASSERT(hasTagName(SVGNames::mpathTag)); | 43 ASSERT(hasTagName(SVGNames::mpathTag)); |
46 ScriptWrappable::init(this); | 44 ScriptWrappable::init(this); |
47 registerAnimatedPropertiesForSVGMPathElement(); | 45 registerAnimatedPropertiesForSVGMPathElement(); |
48 } | 46 } |
49 | 47 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 notifyParentOfPathChange(rootParent); | 100 notifyParentOfPathChange(rootParent); |
103 if (rootParent->inDocument()) | 101 if (rootParent->inDocument()) |
104 clearResourceReferences(); | 102 clearResourceReferences(); |
105 } | 103 } |
106 | 104 |
107 bool SVGMPathElement::isSupportedAttribute(const QualifiedName& attrName) | 105 bool SVGMPathElement::isSupportedAttribute(const QualifiedName& attrName) |
108 { | 106 { |
109 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 107 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
110 if (supportedAttributes.isEmpty()) { | 108 if (supportedAttributes.isEmpty()) { |
111 SVGURIReference::addSupportedAttributes(supportedAttributes); | 109 SVGURIReference::addSupportedAttributes(supportedAttributes); |
112 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | |
113 } | 110 } |
114 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 111 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
115 } | 112 } |
116 | 113 |
117 void SVGMPathElement::parseAttribute(const QualifiedName& name, const AtomicStri
ng& value) | 114 void SVGMPathElement::parseAttribute(const QualifiedName& name, const AtomicStri
ng& value) |
118 { | 115 { |
119 if (!isSupportedAttribute(name)) { | 116 if (!isSupportedAttribute(name)) { |
120 SVGElement::parseAttribute(name, value); | 117 SVGElement::parseAttribute(name, value); |
121 return; | 118 return; |
122 } | 119 } |
123 | 120 |
124 if (SVGURIReference::parseAttribute(name, value)) | 121 if (SVGURIReference::parseAttribute(name, value)) |
125 return; | 122 return; |
126 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | |
127 return; | |
128 | 123 |
129 ASSERT_NOT_REACHED(); | 124 ASSERT_NOT_REACHED(); |
130 } | 125 } |
131 | 126 |
132 void SVGMPathElement::svgAttributeChanged(const QualifiedName& attrName) | 127 void SVGMPathElement::svgAttributeChanged(const QualifiedName& attrName) |
133 { | 128 { |
134 if (!isSupportedAttribute(attrName)) { | 129 if (!isSupportedAttribute(attrName)) { |
135 SVGElement::svgAttributeChanged(attrName); | 130 SVGElement::svgAttributeChanged(attrName); |
136 return; | 131 return; |
137 } | 132 } |
138 | 133 |
139 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 134 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
140 | 135 |
141 if (SVGURIReference::isKnownAttribute(attrName)) { | 136 if (SVGURIReference::isKnownAttribute(attrName)) { |
142 buildPendingResource(); | 137 buildPendingResource(); |
143 return; | 138 return; |
144 } | 139 } |
145 | 140 |
146 if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) | |
147 return; | |
148 | |
149 ASSERT_NOT_REACHED(); | 141 ASSERT_NOT_REACHED(); |
150 } | 142 } |
151 | 143 |
152 SVGPathElement* SVGMPathElement::pathElement() | 144 SVGPathElement* SVGMPathElement::pathElement() |
153 { | 145 { |
154 Element* target = targetElementFromIRIString(hrefCurrentValue(), document())
; | 146 Element* target = targetElementFromIRIString(hrefCurrentValue(), document())
; |
155 if (target && target->hasTagName(SVGNames::pathTag)) | 147 if (target && target->hasTagName(SVGNames::pathTag)) |
156 return toSVGPathElement(target); | 148 return toSVGPathElement(target); |
157 return 0; | 149 return 0; |
158 } | 150 } |
159 | 151 |
160 void SVGMPathElement::targetPathChanged() | 152 void SVGMPathElement::targetPathChanged() |
161 { | 153 { |
162 notifyParentOfPathChange(parentNode()); | 154 notifyParentOfPathChange(parentNode()); |
163 } | 155 } |
164 | 156 |
165 void SVGMPathElement::notifyParentOfPathChange(ContainerNode* parent) | 157 void SVGMPathElement::notifyParentOfPathChange(ContainerNode* parent) |
166 { | 158 { |
167 if (parent && parent->hasTagName(SVGNames::animateMotionTag)) | 159 if (parent && parent->hasTagName(SVGNames::animateMotionTag)) |
168 static_cast<SVGAnimateMotionElement*>(parent)->updateAnimationPath(); | 160 static_cast<SVGAnimateMotionElement*>(parent)->updateAnimationPath(); |
169 } | 161 } |
170 | 162 |
171 } // namespace WebCore | 163 } // namespace WebCore |
OLD | NEW |