summaryrefslogtreecommitdiff
path: root/Source/WebCore/svg/SVGTextPathElement.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-27 21:51:42 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-27 21:51:42 +0200
commitbe01689f43cf6882cf670d33df49ead1f570c53a (patch)
tree4bb2161d8983b38e3e7ed37b4a50303bfd5e2e85 /Source/WebCore/svg/SVGTextPathElement.cpp
parenta89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd (diff)
downloadqtwebkit-be01689f43cf6882cf670d33df49ead1f570c53a.tar.gz
Imported WebKit commit 8d6c5efc74f0222dfc7bcce8d845d4a2707ed9e6 (http://svn.webkit.org/repository/webkit/trunk@118629)
Diffstat (limited to 'Source/WebCore/svg/SVGTextPathElement.cpp')
-rw-r--r--Source/WebCore/svg/SVGTextPathElement.cpp47
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()