diff options
29 files changed, 134 insertions, 149 deletions
diff --git a/third_party/WebKit/Source/core/svg/SVGAElement.cpp b/third_party/WebKit/Source/core/svg/SVGAElement.cpp index 76e6c28..2142ba4 100644 --- a/third_party/WebKit/Source/core/svg/SVGAElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGAElement.cpp @@ -62,12 +62,11 @@ END_REGISTER_ANIMATED_PROPERTIES inline SVGAElement::SVGAElement(Document& document) : SVGGraphicsElement(SVGNames::aTag, document) + , SVGURIReference(this) , m_svgTarget(SVGAnimatedString::create(this, SVGNames::targetAttr, SVGString::create())) - , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::create())) { ScriptWrappable::init(this); addToPropertyMap(m_svgTarget); - addToPropertyMap(m_href); registerAnimatedPropertiesForSVGAElement(); } @@ -106,12 +105,12 @@ void SVGAElement::parseAttribute(const QualifiedName& name, const AtomicString& SVGParsingError parseError = NoError; - if (name == SVGNames::targetAttr) + if (name == SVGNames::targetAttr) { m_svgTarget->setBaseValueAsString(value, parseError); - else if (name.matches(XLinkNames::hrefAttr)) - m_href->setBaseValueAsString(value, parseError); - else + } else if (SVGURIReference::parseAttribute(name, value, parseError)) { + } else { ASSERT_NOT_REACHED(); + } reportAttributeParsingError(parseError, name, value); } @@ -129,7 +128,7 @@ void SVGAElement::svgAttributeChanged(const QualifiedName& attrName) // as none of the other properties changes the linking behaviour for our <a> element. if (SVGURIReference::isKnownAttribute(attrName)) { bool wasLink = isLink(); - setIsLink(!m_href->currentValue()->value().isNull()); + setIsLink(!hrefString().isNull()); if (wasLink != isLink()) setNeedsStyleRecalc(SubtreeStyleChange); @@ -154,7 +153,7 @@ void SVGAElement::defaultEventHandler(Event* event) } if (isLinkClick(event)) { - String url = stripLeadingAndTrailingHTMLSpaces(m_href->currentValue()->value()); + String url = stripLeadingAndTrailingHTMLSpaces(hrefString()); if (url[0] == '#') { Element* targetElement = treeScope().getElementById(AtomicString(url.substring(1))); diff --git a/third_party/WebKit/Source/core/svg/SVGAElement.h b/third_party/WebKit/Source/core/svg/SVGAElement.h index ba2c9a6..64519d2 100644 --- a/third_party/WebKit/Source/core/svg/SVGAElement.h +++ b/third_party/WebKit/Source/core/svg/SVGAElement.h @@ -33,7 +33,6 @@ class SVGAElement FINAL : public SVGGraphicsElement, public: static PassRefPtr<SVGAElement> create(Document&); SVGAnimatedString* svgTarget() { return m_svgTarget.get(); } - SVGAnimatedString* href() { return m_href.get(); } private: explicit SVGAElement(Document&); @@ -56,7 +55,6 @@ private: virtual bool willRespondToMouseClickEvents() OVERRIDE; RefPtr<SVGAnimatedString> m_svgTarget; - RefPtr<SVGAnimatedString> m_href; BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGAElement) // This declaration used to define a non-virtual "String& target() const" method, that clashes with "virtual String Element::target() const". // That's why it has been renamed to "svgTarget", the CodeGenerators take care of calling svgTargetAnimated() instead of targetAnimated(), see CodeGenerator.pm. diff --git a/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.cpp b/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.cpp index fbe97db..d4e56d1 100644 --- a/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.cpp @@ -43,10 +43,9 @@ END_REGISTER_ANIMATED_PROPERTIES inline SVGAltGlyphElement::SVGAltGlyphElement(Document& document) : SVGTextPositioningElement(SVGNames::altGlyphTag, document) - , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::create())) + , SVGURIReference(this) { ScriptWrappable::init(this); - addToPropertyMap(m_href); registerAnimatedPropertiesForSVGAltGlyphElement(); } diff --git a/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.h b/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.h index e62534c..ffa4bfb 100644 --- a/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.h +++ b/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.h @@ -44,14 +44,12 @@ public: void setFormat(const AtomicString&, ExceptionState&); bool hasValidGlyphElements(Vector<AtomicString>& glyphNames) const; - SVGAnimatedString* href() { return m_href.get(); } private: explicit SVGAltGlyphElement(Document&); virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE; - RefPtr<SVGAnimatedString> m_href; BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGAltGlyphElement) END_DECLARE_ANIMATED_PROPERTIES }; diff --git a/third_party/WebKit/Source/core/svg/SVGCursorElement.cpp b/third_party/WebKit/Source/core/svg/SVGCursorElement.cpp index dc8e89b..c1bb5d7 100644 --- a/third_party/WebKit/Source/core/svg/SVGCursorElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGCursorElement.cpp @@ -37,15 +37,14 @@ END_REGISTER_ANIMATED_PROPERTIES inline SVGCursorElement::SVGCursorElement(Document& document) : SVGElement(SVGNames::cursorTag, document) , SVGTests(this) + , SVGURIReference(this) , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(LengthModeWidth))) , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(LengthModeHeight))) - , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::create())) { ScriptWrappable::init(this); addToPropertyMap(m_x); addToPropertyMap(m_y); - addToPropertyMap(m_href); registerAnimatedPropertiesForSVGCursorElement(); } @@ -77,17 +76,17 @@ void SVGCursorElement::parseAttribute(const QualifiedName& name, const AtomicStr { SVGParsingError parseError = NoError; - if (!isSupportedAttribute(name)) + if (!isSupportedAttribute(name)) { SVGElement::parseAttribute(name, value); - else if (name == SVGNames::xAttr) + } else if (name == SVGNames::xAttr) { m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); - else if (name == SVGNames::yAttr) + } else if (name == SVGNames::yAttr) { m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); - else if (name.matches(XLinkNames::hrefAttr)) - m_href->setBaseValueAsString(value, parseError); - else if (SVGTests::parseAttribute(name, value)) { - } else + } else if (SVGURIReference::parseAttribute(name, value, parseError)) { + } else if (SVGTests::parseAttribute(name, value)) { + } else { ASSERT_NOT_REACHED(); + } reportAttributeParsingError(parseError, name, value); } diff --git a/third_party/WebKit/Source/core/svg/SVGCursorElement.h b/third_party/WebKit/Source/core/svg/SVGCursorElement.h index bdb20c4..56c02f2 100644 --- a/third_party/WebKit/Source/core/svg/SVGCursorElement.h +++ b/third_party/WebKit/Source/core/svg/SVGCursorElement.h @@ -45,8 +45,6 @@ public: SVGAnimatedLength* x() const { return m_x.get(); } SVGAnimatedLength* y() const { return m_y.get(); } - SVGAnimatedString* href() { return m_href.get(); } - private: explicit SVGCursorElement(Document&); @@ -60,7 +58,6 @@ private: RefPtr<SVGAnimatedLength> m_x; RefPtr<SVGAnimatedLength> m_y; - RefPtr<SVGAnimatedString> m_href; BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGCursorElement) END_DECLARE_ANIMATED_PROPERTIES diff --git a/third_party/WebKit/Source/core/svg/SVGFEImageElement.cpp b/third_party/WebKit/Source/core/svg/SVGFEImageElement.cpp index 3f2b9a8..910af30 100644 --- a/third_party/WebKit/Source/core/svg/SVGFEImageElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGFEImageElement.cpp @@ -42,12 +42,11 @@ END_REGISTER_ANIMATED_PROPERTIES inline SVGFEImageElement::SVGFEImageElement(Document& document) : SVGFilterPrimitiveStandardAttributes(SVGNames::feImageTag, document) + , SVGURIReference(this) , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(this, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create())) - , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::create())) { ScriptWrappable::init(this); addToPropertyMap(m_preserveAspectRatio); - addToPropertyMap(m_href); registerAnimatedPropertiesForSVGFEImageElement(); } @@ -81,7 +80,7 @@ void SVGFEImageElement::clearResourceReferences() void SVGFEImageElement::fetchImageResource() { - FetchRequest request(ResourceRequest(ownerDocument()->completeURL(m_href->currentValue()->value())), localName()); + FetchRequest request(ResourceRequest(ownerDocument()->completeURL(hrefString())), localName()); m_cachedImage = document().fetcher()->fetchImage(request); if (m_cachedImage) @@ -95,7 +94,7 @@ void SVGFEImageElement::buildPendingResource() return; AtomicString id; - Element* target = SVGURIReference::targetElementFromIRIString(m_href->currentValue()->value(), document(), &id); + Element* target = SVGURIReference::targetElementFromIRIString(hrefString(), document(), &id); if (!target) { if (id.isEmpty()) fetchImageResource(); @@ -133,8 +132,7 @@ void SVGFEImageElement::parseAttribute(const QualifiedName& name, const AtomicSt if (name == SVGNames::preserveAspectRatioAttr) { m_preserveAspectRatio->setBaseValueAsString(value, parseError); - } else if (name.matches(XLinkNames::hrefAttr)) { - m_href->setBaseValueAsString(value, parseError); + } else if (SVGURIReference::parseAttribute(name, value, parseError)) { } else { ASSERT_NOT_REACHED(); } @@ -197,7 +195,7 @@ PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*, Filter* fil { if (m_cachedImage) return FEImage::createWithImage(filter, m_cachedImage->imageForRenderer(renderer()), m_preserveAspectRatio->currentValue()); - return FEImage::createWithIRIReference(filter, document(), m_href->currentValue()->value(), m_preserveAspectRatio->currentValue()); + return FEImage::createWithIRIReference(filter, document(), hrefString(), m_preserveAspectRatio->currentValue()); } } diff --git a/third_party/WebKit/Source/core/svg/SVGFEImageElement.h b/third_party/WebKit/Source/core/svg/SVGFEImageElement.h index 8698223..9e3839b 100644 --- a/third_party/WebKit/Source/core/svg/SVGFEImageElement.h +++ b/third_party/WebKit/Source/core/svg/SVGFEImageElement.h @@ -43,7 +43,6 @@ public: virtual ~SVGFEImageElement(); SVGAnimatedPreserveAspectRatio* preserveAspectRatio() { return m_preserveAspectRatio.get(); } - SVGAnimatedString* href() { return m_href.get(); } private: explicit SVGFEImageElement(Document&); @@ -63,7 +62,6 @@ private: virtual void removedFrom(ContainerNode*) OVERRIDE; RefPtr<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio; - RefPtr<SVGAnimatedString> m_href; BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEImageElement) END_DECLARE_ANIMATED_PROPERTIES diff --git a/third_party/WebKit/Source/core/svg/SVGFilterElement.cpp b/third_party/WebKit/Source/core/svg/SVGFilterElement.cpp index 816c170..83a92de 100644 --- a/third_party/WebKit/Source/core/svg/SVGFilterElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGFilterElement.cpp @@ -43,11 +43,11 @@ END_REGISTER_ANIMATED_PROPERTIES inline SVGFilterElement::SVGFilterElement(Document& document) : SVGElement(SVGNames::filterTag, document) + , SVGURIReference(this) , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(LengthModeWidth))) , 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_filterRes(SVGAnimatedIntegerOptionalInteger::create(this, SVGNames::filterResAttr)) , m_filterUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) , m_primitiveUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) @@ -65,7 +65,6 @@ inline SVGFilterElement::SVGFilterElement(Document& document) addToPropertyMap(m_y); addToPropertyMap(m_width); addToPropertyMap(m_height); - addToPropertyMap(m_href); addToPropertyMap(m_filterRes); registerAnimatedPropertiesForSVGFilterElement(); } @@ -104,9 +103,9 @@ void SVGFilterElement::parseAttribute(const QualifiedName& name, const AtomicStr { SVGParsingError parseError = NoError; - if (!isSupportedAttribute(name)) + if (!isSupportedAttribute(name)) { SVGElement::parseAttribute(name, value); - else if (name == SVGNames::filterUnitsAttr) { + } else if (name == SVGNames::filterUnitsAttr) { SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); if (propertyValue > 0) setFilterUnitsBaseValue(propertyValue); @@ -114,20 +113,20 @@ void SVGFilterElement::parseAttribute(const QualifiedName& name, const AtomicStr SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); if (propertyValue > 0) setPrimitiveUnitsBaseValue(propertyValue); - } else if (name == SVGNames::xAttr) + } else if (name == SVGNames::xAttr) { m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); - else if (name == SVGNames::yAttr) + } else if (name == SVGNames::yAttr) { m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); - else if (name == SVGNames::widthAttr) + } else if (name == SVGNames::widthAttr) { m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError); - else if (name == SVGNames::heightAttr) + } else if (name == SVGNames::heightAttr) { m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError); - else if (name == SVGNames::filterResAttr) + } else if (name == SVGNames::filterResAttr) { m_filterRes->setBaseValueAsString(value, parseError); - else if (name.matches(XLinkNames::hrefAttr)) - m_href->setBaseValueAsString(value, parseError); - else + } else if (SVGURIReference::parseAttribute(name, value, parseError)) { + } else { ASSERT_NOT_REACHED(); + } reportAttributeParsingError(parseError, name, value); } diff --git a/third_party/WebKit/Source/core/svg/SVGFilterElement.h b/third_party/WebKit/Source/core/svg/SVGFilterElement.h index f5836ff..80c61b7 100644 --- a/third_party/WebKit/Source/core/svg/SVGFilterElement.h +++ b/third_party/WebKit/Source/core/svg/SVGFilterElement.h @@ -48,7 +48,6 @@ public: SVGAnimatedLength* y() const { return m_y.get(); } SVGAnimatedLength* width() const { return m_width.get(); } SVGAnimatedLength* height() const { return m_height.get(); } - SVGAnimatedString* href() { return m_href.get(); } SVGAnimatedInteger* filterResX() { return m_filterRes->firstInteger(); } SVGAnimatedInteger* filterResY() { return m_filterRes->secondInteger(); } @@ -70,7 +69,6 @@ private: RefPtr<SVGAnimatedLength> m_y; RefPtr<SVGAnimatedLength> m_width; RefPtr<SVGAnimatedLength> m_height; - RefPtr<SVGAnimatedString> m_href; RefPtr<SVGAnimatedIntegerOptionalInteger> m_filterRes; BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFilterElement) DECLARE_ANIMATED_ENUMERATION(FilterUnits, filterUnits, SVGUnitTypes::SVGUnitType) diff --git a/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.cpp b/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.cpp index 6e81e57..2385cad 100644 --- a/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.cpp @@ -36,14 +36,13 @@ END_REGISTER_ANIMATED_PROPERTIES inline SVGGlyphRefElement::SVGGlyphRefElement(Document& document) : SVGElement(SVGNames::glyphRefTag, document) - , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::create())) + , SVGURIReference(this) , m_x(0) , m_y(0) , m_dx(0) , m_dy(0) { ScriptWrappable::init(this); - addToPropertyMap(m_href); registerAnimatedPropertiesForSVGGlyphRefElement(); } @@ -69,6 +68,7 @@ void SVGGlyphRefElement::parseAttributeInternal(const QualifiedName& name, const const CharType* end = ptr + value.length(); // FIXME: We need some error handling here. + SVGParsingError parseError = NoError; if (name == SVGNames::xAttr) { parseNumber(ptr, end, m_x); } else if (name == SVGNames::yAttr) { @@ -77,13 +77,11 @@ void SVGGlyphRefElement::parseAttributeInternal(const QualifiedName& name, const parseNumber(ptr, end, m_dx); } else if (name == SVGNames::dyAttr) { parseNumber(ptr, end, m_dy); - } else if (name.matches(XLinkNames::hrefAttr)) { - SVGParsingError parseError = NoError; - m_href->setBaseValueAsString(value, parseError); - reportAttributeParsingError(parseError, name, value); + } else if (SVGURIReference::parseAttribute(name, value, parseError)) { } else { SVGElement::parseAttribute(name, value); } + reportAttributeParsingError(parseError, name, value); } void SVGGlyphRefElement::parseAttribute(const QualifiedName& name, const AtomicString& value) diff --git a/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.h b/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.h index 5b3e43e..259da0e 100644 --- a/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.h +++ b/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.h @@ -46,7 +46,6 @@ public: void setDx(float); float dy() const { return m_dy; } void setDy(float); - SVGAnimatedString* href() { return m_href.get(); } private: explicit SVGGlyphRefElement(Document&); @@ -56,7 +55,6 @@ private: virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; } - RefPtr<SVGAnimatedString> m_href; BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGlyphRefElement) END_DECLARE_ANIMATED_PROPERTIES diff --git a/third_party/WebKit/Source/core/svg/SVGGradientElement.cpp b/third_party/WebKit/Source/core/svg/SVGGradientElement.cpp index bfee100..6d1ca069 100644 --- a/third_party/WebKit/Source/core/svg/SVGGradientElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGGradientElement.cpp @@ -49,12 +49,11 @@ END_REGISTER_ANIMATED_PROPERTIES SVGGradientElement::SVGGradientElement(const QualifiedName& tagName, Document& document) : SVGElement(tagName, document) - , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::create())) + , SVGURIReference(this) , m_spreadMethod(SVGSpreadMethodPad) , m_gradientUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { ScriptWrappable::init(this); - addToPropertyMap(m_href); registerAnimatedPropertiesForSVGGradientElement(); } @@ -101,10 +100,10 @@ void SVGGradientElement::parseAttribute(const QualifiedName& name, const AtomicS SVGParsingError parseError = NoError; - if (name.matches(XLinkNames::hrefAttr)) - m_href->setBaseValueAsString(value, parseError); - else + if (SVGURIReference::parseAttribute(name, value, parseError)) { + } else { ASSERT_NOT_REACHED(); + } reportAttributeParsingError(parseError, name, value); } diff --git a/third_party/WebKit/Source/core/svg/SVGGradientElement.h b/third_party/WebKit/Source/core/svg/SVGGradientElement.h index 30ef675..e57eb6b 100644 --- a/third_party/WebKit/Source/core/svg/SVGGradientElement.h +++ b/third_party/WebKit/Source/core/svg/SVGGradientElement.h @@ -84,8 +84,6 @@ public: Vector<Gradient::ColorStop> buildStops(); - SVGAnimatedString* href() { return m_href.get(); } - protected: SVGGradientElement(const QualifiedName&, Document&); @@ -98,7 +96,6 @@ private: virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE FINAL; - RefPtr<SVGAnimatedString> m_href; BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGradientElement) DECLARE_ANIMATED_ENUMERATION(SpreadMethod, spreadMethod, SVGSpreadMethodType) DECLARE_ANIMATED_ENUMERATION(GradientUnits, gradientUnits, SVGUnitTypes::SVGUnitType) diff --git a/third_party/WebKit/Source/core/svg/SVGImageElement.cpp b/third_party/WebKit/Source/core/svg/SVGImageElement.cpp index 4a5fccd..21ed9fe 100644 --- a/third_party/WebKit/Source/core/svg/SVGImageElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGImageElement.cpp @@ -40,12 +40,12 @@ END_REGISTER_ANIMATED_PROPERTIES inline SVGImageElement::SVGImageElement(Document& document) : SVGGraphicsElement(SVGNames::imageTag, document) + , SVGURIReference(this) , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(LengthModeWidth))) , 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_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(this, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create())) - , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::create())) , m_imageLoader(this) { ScriptWrappable::init(this); @@ -56,7 +56,6 @@ inline SVGImageElement::SVGImageElement(Document& document) addToPropertyMap(m_height); addToPropertyMap(m_preserveAspectRatio); - addToPropertyMap(m_href); registerAnimatedPropertiesForSVGImageElement(); } @@ -112,22 +111,22 @@ void SVGImageElement::parseAttribute(const QualifiedName& name, const AtomicStri { SVGParsingError parseError = NoError; - if (!isSupportedAttribute(name)) + if (!isSupportedAttribute(name)) { SVGGraphicsElement::parseAttribute(name, value); - else if (name == SVGNames::xAttr) + } else if (name == SVGNames::xAttr) { m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); - else if (name == SVGNames::yAttr) + } else if (name == SVGNames::yAttr) { m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); - else if (name == SVGNames::widthAttr) + } else if (name == SVGNames::widthAttr) { m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError); - else if (name == SVGNames::heightAttr) + } else if (name == SVGNames::heightAttr) { m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError); - else if (name == SVGNames::preserveAspectRatioAttr) + } else if (name == SVGNames::preserveAspectRatioAttr) { m_preserveAspectRatio->setBaseValueAsString(value, parseError); - else if (name.matches(XLinkNames::hrefAttr)) - m_href->setBaseValueAsString(value, parseError); - else + } else if (SVGURIReference::parseAttribute(name, value, parseError)) { + } else { ASSERT_NOT_REACHED(); + } reportAttributeParsingError(parseError, name, value); } @@ -215,7 +214,7 @@ Node::InsertionNotificationRequest SVGImageElement::insertedInto(ContainerNode* const AtomicString SVGImageElement::imageSourceURL() const { - return AtomicString(m_href->currentValue()->value()); + return AtomicString(hrefString()); } void SVGImageElement::didMoveToNewDocument(Document& oldDocument) diff --git a/third_party/WebKit/Source/core/svg/SVGImageElement.h b/third_party/WebKit/Source/core/svg/SVGImageElement.h index ebc0f0f..f3bf328 100644 --- a/third_party/WebKit/Source/core/svg/SVGImageElement.h +++ b/third_party/WebKit/Source/core/svg/SVGImageElement.h @@ -43,13 +43,11 @@ public: SVGAnimatedLength* width() const { return m_width.get(); } SVGAnimatedLength* height() const { return m_height.get(); } SVGAnimatedPreserveAspectRatio* preserveAspectRatio() { return m_preserveAspectRatio.get(); } - SVGAnimatedString* href() { return m_href.get(); } - const SVGAnimatedString* href() const { return m_href.get(); } private: explicit SVGImageElement(Document&); - virtual bool isStructurallyExternal() const OVERRIDE { return !href()->currentValue()->value().isNull(); } + virtual bool isStructurallyExternal() const OVERRIDE { return !hrefString().isNull(); } virtual bool supportsFocus() const OVERRIDE { return hasFocusEventListeners(); } bool isSupportedAttribute(const QualifiedName&); @@ -75,7 +73,6 @@ private: RefPtr<SVGAnimatedLength> m_width; RefPtr<SVGAnimatedLength> m_height; RefPtr<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio; - RefPtr<SVGAnimatedString> m_href; BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGImageElement) END_DECLARE_ANIMATED_PROPERTIES diff --git a/third_party/WebKit/Source/core/svg/SVGMPathElement.cpp b/third_party/WebKit/Source/core/svg/SVGMPathElement.cpp index 343b86d..155f96b 100644 --- a/third_party/WebKit/Source/core/svg/SVGMPathElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGMPathElement.cpp @@ -36,10 +36,9 @@ END_REGISTER_ANIMATED_PROPERTIES inline SVGMPathElement::SVGMPathElement(Document& document) : SVGElement(SVGNames::mpathTag, document) - , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::create())) + , SVGURIReference(this) { ScriptWrappable::init(this); - addToPropertyMap(m_href); registerAnimatedPropertiesForSVGMPathElement(); } @@ -60,7 +59,7 @@ void SVGMPathElement::buildPendingResource() return; AtomicString id; - Element* target = SVGURIReference::targetElementFromIRIString(m_href->currentValue()->value(), document(), &id); + Element* target = SVGURIReference::targetElementFromIRIString(hrefString(), document(), &id); if (!target) { // Do not register as pending if we are already pending this resource. if (document().accessSVGExtensions()->isElementPendingResource(this, id)) @@ -115,8 +114,7 @@ void SVGMPathElement::parseAttribute(const QualifiedName& name, const AtomicStri if (!isSupportedAttribute(name)) { SVGElement::parseAttribute(name, value); - } else if (name.matches(XLinkNames::hrefAttr)) { - m_href->setBaseValueAsString(value, parseError); + } else if (SVGURIReference::parseAttribute(name, value, parseError)) { } else { ASSERT_NOT_REACHED(); } @@ -143,7 +141,7 @@ void SVGMPathElement::svgAttributeChanged(const QualifiedName& attrName) SVGPathElement* SVGMPathElement::pathElement() { - Element* target = targetElementFromIRIString(m_href->currentValue()->value(), document()); + Element* target = targetElementFromIRIString(hrefString(), document()); if (target && target->hasTagName(SVGNames::pathTag)) return toSVGPathElement(target); return 0; diff --git a/third_party/WebKit/Source/core/svg/SVGMPathElement.h b/third_party/WebKit/Source/core/svg/SVGMPathElement.h index 334714a..3799d83 100644 --- a/third_party/WebKit/Source/core/svg/SVGMPathElement.h +++ b/third_party/WebKit/Source/core/svg/SVGMPathElement.h @@ -40,7 +40,6 @@ public: SVGPathElement* pathElement(); void targetPathChanged(); - SVGAnimatedString* href() { return m_href.get(); } private: explicit SVGMPathElement(Document&); @@ -57,7 +56,6 @@ private: virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; } void notifyParentOfPathChange(ContainerNode*); - RefPtr<SVGAnimatedString> m_href; BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGMPathElement) END_DECLARE_ANIMATED_PROPERTIES }; diff --git a/third_party/WebKit/Source/core/svg/SVGPatternElement.cpp b/third_party/WebKit/Source/core/svg/SVGPatternElement.cpp index 095c2f6..f48af7e 100644 --- a/third_party/WebKit/Source/core/svg/SVGPatternElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGPatternElement.cpp @@ -46,6 +46,7 @@ END_REGISTER_ANIMATED_PROPERTIES inline SVGPatternElement::SVGPatternElement(Document& document) : SVGElement(SVGNames::patternTag, document) + , SVGURIReference(this) , SVGTests(this) , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(LengthModeWidth))) , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(LengthModeHeight))) @@ -53,7 +54,6 @@ inline SVGPatternElement::SVGPatternElement(Document& document) , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::create(LengthModeHeight))) , m_viewBox(SVGAnimatedRect::create(this, SVGNames::viewBoxAttr)) , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(this, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create())) - , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::create())) , m_patternUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) , m_patternContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) { @@ -65,7 +65,6 @@ inline SVGPatternElement::SVGPatternElement(Document& document) addToPropertyMap(m_height); addToPropertyMap(m_viewBox); addToPropertyMap(m_preserveAspectRatio); - addToPropertyMap(m_href); registerAnimatedPropertiesForSVGPatternElement(); } @@ -96,9 +95,9 @@ void SVGPatternElement::parseAttribute(const QualifiedName& name, const AtomicSt { SVGParsingError parseError = NoError; - if (!isSupportedAttribute(name)) + if (!isSupportedAttribute(name)) { SVGElement::parseAttribute(name, value); - else if (name == SVGNames::patternUnitsAttr) { + } else if (name == SVGNames::patternUnitsAttr) { SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); if (propertyValue > 0) setPatternUnitsBaseValue(propertyValue); @@ -114,20 +113,20 @@ void SVGPatternElement::parseAttribute(const QualifiedName& name, const AtomicSt detachAnimatedPatternTransformListWrappers(newList.size()); setPatternTransformBaseValue(newList); return; - } else if (name == SVGNames::xAttr) + } else if (name == SVGNames::xAttr) { m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); - else if (name == SVGNames::yAttr) + } else if (name == SVGNames::yAttr) { m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); - else if (name == SVGNames::widthAttr) + } else if (name == SVGNames::widthAttr) { m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError); - else if (name == SVGNames::heightAttr) + } else if (name == SVGNames::heightAttr) { m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError); - else if (name.matches(XLinkNames::hrefAttr)) - m_href->setBaseValueAsString(value, parseError); - else if (SVGTests::parseAttribute(name, value) - || SVGFitToViewBox::parseAttribute(this, name, value)) { - } else + } else if (SVGURIReference::parseAttribute(name, value, parseError)) { + } else if (SVGTests::parseAttribute(name, value)) { + } else if (SVGFitToViewBox::parseAttribute(this, name, value)) { + } else { ASSERT_NOT_REACHED(); + } reportAttributeParsingError(parseError, name, value); } @@ -214,7 +213,7 @@ void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes) processedPatterns.add(current); // Respect xlink:href, take attributes from referenced element - Node* refNode = SVGURIReference::targetElementFromIRIString(current->m_href->currentValue()->value(), document()); + Node* refNode = SVGURIReference::targetElementFromIRIString(current->hrefString(), document()); if (refNode && refNode->hasTagName(SVGNames::patternTag)) { current = toSVGPatternElement(const_cast<const Node*>(refNode)); diff --git a/third_party/WebKit/Source/core/svg/SVGPatternElement.h b/third_party/WebKit/Source/core/svg/SVGPatternElement.h index f92156b..c06a8d6a 100644 --- a/third_party/WebKit/Source/core/svg/SVGPatternElement.h +++ b/third_party/WebKit/Source/core/svg/SVGPatternElement.h @@ -55,7 +55,6 @@ public: SVGAnimatedLength* height() const { return m_height.get(); } SVGAnimatedRect* viewBox() const { return m_viewBox.get(); } SVGAnimatedPreserveAspectRatio* preserveAspectRatio() const { return m_preserveAspectRatio.get(); } - SVGAnimatedString* href() { return m_href.get(); } private: explicit SVGPatternElement(Document&); @@ -78,7 +77,6 @@ private: RefPtr<SVGAnimatedLength> m_height; RefPtr<SVGAnimatedRect> m_viewBox; RefPtr<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio; - RefPtr<SVGAnimatedString> m_href; BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPatternElement) DECLARE_ANIMATED_ENUMERATION(PatternUnits, patternUnits, SVGUnitTypes::SVGUnitType) DECLARE_ANIMATED_ENUMERATION(PatternContentUnits, patternContentUnits, SVGUnitTypes::SVGUnitType) diff --git a/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp b/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp index e08b4a0..5d121fa 100644 --- a/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp @@ -41,12 +41,11 @@ END_REGISTER_ANIMATED_PROPERTIES inline SVGScriptElement::SVGScriptElement(Document& document, bool wasInsertedByParser, bool alreadyStarted) : SVGElement(SVGNames::scriptTag, document) - , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::create())) + , SVGURIReference(this) , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired) , m_loader(ScriptLoader::create(this, wasInsertedByParser, alreadyStarted)) { ScriptWrappable::init(this); - addToPropertyMap(m_href); registerAnimatedPropertiesForSVGScriptElement(); } @@ -77,12 +76,12 @@ void SVGScriptElement::parseAttribute(const QualifiedName& name, const AtomicStr if (name == SVGNames::typeAttr) return; - if (name == HTMLNames::onerrorAttr) + if (name == HTMLNames::onerrorAttr) { setAttributeEventListener(EventTypeNames::error, createAttributeEventListener(this, name, value)); - else if (name.matches(XLinkNames::hrefAttr)) - m_href->setBaseValueAsString(value, parseError); - else + } else if (SVGURIReference::parseAttribute(name, value, parseError)) { + } else { ASSERT_NOT_REACHED(); + } reportAttributeParsingError(parseError, name, value); } @@ -100,7 +99,7 @@ void SVGScriptElement::svgAttributeChanged(const QualifiedName& attrName) return; if (SVGURIReference::isKnownAttribute(attrName)) { - m_loader->handleSourceAttribute(m_href->currentValue()->value()); + m_loader->handleSourceAttribute(hrefString()); return; } @@ -147,7 +146,7 @@ bool SVGScriptElement::haveLoadedRequiredResources() String SVGScriptElement::sourceAttributeValue() const { - return m_href->currentValue()->value(); + return hrefString(); } String SVGScriptElement::charsetAttributeValue() const @@ -187,7 +186,7 @@ bool SVGScriptElement::deferAttributeValue() const bool SVGScriptElement::hasSourceAttribute() const { - return m_href->isSpecified(); + return href()->isSpecified(); } PassRefPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren() diff --git a/third_party/WebKit/Source/core/svg/SVGScriptElement.h b/third_party/WebKit/Source/core/svg/SVGScriptElement.h index 3ade17f..b11f5be 100644 --- a/third_party/WebKit/Source/core/svg/SVGScriptElement.h +++ b/third_party/WebKit/Source/core/svg/SVGScriptElement.h @@ -43,7 +43,6 @@ public: void setType(const String&); ScriptLoader* loader() const { return m_loader.get(); } - SVGAnimatedString* href() { return m_href.get(); } #ifndef NDEBUG virtual bool isAnimatableAttribute(const QualifiedName&) const OVERRIDE; @@ -82,7 +81,6 @@ private: virtual Timer<SVGElement>* svgLoadEventTimer() OVERRIDE { return &m_svgLoadEventTimer; } - RefPtr<SVGAnimatedString> m_href; BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGScriptElement) END_DECLARE_ANIMATED_PROPERTIES diff --git a/third_party/WebKit/Source/core/svg/SVGTextPathElement.cpp b/third_party/WebKit/Source/core/svg/SVGTextPathElement.cpp index 849980a..2697861 100644 --- a/third_party/WebKit/Source/core/svg/SVGTextPathElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGTextPathElement.cpp @@ -41,15 +41,14 @@ END_REGISTER_ANIMATED_PROPERTIES inline SVGTextPathElement::SVGTextPathElement(Document& document) : SVGTextContentElement(SVGNames::textPathTag, document) + , SVGURIReference(this) , m_startOffset(SVGAnimatedLength::create(this, SVGNames::startOffsetAttr, SVGLength::create(LengthModeOther))) - , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::create())) , m_method(SVGTextPathMethodAlign) , m_spacing(SVGTextPathSpacingExact) { ScriptWrappable::init(this); addToPropertyMap(m_startOffset); - addToPropertyMap(m_href); registerAnimatedPropertiesForSVGTextPathElement(); } @@ -84,11 +83,11 @@ void SVGTextPathElement::parseAttribute(const QualifiedName& name, const AtomicS { SVGParsingError parseError = NoError; - if (!isSupportedAttribute(name)) + if (!isSupportedAttribute(name)) { SVGTextContentElement::parseAttribute(name, value); - else if (name == SVGNames::startOffsetAttr) + } else if (name == SVGNames::startOffsetAttr) { m_startOffset->setBaseValueAsString(value, AllowNegativeLengths, parseError); - else if (name == SVGNames::methodAttr) { + } else if (name == SVGNames::methodAttr) { SVGTextPathMethodType propertyValue = SVGPropertyTraits<SVGTextPathMethodType>::fromString(value); if (propertyValue > 0) setMethodBaseValue(propertyValue); @@ -96,10 +95,10 @@ void SVGTextPathElement::parseAttribute(const QualifiedName& name, const AtomicS SVGTextPathSpacingType propertyValue = SVGPropertyTraits<SVGTextPathSpacingType>::fromString(value); if (propertyValue > 0) setSpacingBaseValue(propertyValue); - } else if (name.matches(XLinkNames::hrefAttr)) { - m_href->setBaseValueAsString(value, parseError); - } else + } else if (SVGURIReference::parseAttribute(name, value, parseError)) { + } else { ASSERT_NOT_REACHED(); + } reportAttributeParsingError(parseError, name, value); } @@ -147,7 +146,7 @@ void SVGTextPathElement::buildPendingResource() return; AtomicString id; - Element* target = SVGURIReference::targetElementFromIRIString(m_href->currentValue()->value(), document(), &id); + Element* target = SVGURIReference::targetElementFromIRIString(hrefString(), document(), &id); if (!target) { // Do not register as pending if we are already pending this resource. if (document().accessSVGExtensions()->isElementPendingResource(this, id)) diff --git a/third_party/WebKit/Source/core/svg/SVGTextPathElement.h b/third_party/WebKit/Source/core/svg/SVGTextPathElement.h index bcb3f90..aff4f1d 100644 --- a/third_party/WebKit/Source/core/svg/SVGTextPathElement.h +++ b/third_party/WebKit/Source/core/svg/SVGTextPathElement.h @@ -112,7 +112,6 @@ public: static PassRefPtr<SVGTextPathElement> create(Document&); SVGAnimatedLength* startOffset() const { return m_startOffset.get(); } - SVGAnimatedString* href() { return m_href.get(); } private: explicit SVGTextPathElement(Document&); @@ -135,7 +134,6 @@ private: virtual bool selfHasRelativeLengths() const OVERRIDE; RefPtr<SVGAnimatedLength> m_startOffset; - RefPtr<SVGAnimatedString> m_href; BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextPathElement) DECLARE_ANIMATED_ENUMERATION(Method, method, SVGTextPathMethodType) DECLARE_ANIMATED_ENUMERATION(Spacing, spacing, SVGTextPathSpacingType) diff --git a/third_party/WebKit/Source/core/svg/SVGURIReference.cpp b/third_party/WebKit/Source/core/svg/SVGURIReference.cpp index 6c3d871..240dd7f 100644 --- a/third_party/WebKit/Source/core/svg/SVGURIReference.cpp +++ b/third_party/WebKit/Source/core/svg/SVGURIReference.cpp @@ -19,14 +19,21 @@ */ #include "config.h" - #include "core/svg/SVGURIReference.h" #include "XLinkNames.h" +#include "core/svg/SVGElement.h" #include "platform/weborigin/KURL.h" namespace WebCore { +SVGURIReference::SVGURIReference(SVGElement* element) + : m_href(SVGAnimatedString::create(element, XLinkNames::hrefAttr, SVGString::create())) +{ + ASSERT(element); + element->addToPropertyMap(m_href); +} + bool SVGURIReference::isKnownAttribute(const QualifiedName& attrName) { return attrName.matches(XLinkNames::hrefAttr); @@ -93,4 +100,13 @@ void SVGURIReference::addSupportedAttributes(HashSet<QualifiedName>& supportedAt supportedAttributes.add(XLinkNames::hrefAttr); } +bool SVGURIReference::parseAttribute(const QualifiedName& name, const AtomicString& value, SVGParsingError& parseError) +{ + if (name.matches(XLinkNames::hrefAttr)) { + m_href->setBaseValueAsString(value, parseError); + return true; + } + return false; +} + } diff --git a/third_party/WebKit/Source/core/svg/SVGURIReference.h b/third_party/WebKit/Source/core/svg/SVGURIReference.h index ee59ed6..93d4d07 100644 --- a/third_party/WebKit/Source/core/svg/SVGURIReference.h +++ b/third_party/WebKit/Source/core/svg/SVGURIReference.h @@ -22,6 +22,7 @@ #define SVGURIReference_h #include "core/dom/Document.h" +#include "core/svg/SVGAnimatedString.h" namespace WebCore { @@ -48,6 +49,20 @@ public: KURL url = document.completeURL(uri); return !equalIgnoringFragmentIdentifier(url, document.url()); } + + // SVGURIReference JS API. + static SVGAnimatedString* href(SVGURIReference* object) { return object->href(); } + + SVGAnimatedString* href() const { return m_href.get(); } + const String& hrefString() const { return m_href->currentValue()->value(); } + + bool parseAttribute(const QualifiedName&, const AtomicString& value, SVGParsingError&); + +protected: + explicit SVGURIReference(SVGElement*); + +private: + RefPtr<SVGAnimatedString> m_href; }; } // namespace WebCore diff --git a/third_party/WebKit/Source/core/svg/SVGURIReference.idl b/third_party/WebKit/Source/core/svg/SVGURIReference.idl index bcc0efa..2e2d49f 100644 --- a/third_party/WebKit/Source/core/svg/SVGURIReference.idl +++ b/third_party/WebKit/Source/core/svg/SVGURIReference.idl @@ -25,8 +25,7 @@ */ [ - NoInterfaceObject, - LegacyImplementedInBaseClass + NoInterfaceObject ] interface SVGURIReference { readonly attribute SVGAnimatedString href; }; diff --git a/third_party/WebKit/Source/core/svg/SVGUseElement.cpp b/third_party/WebKit/Source/core/svg/SVGUseElement.cpp index 7c95013..5f27308 100644 --- a/third_party/WebKit/Source/core/svg/SVGUseElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGUseElement.cpp @@ -59,11 +59,11 @@ END_REGISTER_ANIMATED_PROPERTIES inline SVGUseElement::SVGUseElement(Document& document, bool wasInsertedByParser) : SVGGraphicsElement(SVGNames::useTag, document) + , SVGURIReference(this) , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(LengthModeWidth))) , 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) @@ -76,7 +76,6 @@ inline SVGUseElement::SVGUseElement(Document& document, bool wasInsertedByParser addToPropertyMap(m_y); addToPropertyMap(m_width); addToPropertyMap(m_height); - addToPropertyMap(m_href); registerAnimatedPropertiesForSVGUseElement(); } @@ -130,20 +129,20 @@ void SVGUseElement::parseAttribute(const QualifiedName& name, const AtomicString { SVGParsingError parseError = NoError; - if (!isSupportedAttribute(name)) + if (!isSupportedAttribute(name)) { SVGGraphicsElement::parseAttribute(name, value); - else if (name == SVGNames::xAttr) + } else if (name == SVGNames::xAttr) { m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); - else if (name == SVGNames::yAttr) + } else if (name == SVGNames::yAttr) { m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); - else if (name == SVGNames::widthAttr) + } else if (name == SVGNames::widthAttr) { m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError); - else if (name == SVGNames::heightAttr) + } else if (name == SVGNames::heightAttr) { m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError); - else if (name.matches(XLinkNames::hrefAttr)) - m_href->setBaseValueAsString(value, parseError); - else + } else if (SVGURIReference::parseAttribute(name, value, parseError)) { + } else { ASSERT_NOT_REACHED(); + } reportAttributeParsingError(parseError, name, value); } @@ -184,7 +183,7 @@ void SVGUseElement::removedFrom(ContainerNode* rootParent) Document* SVGUseElement::referencedDocument() const { - if (!isExternalURIReference(m_href->currentValue()->value(), document())) + if (!isExternalURIReference(hrefString(), document())) return &document(); return externalDocument(); } @@ -222,9 +221,9 @@ void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName) } if (SVGURIReference::isKnownAttribute(attrName)) { - bool isExternalReference = isExternalURIReference(m_href->currentValue()->value(), document()); + bool isExternalReference = isExternalURIReference(hrefString(), document()); if (isExternalReference) { - KURL url = document().completeURL(m_href->currentValue()->value()); + KURL url = document().completeURL(hrefString()); if (url.hasFragmentIdentifier()) { FetchRequest request(ResourceRequest(url.string()), localName()); setDocumentResource(document().fetcher()->fetchSVGDocument(request)); @@ -387,7 +386,7 @@ void SVGUseElement::buildPendingResource() return; AtomicString id; - Element* target = SVGURIReference::targetElementFromIRIString(m_href->currentValue()->value(), document(), &id, externalDocument()); + Element* target = SVGURIReference::targetElementFromIRIString(hrefString(), 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. @@ -622,7 +621,7 @@ void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* ta bool SVGUseElement::hasCycleUseReferencing(SVGUseElement* use, SVGElementInstance* targetInstance, SVGElement*& newTarget) { ASSERT(referencedDocument()); - Element* targetElement = SVGURIReference::targetElementFromIRIString(use->m_href->currentValue()->value(), *referencedDocument()); + Element* targetElement = SVGURIReference::targetElementFromIRIString(use->hrefString(), *referencedDocument()); newTarget = 0; if (targetElement && targetElement->isSVGElement()) newTarget = toSVGElement(targetElement); @@ -696,7 +695,7 @@ void SVGUseElement::expandUseElementsInShadowTree(Node* element) ASSERT(!use->resourceIsStillLoading()); ASSERT(referencedDocument()); - Element* targetElement = SVGURIReference::targetElementFromIRIString(use->m_href->currentValue()->value(), *referencedDocument()); + Element* targetElement = SVGURIReference::targetElementFromIRIString(use->hrefString(), *referencedDocument()); SVGElement* target = 0; if (targetElement && targetElement->isSVGElement()) target = toSVGElement(targetElement); diff --git a/third_party/WebKit/Source/core/svg/SVGUseElement.h b/third_party/WebKit/Source/core/svg/SVGUseElement.h index c7d7360..a7a0d5e 100644 --- a/third_party/WebKit/Source/core/svg/SVGUseElement.h +++ b/third_party/WebKit/Source/core/svg/SVGUseElement.h @@ -54,12 +54,11 @@ public: SVGAnimatedLength* height() const { return m_height.get(); } virtual void buildPendingResource() OVERRIDE; - SVGAnimatedString* href() { return m_href.get(); } private: SVGUseElement(Document&, bool wasInsertedByParser); - virtual bool isStructurallyExternal() const OVERRIDE { return !m_href->currentValue()->value().isNull() && isExternalURIReference(m_href->currentValue()->value(), document()); } + virtual bool isStructurallyExternal() const OVERRIDE { return !hrefString().isNull() && isExternalURIReference(hrefString(), document()); } virtual bool supportsFocus() const OVERRIDE { return hasFocusEventListeners(); } @@ -104,7 +103,6 @@ private: RefPtr<SVGAnimatedLength> m_y; RefPtr<SVGAnimatedLength> m_width; RefPtr<SVGAnimatedLength> m_height; - RefPtr<SVGAnimatedString> m_href; BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGUseElement) END_DECLARE_ANIMATED_PROPERTIES |