Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Unified Diff: third_party/WebKit/Source/core/svg/SVGAnimatedHref.cpp

Issue 1697593002: Simplify SVGAnimatedHref (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Now with less infinite recursion! Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAnimatedHref.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/svg/SVGAnimatedHref.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGAnimatedHref.cpp b/third_party/WebKit/Source/core/svg/SVGAnimatedHref.cpp
index 9202a54f3fae2f588013ed2524254ae642cb1f65..6c5b73fa5abc9b619c1219a5f5d8ea7ddec0c220 100644
--- a/third_party/WebKit/Source/core/svg/SVGAnimatedHref.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGAnimatedHref.cpp
@@ -18,21 +18,19 @@ PassRefPtrWillBeRawPtr<SVGAnimatedHref> SVGAnimatedHref::create(SVGElement* cont
DEFINE_TRACE(SVGAnimatedHref)
{
- visitor->trace(m_href);
visitor->trace(m_xlinkHref);
SVGAnimatedString::trace(visitor);
}
SVGAnimatedHref::SVGAnimatedHref(SVGElement* contextElement)
- : SVGAnimatedString(contextElement, SVGNames::hrefAttr, nullptr)
- , m_href(SVGAnimatedString::create(contextElement, SVGNames::hrefAttr, SVGString::create()))
+ : SVGAnimatedString(contextElement, SVGNames::hrefAttr, SVGString::create())
, m_xlinkHref(SVGAnimatedString::create(contextElement, XLinkNames::hrefAttr, SVGString::create()))
{
}
void SVGAnimatedHref::addToPropertyMap(SVGElement* element)
{
- element->addToPropertyMap(m_href);
+ element->addToPropertyMap(this);
element->addToPropertyMap(m_xlinkHref);
}
@@ -41,83 +39,48 @@ bool SVGAnimatedHref::isKnownAttribute(const QualifiedName& attrName)
return attrName.matches(SVGNames::hrefAttr) || attrName.matches(XLinkNames::hrefAttr);
}
-SVGPropertyBase* SVGAnimatedHref::currentValueBase()
+SVGString* SVGAnimatedHref::currentValue()
{
- ASSERT_NOT_REACHED();
- return nullptr;
+ return backingString()->SVGAnimatedString::currentValue();
}
-const SVGPropertyBase& SVGAnimatedHref::baseValueBase() const
+const SVGString* SVGAnimatedHref::currentValue() const
{
- ASSERT_NOT_REACHED();
- return SVGAnimatedString::baseValueBase();
-}
-
-bool SVGAnimatedHref::isAnimating() const
-{
- ASSERT_NOT_REACHED();
- return false;
-}
-
-PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGAnimatedHref::createAnimatedValue()
-{
- ASSERT_NOT_REACHED();
- return nullptr;
-}
-
-void SVGAnimatedHref::setAnimatedValue(PassRefPtrWillBeRawPtr<SVGPropertyBase>)
-{
- ASSERT_NOT_REACHED();
-}
-
-void SVGAnimatedHref::animationEnded()
-{
- ASSERT_NOT_REACHED();
-}
-
-SVGParsingError SVGAnimatedHref::setBaseValueAsString(const String&)
-{
- ASSERT_NOT_REACHED();
- return SVGParseStatus::NoError;
-}
-
-bool SVGAnimatedHref::needsSynchronizeAttribute()
-{
- ASSERT_NOT_REACHED();
- return false;
-}
-
-void SVGAnimatedHref::synchronizeAttribute()
-{
- ASSERT_NOT_REACHED();
+ return backingString()->SVGAnimatedString::currentValue();
}
String SVGAnimatedHref::baseVal()
{
UseCounter::count(contextElement()->document(), UseCounter::SVGHrefBaseVal);
- return backingHref()->baseVal();
+ return backingString()->SVGAnimatedString::baseVal();
}
void SVGAnimatedHref::setBaseVal(const String& value, ExceptionState& exceptionState)
{
UseCounter::count(contextElement()->document(), UseCounter::SVGHrefBaseVal);
- backingHref()->setBaseVal(value, exceptionState);
+ return backingString()->SVGAnimatedString::setBaseVal(value, exceptionState);
}
String SVGAnimatedHref::animVal()
{
UseCounter::count(contextElement()->document(), UseCounter::SVGHrefAnimVal);
// We should only animate (non-XLink) 'href'.
- return m_href->animVal();
+ return SVGAnimatedString::animVal();
+}
+
+SVGAnimatedString* SVGAnimatedHref::backingString()
+{
+ return useXLink() ? m_xlinkHref.get() : this;
+}
+
+const SVGAnimatedString* SVGAnimatedHref::backingString() const
+{
+ return useXLink() ? m_xlinkHref.get() : this;
}
-SVGAnimatedString* SVGAnimatedHref::backingHref() const
+bool SVGAnimatedHref::useXLink() const
{
- if (m_href->isSpecified())
- return m_href.get();
- if (m_xlinkHref->isSpecified())
- return m_xlinkHref.get();
- return m_href.get();
+ return !SVGAnimatedString::isSpecified() && m_xlinkHref->isSpecified();
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAnimatedHref.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698