diff options
Diffstat (limited to 'Source/WebCore/svg/SVGTextPathElement.cpp')
| -rw-r--r-- | Source/WebCore/svg/SVGTextPathElement.cpp | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/Source/WebCore/svg/SVGTextPathElement.cpp b/Source/WebCore/svg/SVGTextPathElement.cpp index 542d1a9ff..b42de2886 100644 --- a/Source/WebCore/svg/SVGTextPathElement.cpp +++ b/Source/WebCore/svg/SVGTextPathElement.cpp @@ -61,6 +61,17 @@ PassRefPtr<SVGTextPathElement> SVGTextPathElement::create(const QualifiedName& t return adoptRef(new SVGTextPathElement(tagName, document)); } +SVGTextPathElement::~SVGTextPathElement() +{ + clearResourceReferences(); +} + +void SVGTextPathElement::clearResourceReferences() +{ + ASSERT(document()); + document()->accessSVGExtensions()->removeAllTargetReferencesForElement(this); +} + bool SVGTextPathElement::isSupportedAttribute(const QualifiedName& attrName) { DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); @@ -106,6 +117,11 @@ void SVGTextPathElement::svgAttributeChanged(const QualifiedName& attrName) SVGElementInstance::InvalidationGuard invalidationGuard(this); + if (SVGURIReference::isKnownAttribute(attrName)) { + buildPendingResource(); + return; + } + if (attrName == SVGNames::startOffsetAttr) updateRelativeLengthsInformation(); @@ -139,26 +155,41 @@ bool SVGTextPathElement::rendererIsNeeded(const NodeRenderingContext& context) return false; } -Node::InsertionNotificationRequest SVGTextPathElement::insertedInto(ContainerNode* rootParent) +void SVGTextPathElement::buildPendingResource() { - SVGStyledElement::insertedInto(rootParent); - if (!rootParent->inDocument()) - return InsertionDone; + clearResourceReferences(); + if (!inDocument()) + return; String id; - Element* targetElement = SVGURIReference::targetElementFromIRIString(href(), document(), &id); - if (!targetElement) { + Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id); + if (!target) { if (hasPendingResources() || id.isEmpty()) - return InsertionDone; + return; - ASSERT(!hasPendingResources()); document()->accessSVGExtensions()->addPendingResource(id, this); ASSERT(hasPendingResources()); + } else if (target->isSVGElement()) { + // Register us with the target in the dependencies map. Any change of hrefElement + // that leads to relayout/repainting now informs us, so we can react to it. + document()->accessSVGExtensions()->addElementReferencingTarget(this, static_cast<SVGElement*>(target)); } +} +Node::InsertionNotificationRequest SVGTextPathElement::insertedInto(ContainerNode* rootParent) +{ + SVGTextContentElement::insertedInto(rootParent); + buildPendingResource(); return InsertionDone; } +void SVGTextPathElement::removedFrom(ContainerNode* rootParent) +{ + SVGTextContentElement::removedFrom(rootParent); + if (rootParent->inDocument()) + clearResourceReferences(); +} + bool SVGTextPathElement::selfHasRelativeLengths() const { return startOffset().isRelative() |
