| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 clearResourceReferences(); | 57 clearResourceReferences(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void SVGMPathElement::buildPendingResource() | 60 void SVGMPathElement::buildPendingResource() |
| 61 { | 61 { |
| 62 clearResourceReferences(); | 62 clearResourceReferences(); |
| 63 if (!inDocument()) | 63 if (!inDocument()) |
| 64 return; | 64 return; |
| 65 | 65 |
| 66 String id; | 66 String id; |
| 67 Element* target = SVGURIReference::targetElementFromIRIString(hrefCurrentVal
ue(), document(), &id); | 67 Element* target = SVGURIReference::targetElementFromIRIString(hrefCurrentVal
ue(), &document(), &id); |
| 68 if (!target) { | 68 if (!target) { |
| 69 // Do not register as pending if we are already pending this resource. | 69 // Do not register as pending if we are already pending this resource. |
| 70 if (document()->accessSVGExtensions()->isElementPendingResource(this, id
)) | 70 if (document().accessSVGExtensions()->isElementPendingResource(this, id)
) |
| 71 return; | 71 return; |
| 72 | 72 |
| 73 if (!id.isEmpty()) { | 73 if (!id.isEmpty()) { |
| 74 document()->accessSVGExtensions()->addPendingResource(id, this); | 74 document().accessSVGExtensions()->addPendingResource(id, this); |
| 75 ASSERT(hasPendingResources()); | 75 ASSERT(hasPendingResources()); |
| 76 } | 76 } |
| 77 } else if (target->isSVGElement()) { | 77 } else if (target->isSVGElement()) { |
| 78 // Register us with the target in the dependencies map. Any change of hr
efElement | 78 // Register us with the target in the dependencies map. Any change of hr
efElement |
| 79 // that leads to relayout/repainting now informs us, so we can react to
it. | 79 // that leads to relayout/repainting now informs us, so we can react to
it. |
| 80 document()->accessSVGExtensions()->addElementReferencingTarget(this, toS
VGElement(target)); | 80 document().accessSVGExtensions()->addElementReferencingTarget(this, toSV
GElement(target)); |
| 81 } | 81 } |
| 82 | 82 |
| 83 targetPathChanged(); | 83 targetPathChanged(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void SVGMPathElement::clearResourceReferences() | 86 void SVGMPathElement::clearResourceReferences() |
| 87 { | 87 { |
| 88 ASSERT(document()); | 88 document().accessSVGExtensions()->removeAllTargetReferencesForElement(this); |
| 89 document()->accessSVGExtensions()->removeAllTargetReferencesForElement(this)
; | |
| 90 } | 89 } |
| 91 | 90 |
| 92 Node::InsertionNotificationRequest SVGMPathElement::insertedInto(ContainerNode*
rootParent) | 91 Node::InsertionNotificationRequest SVGMPathElement::insertedInto(ContainerNode*
rootParent) |
| 93 { | 92 { |
| 94 SVGElement::insertedInto(rootParent); | 93 SVGElement::insertedInto(rootParent); |
| 95 if (rootParent->inDocument()) | 94 if (rootParent->inDocument()) |
| 96 buildPendingResource(); | 95 buildPendingResource(); |
| 97 return InsertionDone; | 96 return InsertionDone; |
| 98 } | 97 } |
| 99 | 98 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 144 } |
| 146 | 145 |
| 147 if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) | 146 if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) |
| 148 return; | 147 return; |
| 149 | 148 |
| 150 ASSERT_NOT_REACHED(); | 149 ASSERT_NOT_REACHED(); |
| 151 } | 150 } |
| 152 | 151 |
| 153 SVGPathElement* SVGMPathElement::pathElement() | 152 SVGPathElement* SVGMPathElement::pathElement() |
| 154 { | 153 { |
| 155 Element* target = targetElementFromIRIString(hrefCurrentValue(), document())
; | 154 Element* target = targetElementFromIRIString(hrefCurrentValue(), &document()
); |
| 156 if (target && target->hasTagName(SVGNames::pathTag)) | 155 if (target && target->hasTagName(SVGNames::pathTag)) |
| 157 return toSVGPathElement(target); | 156 return toSVGPathElement(target); |
| 158 return 0; | 157 return 0; |
| 159 } | 158 } |
| 160 | 159 |
| 161 void SVGMPathElement::targetPathChanged() | 160 void SVGMPathElement::targetPathChanged() |
| 162 { | 161 { |
| 163 notifyParentOfPathChange(parentNode()); | 162 notifyParentOfPathChange(parentNode()); |
| 164 } | 163 } |
| 165 | 164 |
| 166 void SVGMPathElement::notifyParentOfPathChange(ContainerNode* parent) | 165 void SVGMPathElement::notifyParentOfPathChange(ContainerNode* parent) |
| 167 { | 166 { |
| 168 if (parent && parent->hasTagName(SVGNames::animateMotionTag)) | 167 if (parent && parent->hasTagName(SVGNames::animateMotionTag)) |
| 169 static_cast<SVGAnimateMotionElement*>(parent)->updateAnimationPath(); | 168 static_cast<SVGAnimateMotionElement*>(parent)->updateAnimationPath(); |
| 170 } | 169 } |
| 171 | 170 |
| 172 } // namespace WebCore | 171 } // namespace WebCore |
| OLD | NEW |