OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2010 Rob Buis <rwlbuis@gmail.com> | 3 * Copyright (C) 2010 Rob Buis <rwlbuis@gmail.com> |
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, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return adoptRef(new SVGTextPathElement(document)); | 77 return adoptRef(new SVGTextPathElement(document)); |
78 } | 78 } |
79 | 79 |
80 SVGTextPathElement::~SVGTextPathElement() | 80 SVGTextPathElement::~SVGTextPathElement() |
81 { | 81 { |
82 clearResourceReferences(); | 82 clearResourceReferences(); |
83 } | 83 } |
84 | 84 |
85 void SVGTextPathElement::clearResourceReferences() | 85 void SVGTextPathElement::clearResourceReferences() |
86 { | 86 { |
87 document().accessSVGExtensions()->removeAllTargetReferencesForElement(this); | 87 document().accessSVGExtensions().removeAllTargetReferencesForElement(this); |
88 } | 88 } |
89 | 89 |
90 bool SVGTextPathElement::isSupportedAttribute(const QualifiedName& attrName) | 90 bool SVGTextPathElement::isSupportedAttribute(const QualifiedName& attrName) |
91 { | 91 { |
92 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 92 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
93 if (supportedAttributes.isEmpty()) { | 93 if (supportedAttributes.isEmpty()) { |
94 SVGURIReference::addSupportedAttributes(supportedAttributes); | 94 SVGURIReference::addSupportedAttributes(supportedAttributes); |
95 supportedAttributes.add(SVGNames::startOffsetAttr); | 95 supportedAttributes.add(SVGNames::startOffsetAttr); |
96 supportedAttributes.add(SVGNames::methodAttr); | 96 supportedAttributes.add(SVGNames::methodAttr); |
97 supportedAttributes.add(SVGNames::spacingAttr); | 97 supportedAttributes.add(SVGNames::spacingAttr); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 void SVGTextPathElement::buildPendingResource() | 157 void SVGTextPathElement::buildPendingResource() |
158 { | 158 { |
159 clearResourceReferences(); | 159 clearResourceReferences(); |
160 if (!inDocument()) | 160 if (!inDocument()) |
161 return; | 161 return; |
162 | 162 |
163 AtomicString id; | 163 AtomicString id; |
164 Element* target = SVGURIReference::targetElementFromIRIString(hrefString(),
document(), &id); | 164 Element* target = SVGURIReference::targetElementFromIRIString(hrefString(),
document(), &id); |
165 if (!target) { | 165 if (!target) { |
166 // Do not register as pending if we are already pending this resource. | 166 // Do not register as pending if we are already pending this resource. |
167 if (document().accessSVGExtensions()->isElementPendingResource(this, id)
) | 167 if (document().accessSVGExtensions().isElementPendingResource(this, id)) |
168 return; | 168 return; |
169 | 169 |
170 if (!id.isEmpty()) { | 170 if (!id.isEmpty()) { |
171 document().accessSVGExtensions()->addPendingResource(id, this); | 171 document().accessSVGExtensions().addPendingResource(id, this); |
172 ASSERT(hasPendingResources()); | 172 ASSERT(hasPendingResources()); |
173 } | 173 } |
174 } else if (target->hasTagName(SVGNames::pathTag)) { | 174 } else if (target->hasTagName(SVGNames::pathTag)) { |
175 // Register us with the target in the dependencies map. Any change of hr
efElement | 175 // Register us with the target in the dependencies map. Any change of hr
efElement |
176 // that leads to relayout/repainting now informs us, so we can react to
it. | 176 // that leads to relayout/repainting now informs us, so we can react to
it. |
177 document().accessSVGExtensions()->addElementReferencingTarget(this, toSV
GElement(target)); | 177 document().accessSVGExtensions().addElementReferencingTarget(this, toSVG
Element(target)); |
178 } | 178 } |
179 } | 179 } |
180 | 180 |
181 Node::InsertionNotificationRequest SVGTextPathElement::insertedInto(ContainerNod
e* rootParent) | 181 Node::InsertionNotificationRequest SVGTextPathElement::insertedInto(ContainerNod
e* rootParent) |
182 { | 182 { |
183 SVGTextContentElement::insertedInto(rootParent); | 183 SVGTextContentElement::insertedInto(rootParent); |
184 buildPendingResource(); | 184 buildPendingResource(); |
185 return InsertionDone; | 185 return InsertionDone; |
186 } | 186 } |
187 | 187 |
188 void SVGTextPathElement::removedFrom(ContainerNode* rootParent) | 188 void SVGTextPathElement::removedFrom(ContainerNode* rootParent) |
189 { | 189 { |
190 SVGTextContentElement::removedFrom(rootParent); | 190 SVGTextContentElement::removedFrom(rootParent); |
191 if (rootParent->inDocument()) | 191 if (rootParent->inDocument()) |
192 clearResourceReferences(); | 192 clearResourceReferences(); |
193 } | 193 } |
194 | 194 |
195 bool SVGTextPathElement::selfHasRelativeLengths() const | 195 bool SVGTextPathElement::selfHasRelativeLengths() const |
196 { | 196 { |
197 return m_startOffset->currentValue()->isRelative() | 197 return m_startOffset->currentValue()->isRelative() |
198 || SVGTextContentElement::selfHasRelativeLengths(); | 198 || SVGTextContentElement::selfHasRelativeLengths(); |
199 } | 199 } |
200 | 200 |
201 } | 201 } |
OLD | NEW |