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

Unified Diff: third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp

Issue 1681553002: Add support for 'href' (w/o XLink NS) for various SVG elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove invalid assert. 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
Index: third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp b/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp
index 2f4c6b338876ab592123f9a37c06fff7e66ad0e6..d7b95a2b1eba1641ad68194c37b562bbcaa77589 100644
--- a/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp
+++ b/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp
@@ -239,7 +239,9 @@ void SVGSMILElement::buildPendingResource()
}
AtomicString id;
- AtomicString href = getAttribute(XLinkNames::hrefAttr);
+ AtomicString href = getAttribute(SVGNames::hrefAttr);
pdr. 2016/02/09 23:17:07 Can we use Element::hrefURL here?
fs 2016/02/10 14:44:46 We probably could (considering SVGSMILElements are
fs 2016/02/11 13:35:12 I did an attempt at "hiding" the details a bit. No
+ if (href.isNull())
+ href = getAttribute(XLinkNames::hrefAttr);
Element* target;
if (href.isEmpty())
target = parentNode() && parentNode()->isElementNode() ? toElement(parentNode()) : nullptr;
@@ -287,7 +289,11 @@ static inline QualifiedName constructQualifiedName(const SVGElement* svgElement,
if (namespaceURI.isEmpty())
return anyQName();
- return QualifiedName(nullAtom, localName, namespaceURI);
+ QualifiedName resolvedAttrName(nullAtom, localName, namespaceURI);
+ // 'xlink:href' should map to 'href' for animation purposes. (It's possible that I just dreamt this.)
+ if (resolvedAttrName == XLinkNames::hrefAttr)
+ return SVGNames::hrefAttr;
+ return resolvedAttrName;
}
static inline void clearTimesWithDynamicOrigins(Vector<SMILTimeWithOrigin>& timeList)
@@ -544,19 +550,20 @@ void SVGSMILElement::parseAttribute(const QualifiedName& name, const AtomicStrin
void SVGSMILElement::svgAttributeChanged(const QualifiedName& attrName)
{
- if (attrName == SVGNames::durAttr)
+ if (attrName == SVGNames::durAttr) {
m_cachedDur = invalidCachedTime;
- else if (attrName == SVGNames::repeatDurAttr)
+ } else if (attrName == SVGNames::repeatDurAttr) {
m_cachedRepeatDur = invalidCachedTime;
- else if (attrName == SVGNames::repeatCountAttr)
+ } else if (attrName == SVGNames::repeatCountAttr) {
m_cachedRepeatCount = invalidCachedTime;
- else if (attrName == SVGNames::minAttr)
+ } else if (attrName == SVGNames::minAttr) {
m_cachedMin = invalidCachedTime;
- else if (attrName == SVGNames::maxAttr)
+ } else if (attrName == SVGNames::maxAttr) {
m_cachedMax = invalidCachedTime;
- else if (attrName == SVGNames::attributeNameAttr)
+ } else if (attrName == SVGNames::attributeNameAttr) {
setAttributeName(constructQualifiedName(this, fastGetAttribute(SVGNames::attributeNameAttr)));
- else if (attrName.matches(XLinkNames::hrefAttr)) {
+ } else if (attrName.matches(SVGNames::hrefAttr) || attrName.matches(XLinkNames::hrefAttr)) {
+ // TODO(fs): Could be smarter here when 'href' is specified and 'xlink:href' is changed.
SVGElement::InvalidationGuard invalidationGuard(this);
buildPendingResource();
if (m_targetElement)

Powered by Google App Engine
This is Rietveld 408576698