diff options
Diffstat (limited to 'Source/WebCore/svg/SVGScriptElement.cpp')
-rw-r--r-- | Source/WebCore/svg/SVGScriptElement.cpp | 96 |
1 files changed, 26 insertions, 70 deletions
diff --git a/Source/WebCore/svg/SVGScriptElement.cpp b/Source/WebCore/svg/SVGScriptElement.cpp index a53fbd5ea..d6649fa10 100644 --- a/Source/WebCore/svg/SVGScriptElement.cpp +++ b/Source/WebCore/svg/SVGScriptElement.cpp @@ -19,17 +19,11 @@ */ #include "config.h" - -#if ENABLE(SVG) #include "SVGScriptElement.h" -#include "Attribute.h" #include "Document.h" #include "Event.h" -#include "EventNames.h" -#include "HTMLNames.h" #include "SVGAnimatedStaticPropertyTearOff.h" -#include "SVGElementInstance.h" #include "XLinkNames.h" namespace WebCore { @@ -45,93 +39,55 @@ END_REGISTER_ANIMATED_PROPERTIES inline SVGScriptElement::SVGScriptElement(const QualifiedName& tagName, Document& document, bool wasInsertedByParser, bool alreadyStarted) : SVGElement(tagName, document) - , ScriptElement(this, wasInsertedByParser, alreadyStarted) - , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired) + , ScriptElement(*this, wasInsertedByParser, alreadyStarted) + , m_svgLoadEventTimer(*this, &SVGElement::svgLoadEventTimerFired) { ASSERT(hasTagName(SVGNames::scriptTag)); registerAnimatedPropertiesForSVGScriptElement(); } -PassRefPtr<SVGScriptElement> SVGScriptElement::create(const QualifiedName& tagName, Document& document, bool insertedByParser) -{ - return adoptRef(new SVGScriptElement(tagName, document, insertedByParser, false)); -} - -bool SVGScriptElement::isSupportedAttribute(const QualifiedName& attrName) +Ref<SVGScriptElement> SVGScriptElement::create(const QualifiedName& tagName, Document& document, bool insertedByParser) { - DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); - if (supportedAttributes.isEmpty()) { - SVGURIReference::addSupportedAttributes(supportedAttributes); - SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes); - supportedAttributes.add(SVGNames::typeAttr); - supportedAttributes.add(HTMLNames::onerrorAttr); - } - return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); + return adoptRef(*new SVGScriptElement(tagName, document, insertedByParser, false)); } void SVGScriptElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { - if (!isSupportedAttribute(name)) { - SVGElement::parseAttribute(name, value); - return; - } - - if (name == SVGNames::typeAttr) - return; - - if (name == HTMLNames::onerrorAttr) { - setAttributeEventListener(eventNames().errorEvent, name, value); - return; - } - - if (SVGURIReference::parseAttribute(name, value)) - return; - if (SVGExternalResourcesRequired::parseAttribute(name, value)) - return; - - ASSERT_NOT_REACHED(); + SVGElement::parseAttribute(name, value); + SVGURIReference::parseAttribute(name, value); + SVGExternalResourcesRequired::parseAttribute(name, value); } void SVGScriptElement::svgAttributeChanged(const QualifiedName& attrName) { - if (!isSupportedAttribute(attrName)) { - SVGElement::svgAttributeChanged(attrName); - return; - } - - SVGElementInstance::InvalidationGuard invalidationGuard(this); - - if (attrName == SVGNames::typeAttr || attrName == HTMLNames::onerrorAttr) - return; + InstanceInvalidationGuard guard(*this); if (SVGURIReference::isKnownAttribute(attrName)) { handleSourceAttribute(href()); return; } - if (SVGExternalResourcesRequired::handleAttributeChange(this, attrName)) - return; - - ASSERT_NOT_REACHED(); + SVGExternalResourcesRequired::handleAttributeChange(this, attrName); + SVGElement::svgAttributeChanged(attrName); } Node::InsertionNotificationRequest SVGScriptElement::insertedInto(ContainerNode& rootParent) { SVGElement::insertedInto(rootParent); - if (rootParent.inDocument()) + if (rootParent.isConnected()) SVGExternalResourcesRequired::insertedIntoDocument(this); - return shouldNotifySubtreeInsertions(rootParent) ? InsertionShouldCallDidNotifySubtreeInsertions : InsertionDone; + return shouldCallFinishedInsertingSubtree(rootParent) ? InsertionShouldCallFinishedInsertingSubtree : InsertionDone; } -void SVGScriptElement::didNotifySubtreeInsertions(ContainerNode* node) +void SVGScriptElement::finishedInsertingSubtree() { - ScriptElement::didNotifySubtreeInsertions(node); + ScriptElement::finishedInsertingSubtree(); } void SVGScriptElement::childrenChanged(const ChildChange& change) { SVGElement::childrenChanged(change); - ScriptElement::childrenChanged(); + ScriptElement::childrenChanged(change); } bool SVGScriptElement::isURLAttribute(const Attribute& attribute) const @@ -182,12 +138,17 @@ String SVGScriptElement::eventAttributeValue() const return String(); } -bool SVGScriptElement::asyncAttributeValue() const +bool SVGScriptElement::hasAsyncAttribute() const { return false; } -bool SVGScriptElement::deferAttributeValue() const +bool SVGScriptElement::hasDeferAttribute() const +{ + return false; +} + +bool SVGScriptElement::hasNoModuleAttribute() const { return false; } @@ -197,21 +158,16 @@ bool SVGScriptElement::hasSourceAttribute() const return hasAttribute(XLinkNames::hrefAttr); } -PassRefPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren() +Ref<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren(Document& targetDocument) { - return adoptRef(new SVGScriptElement(tagQName(), document(), false, alreadyStarted())); + return adoptRef(*new SVGScriptElement(tagQName(), targetDocument, false, alreadyStarted())); } #ifndef NDEBUG -bool SVGScriptElement::isAnimatableAttribute(const QualifiedName& name) const +bool SVGScriptElement::filterOutAnimatableAttribute(const QualifiedName& name) const { - if (name == SVGNames::typeAttr) - return false; - - return SVGElement::isAnimatableAttribute(name); + return name == SVGNames::typeAttr; } #endif } - -#endif // ENABLE(SVG) |