Index: Source/core/svg/SVGUseElement.cpp |
diff --git a/Source/core/svg/SVGUseElement.cpp b/Source/core/svg/SVGUseElement.cpp |
index 1a17c41abc0ec3be288b462318d72387e14edd47..7c950135168c7cc9b9b855ceaf3f0d91f59199a7 100644 |
--- a/Source/core/svg/SVGUseElement.cpp |
+++ b/Source/core/svg/SVGUseElement.cpp |
@@ -52,10 +52,8 @@ |
namespace WebCore { |
// Animated property definitions |
-DEFINE_ANIMATED_STRING(SVGUseElement, XLinkNames::hrefAttr, Href, href) |
BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGUseElement) |
- REGISTER_LOCAL_ANIMATED_PROPERTY(href) |
REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
END_REGISTER_ANIMATED_PROPERTIES |
@@ -65,6 +63,7 @@ inline SVGUseElement::SVGUseElement(Document& document, bool wasInsertedByParser |
, m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(LengthModeHeight))) |
, m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::create(LengthModeWidth))) |
, m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::create(LengthModeHeight))) |
+ , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::create())) |
, m_wasInsertedByParser(wasInsertedByParser) |
, m_haveFiredLoadEvent(false) |
, m_needsShadowTreeRecreation(false) |
@@ -77,6 +76,7 @@ inline SVGUseElement::SVGUseElement(Document& document, bool wasInsertedByParser |
addToPropertyMap(m_y); |
addToPropertyMap(m_width); |
addToPropertyMap(m_height); |
+ addToPropertyMap(m_href); |
registerAnimatedPropertiesForSVGUseElement(); |
} |
@@ -140,8 +140,9 @@ void SVGUseElement::parseAttribute(const QualifiedName& name, const AtomicString |
m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError); |
else if (name == SVGNames::heightAttr) |
m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError); |
- else if (SVGURIReference::parseAttribute(name, value)) { |
- } else |
+ else if (name.matches(XLinkNames::hrefAttr)) |
+ m_href->setBaseValueAsString(value, parseError); |
+ else |
ASSERT_NOT_REACHED(); |
reportAttributeParsingError(parseError, name, value); |
@@ -183,7 +184,7 @@ void SVGUseElement::removedFrom(ContainerNode* rootParent) |
Document* SVGUseElement::referencedDocument() const |
{ |
- if (!isExternalURIReference(hrefCurrentValue(), document())) |
+ if (!isExternalURIReference(m_href->currentValue()->value(), document())) |
return &document(); |
return externalDocument(); |
} |
@@ -221,9 +222,9 @@ void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName) |
} |
if (SVGURIReference::isKnownAttribute(attrName)) { |
- bool isExternalReference = isExternalURIReference(hrefCurrentValue(), document()); |
+ bool isExternalReference = isExternalURIReference(m_href->currentValue()->value(), document()); |
if (isExternalReference) { |
- KURL url = document().completeURL(hrefCurrentValue()); |
+ KURL url = document().completeURL(m_href->currentValue()->value()); |
if (url.hasFragmentIdentifier()) { |
FetchRequest request(ResourceRequest(url.string()), localName()); |
setDocumentResource(document().fetcher()->fetchSVGDocument(request)); |
@@ -386,7 +387,7 @@ void SVGUseElement::buildPendingResource() |
return; |
AtomicString id; |
- Element* target = SVGURIReference::targetElementFromIRIString(hrefCurrentValue(), document(), &id, externalDocument()); |
+ Element* target = SVGURIReference::targetElementFromIRIString(m_href->currentValue()->value(), document(), &id, externalDocument()); |
if (!target || !target->inDocument()) { |
// If we can't find the target of an external element, just give up. |
// We can't observe if the target somewhen enters the external document, nor should we do it. |
@@ -621,7 +622,7 @@ void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* ta |
bool SVGUseElement::hasCycleUseReferencing(SVGUseElement* use, SVGElementInstance* targetInstance, SVGElement*& newTarget) |
{ |
ASSERT(referencedDocument()); |
- Element* targetElement = SVGURIReference::targetElementFromIRIString(use->hrefCurrentValue(), *referencedDocument()); |
+ Element* targetElement = SVGURIReference::targetElementFromIRIString(use->m_href->currentValue()->value(), *referencedDocument()); |
newTarget = 0; |
if (targetElement && targetElement->isSVGElement()) |
newTarget = toSVGElement(targetElement); |
@@ -695,7 +696,7 @@ void SVGUseElement::expandUseElementsInShadowTree(Node* element) |
ASSERT(!use->resourceIsStillLoading()); |
ASSERT(referencedDocument()); |
- Element* targetElement = SVGURIReference::targetElementFromIRIString(use->hrefCurrentValue(), *referencedDocument()); |
+ Element* targetElement = SVGURIReference::targetElementFromIRIString(use->m_href->currentValue()->value(), *referencedDocument()); |
SVGElement* target = 0; |
if (targetElement && targetElement->isSVGElement()) |
target = toSVGElement(targetElement); |