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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 return adoptRef(new SVGTextPathElement(tagName, document)); | 61 return adoptRef(new SVGTextPathElement(tagName, document)); |
62 } | 62 } |
63 | 63 |
64 SVGTextPathElement::~SVGTextPathElement() | 64 SVGTextPathElement::~SVGTextPathElement() |
65 { | 65 { |
66 clearResourceReferences(); | 66 clearResourceReferences(); |
67 } | 67 } |
68 | 68 |
69 void SVGTextPathElement::clearResourceReferences() | 69 void SVGTextPathElement::clearResourceReferences() |
70 { | 70 { |
71 ASSERT(document()); | 71 document().accessSVGExtensions()->removeAllTargetReferencesForElement(this); |
72 document()->accessSVGExtensions()->removeAllTargetReferencesForElement(this)
; | |
73 } | 72 } |
74 | 73 |
75 bool SVGTextPathElement::isSupportedAttribute(const QualifiedName& attrName) | 74 bool SVGTextPathElement::isSupportedAttribute(const QualifiedName& attrName) |
76 { | 75 { |
77 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 76 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
78 if (supportedAttributes.isEmpty()) { | 77 if (supportedAttributes.isEmpty()) { |
79 SVGURIReference::addSupportedAttributes(supportedAttributes); | 78 SVGURIReference::addSupportedAttributes(supportedAttributes); |
80 supportedAttributes.add(SVGNames::startOffsetAttr); | 79 supportedAttributes.add(SVGNames::startOffsetAttr); |
81 supportedAttributes.add(SVGNames::methodAttr); | 80 supportedAttributes.add(SVGNames::methodAttr); |
82 supportedAttributes.add(SVGNames::spacingAttr); | 81 supportedAttributes.add(SVGNames::spacingAttr); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 return false; | 153 return false; |
155 } | 154 } |
156 | 155 |
157 void SVGTextPathElement::buildPendingResource() | 156 void SVGTextPathElement::buildPendingResource() |
158 { | 157 { |
159 clearResourceReferences(); | 158 clearResourceReferences(); |
160 if (!inDocument()) | 159 if (!inDocument()) |
161 return; | 160 return; |
162 | 161 |
163 String id; | 162 String id; |
164 Element* target = SVGURIReference::targetElementFromIRIString(hrefCurrentVal
ue(), document(), &id); | 163 Element* target = SVGURIReference::targetElementFromIRIString(hrefCurrentVal
ue(), &document(), &id); |
165 if (!target) { | 164 if (!target) { |
166 // Do not register as pending if we are already pending this resource. | 165 // Do not register as pending if we are already pending this resource. |
167 if (document()->accessSVGExtensions()->isElementPendingResource(this, id
)) | 166 if (document().accessSVGExtensions()->isElementPendingResource(this, id)
) |
168 return; | 167 return; |
169 | 168 |
170 if (!id.isEmpty()) { | 169 if (!id.isEmpty()) { |
171 document()->accessSVGExtensions()->addPendingResource(id, this); | 170 document().accessSVGExtensions()->addPendingResource(id, this); |
172 ASSERT(hasPendingResources()); | 171 ASSERT(hasPendingResources()); |
173 } | 172 } |
174 } else if (target->hasTagName(SVGNames::pathTag)) { | 173 } else if (target->hasTagName(SVGNames::pathTag)) { |
175 // Register us with the target in the dependencies map. Any change of hr
efElement | 174 // 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. | 175 // that leads to relayout/repainting now informs us, so we can react to
it. |
177 document()->accessSVGExtensions()->addElementReferencingTarget(this, toS
VGElement(target)); | 176 document().accessSVGExtensions()->addElementReferencingTarget(this, toSV
GElement(target)); |
178 } | 177 } |
179 } | 178 } |
180 | 179 |
181 Node::InsertionNotificationRequest SVGTextPathElement::insertedInto(ContainerNod
e* rootParent) | 180 Node::InsertionNotificationRequest SVGTextPathElement::insertedInto(ContainerNod
e* rootParent) |
182 { | 181 { |
183 SVGTextContentElement::insertedInto(rootParent); | 182 SVGTextContentElement::insertedInto(rootParent); |
184 buildPendingResource(); | 183 buildPendingResource(); |
185 return InsertionDone; | 184 return InsertionDone; |
186 } | 185 } |
187 | 186 |
188 void SVGTextPathElement::removedFrom(ContainerNode* rootParent) | 187 void SVGTextPathElement::removedFrom(ContainerNode* rootParent) |
189 { | 188 { |
190 SVGTextContentElement::removedFrom(rootParent); | 189 SVGTextContentElement::removedFrom(rootParent); |
191 if (rootParent->inDocument()) | 190 if (rootParent->inDocument()) |
192 clearResourceReferences(); | 191 clearResourceReferences(); |
193 } | 192 } |
194 | 193 |
195 bool SVGTextPathElement::selfHasRelativeLengths() const | 194 bool SVGTextPathElement::selfHasRelativeLengths() const |
196 { | 195 { |
197 return startOffsetCurrentValue().isRelative() | 196 return startOffsetCurrentValue().isRelative() |
198 || SVGTextContentElement::selfHasRelativeLengths(); | 197 || SVGTextContentElement::selfHasRelativeLengths(); |
199 } | 198 } |
200 | 199 |
201 } | 200 } |
OLD | NEW |