Chromium Code Reviews| Index: third_party/WebKit/Source/core/svg/SVGScriptElement.cpp |
| diff --git a/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp b/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp |
| index a6a3a319650152a6693ff50ea8e43ea2ca875998..b1a83bb488fc2a9eb9347d91c301ce315ee8b75f 100644 |
| --- a/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp |
| +++ b/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp |
| @@ -22,6 +22,7 @@ |
| #include "bindings/core/v8/ScriptEventListener.h" |
| #include "core/HTMLNames.h" |
| +#include "core/XLinkNames.h" |
| #include "core/dom/Attribute.h" |
| #include "core/dom/ScriptLoader.h" |
| #include "core/dom/ScriptRunner.h" |
| @@ -33,7 +34,7 @@ inline SVGScriptElement::SVGScriptElement(Document& document, |
| bool wasInsertedByParser, |
| bool alreadyStarted) |
| : SVGElement(SVGNames::scriptTag, document), |
| - SVGURIReference(this), |
| + SVGURIReference(this, SVGURIReference::DoNotAddToPropertyMap), |
| m_loader( |
| ScriptLoader::create(this, wasInsertedByParser, alreadyStarted)) {} |
| @@ -45,22 +46,16 @@ SVGScriptElement* SVGScriptElement::create(Document& document, |
| void SVGScriptElement::parseAttribute(const QualifiedName& name, |
| const AtomicString& oldValue, |
| const AtomicString& value) { |
| - if (name == HTMLNames::onerrorAttr) |
| + if (name == HTMLNames::onerrorAttr) { |
| setAttributeEventListener( |
| EventTypeNames::error, |
| createAttributeEventListener(this, name, value, eventParameterName())); |
| - else |
| + } else if (name.matches(SVGNames::hrefAttr) || |
| + name.matches(XLinkNames::hrefAttr)) { |
| + m_loader->handleSourceAttribute(sourceAttributeValue()); |
| + } else { |
| SVGElement::parseAttribute(name, oldValue, value); |
| -} |
| - |
| -void SVGScriptElement::svgAttributeChanged(const QualifiedName& attrName) { |
| - if (SVGURIReference::isKnownAttribute(attrName)) { |
| - SVGElement::InvalidationGuard invalidationGuard(this); |
| - m_loader->handleSourceAttribute(hrefString()); |
| - return; |
| } |
| - |
| - SVGElement::svgAttributeChanged(attrName); |
| } |
| Node::InsertionNotificationRequest SVGScriptElement::insertedInto( |
| @@ -87,6 +82,7 @@ void SVGScriptElement::didMoveToNewDocument(Document& oldDocument) { |
| } |
| bool SVGScriptElement::isURLAttribute(const Attribute& attribute) const { |
| + // TODO(fs): Recover head rotation. |
|
pdr.
2017/01/09 18:50:47
O_o
fs
2017/01/10 10:15:16
Yes, this function is obviously broken (or, when i
|
| return attribute.name() == AtomicString(sourceAttributeValue()); |
| } |
| @@ -100,7 +96,7 @@ bool SVGScriptElement::haveLoadedRequiredResources() { |
| } |
| String SVGScriptElement::sourceAttributeValue() const { |
| - return hrefString(); |
| + return SVGURIReference::legacyHrefString(*this).getString(); |
| } |
| String SVGScriptElement::charsetAttributeValue() const { |
| @@ -132,7 +128,8 @@ bool SVGScriptElement::deferAttributeValue() const { |
| } |
| bool SVGScriptElement::hasSourceAttribute() const { |
| - return href()->isSpecified(); |
| + return fastHasAttribute(SVGNames::hrefAttr) || |
| + fastHasAttribute(XLinkNames::hrefAttr); |
| } |
| Element* SVGScriptElement::cloneElementWithoutAttributesAndChildren() { |
| @@ -145,9 +142,8 @@ void SVGScriptElement::dispatchLoadEvent() { |
| #if DCHECK_IS_ON() |
| bool SVGScriptElement::isAnimatableAttribute(const QualifiedName& name) const { |
| - if (name == SVGNames::typeAttr) |
| + if (name == SVGNames::typeAttr || name == SVGNames::hrefAttr) |
|
Mike West
2017/01/09 19:31:19
XLinkNames::hrefAttr?
|
| return false; |
| - |
| return SVGElement::isAnimatableAttribute(name); |
| } |
| #endif |