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 13 matching lines...) Expand all Loading... |
24 #include "XLinkNames.h" | 24 #include "XLinkNames.h" |
25 #include "core/dom/Document.h" | 25 #include "core/dom/Document.h" |
26 #include "core/svg/SVGAnimateMotionElement.h" | 26 #include "core/svg/SVGAnimateMotionElement.h" |
27 #include "core/svg/SVGDocumentExtensions.h" | 27 #include "core/svg/SVGDocumentExtensions.h" |
28 #include "core/svg/SVGPathElement.h" | 28 #include "core/svg/SVGPathElement.h" |
29 | 29 |
30 namespace WebCore { | 30 namespace WebCore { |
31 | 31 |
32 // Animated property definitions | 32 // Animated property definitions |
33 DEFINE_ANIMATED_STRING(SVGMPathElement, XLinkNames::hrefAttr, Href, href) | 33 DEFINE_ANIMATED_STRING(SVGMPathElement, XLinkNames::hrefAttr, Href, href) |
34 DEFINE_ANIMATED_BOOLEAN(SVGMPathElement, SVGNames::externalResourcesRequiredAttr
, ExternalResourcesRequired, externalResourcesRequired) | |
35 | 34 |
36 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMPathElement) | 35 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMPathElement) |
37 REGISTER_LOCAL_ANIMATED_PROPERTY(href) | 36 REGISTER_LOCAL_ANIMATED_PROPERTY(href) |
38 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
39 END_REGISTER_ANIMATED_PROPERTIES | 37 END_REGISTER_ANIMATED_PROPERTIES |
40 | 38 |
41 inline SVGMPathElement::SVGMPathElement(Document& document) | 39 inline SVGMPathElement::SVGMPathElement(Document& document) |
42 : SVGElement(SVGNames::mpathTag, document) | 40 : SVGElement(SVGNames::mpathTag, document) |
43 { | 41 { |
44 ScriptWrappable::init(this); | 42 ScriptWrappable::init(this); |
45 registerAnimatedPropertiesForSVGMPathElement(); | 43 registerAnimatedPropertiesForSVGMPathElement(); |
46 } | 44 } |
47 | 45 |
48 PassRefPtr<SVGMPathElement> SVGMPathElement::create(Document& document) | 46 PassRefPtr<SVGMPathElement> SVGMPathElement::create(Document& document) |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 notifyParentOfPathChange(rootParent); | 98 notifyParentOfPathChange(rootParent); |
101 if (rootParent->inDocument()) | 99 if (rootParent->inDocument()) |
102 clearResourceReferences(); | 100 clearResourceReferences(); |
103 } | 101 } |
104 | 102 |
105 bool SVGMPathElement::isSupportedAttribute(const QualifiedName& attrName) | 103 bool SVGMPathElement::isSupportedAttribute(const QualifiedName& attrName) |
106 { | 104 { |
107 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 105 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
108 if (supportedAttributes.isEmpty()) { | 106 if (supportedAttributes.isEmpty()) { |
109 SVGURIReference::addSupportedAttributes(supportedAttributes); | 107 SVGURIReference::addSupportedAttributes(supportedAttributes); |
110 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | |
111 } | 108 } |
112 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 109 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
113 } | 110 } |
114 | 111 |
115 void SVGMPathElement::parseAttribute(const QualifiedName& name, const AtomicStri
ng& value) | 112 void SVGMPathElement::parseAttribute(const QualifiedName& name, const AtomicStri
ng& value) |
116 { | 113 { |
117 if (!isSupportedAttribute(name)) { | 114 if (!isSupportedAttribute(name)) { |
118 SVGElement::parseAttribute(name, value); | 115 SVGElement::parseAttribute(name, value); |
119 return; | 116 return; |
120 } | 117 } |
121 | 118 |
122 if (SVGURIReference::parseAttribute(name, value)) | 119 if (SVGURIReference::parseAttribute(name, value)) |
123 return; | 120 return; |
124 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | |
125 return; | |
126 | 121 |
127 ASSERT_NOT_REACHED(); | 122 ASSERT_NOT_REACHED(); |
128 } | 123 } |
129 | 124 |
130 void SVGMPathElement::svgAttributeChanged(const QualifiedName& attrName) | 125 void SVGMPathElement::svgAttributeChanged(const QualifiedName& attrName) |
131 { | 126 { |
132 if (!isSupportedAttribute(attrName)) { | 127 if (!isSupportedAttribute(attrName)) { |
133 SVGElement::svgAttributeChanged(attrName); | 128 SVGElement::svgAttributeChanged(attrName); |
134 return; | 129 return; |
135 } | 130 } |
136 | 131 |
137 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 132 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
138 | 133 |
139 if (SVGURIReference::isKnownAttribute(attrName)) { | 134 if (SVGURIReference::isKnownAttribute(attrName)) { |
140 buildPendingResource(); | 135 buildPendingResource(); |
141 return; | 136 return; |
142 } | 137 } |
143 | 138 |
144 if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) | |
145 return; | |
146 | |
147 ASSERT_NOT_REACHED(); | 139 ASSERT_NOT_REACHED(); |
148 } | 140 } |
149 | 141 |
150 SVGPathElement* SVGMPathElement::pathElement() | 142 SVGPathElement* SVGMPathElement::pathElement() |
151 { | 143 { |
152 Element* target = targetElementFromIRIString(hrefCurrentValue(), document())
; | 144 Element* target = targetElementFromIRIString(hrefCurrentValue(), document())
; |
153 if (target && target->hasTagName(SVGNames::pathTag)) | 145 if (target && target->hasTagName(SVGNames::pathTag)) |
154 return toSVGPathElement(target); | 146 return toSVGPathElement(target); |
155 return 0; | 147 return 0; |
156 } | 148 } |
157 | 149 |
158 void SVGMPathElement::targetPathChanged() | 150 void SVGMPathElement::targetPathChanged() |
159 { | 151 { |
160 notifyParentOfPathChange(parentNode()); | 152 notifyParentOfPathChange(parentNode()); |
161 } | 153 } |
162 | 154 |
163 void SVGMPathElement::notifyParentOfPathChange(ContainerNode* parent) | 155 void SVGMPathElement::notifyParentOfPathChange(ContainerNode* parent) |
164 { | 156 { |
165 if (parent && parent->hasTagName(SVGNames::animateMotionTag)) | 157 if (parent && parent->hasTagName(SVGNames::animateMotionTag)) |
166 static_cast<SVGAnimateMotionElement*>(parent)->updateAnimationPath(); | 158 static_cast<SVGAnimateMotionElement*>(parent)->updateAnimationPath(); |
167 } | 159 } |
168 | 160 |
169 } // namespace WebCore | 161 } // namespace WebCore |
OLD | NEW |