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

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: Rebase; update comment 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/UnsafeSVGAttributeSanitizationTest.cpp ('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/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..ecfbc709bf0ef80354af26eda7abbbc6d61acf89 100644
--- a/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp
+++ b/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp
@@ -239,7 +239,7 @@ void SVGSMILElement::buildPendingResource()
}
AtomicString id;
- AtomicString href = getAttribute(XLinkNames::hrefAttr);
+ const AtomicString& href = SVGURIReference::legacyHrefString(*this);
Element* target;
if (href.isEmpty())
target = parentNode() && parentNode()->isElementNode() ? toElement(parentNode()) : nullptr;
@@ -287,7 +287,13 @@ static inline QualifiedName constructQualifiedName(const SVGElement* svgElement,
if (namespaceURI.isEmpty())
return anyQName();
- return QualifiedName(nullAtom, localName, namespaceURI);
+ QualifiedName resolvedAttrName(nullAtom, localName, namespaceURI);
+ // "Animation elements treat attributeName='xlink:href' as being an alias
+ // for targetting the 'href' attribute."
+ // https://svgwg.org/svg2-draft/types.html#__svg__SVGURIReference__href
+ 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)
« no previous file with comments | « third_party/WebKit/Source/core/svg/UnsafeSVGAttributeSanitizationTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698