| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "config.h" | 21 #include "config.h" |
| 22 | 22 |
| 23 #include "core/svg/SVGScriptElement.h" | 23 #include "core/svg/SVGScriptElement.h" |
| 24 | 24 |
| 25 #include "HTMLNames.h" | 25 #include "HTMLNames.h" |
| 26 #include "XLinkNames.h" | 26 #include "XLinkNames.h" |
| 27 #include "bindings/v8/ScriptEventListener.h" | 27 #include "bindings/v8/ScriptEventListener.h" |
| 28 #include "core/dom/Attribute.h" | 28 #include "core/dom/Attribute.h" |
| 29 #include "core/dom/Document.h" | 29 #include "core/dom/Document.h" |
| 30 #include "core/dom/EventNames.h" | 30 #include "core/dom/EventNames.h" |
| 31 #include "core/dom/ScriptLoader.h" |
| 31 #include "core/svg/SVGElementInstance.h" | 32 #include "core/svg/SVGElementInstance.h" |
| 32 #include "core/svg/properties/SVGAnimatedStaticPropertyTearOff.h" | 33 #include "core/svg/properties/SVGAnimatedStaticPropertyTearOff.h" |
| 33 | 34 |
| 34 namespace WebCore { | 35 namespace WebCore { |
| 35 | 36 |
| 36 // Animated property definitions | 37 // Animated property definitions |
| 37 DEFINE_ANIMATED_STRING(SVGScriptElement, XLinkNames::hrefAttr, Href, href) | 38 DEFINE_ANIMATED_STRING(SVGScriptElement, XLinkNames::hrefAttr, Href, href) |
| 38 DEFINE_ANIMATED_BOOLEAN(SVGScriptElement, SVGNames::externalResourcesRequiredAtt
r, ExternalResourcesRequired, externalResourcesRequired) | 39 DEFINE_ANIMATED_BOOLEAN(SVGScriptElement, SVGNames::externalResourcesRequiredAtt
r, ExternalResourcesRequired, externalResourcesRequired) |
| 39 | 40 |
| 40 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGScriptElement) | 41 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGScriptElement) |
| 41 REGISTER_LOCAL_ANIMATED_PROPERTY(href) | 42 REGISTER_LOCAL_ANIMATED_PROPERTY(href) |
| 42 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | 43 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) |
| 43 END_REGISTER_ANIMATED_PROPERTIES | 44 END_REGISTER_ANIMATED_PROPERTIES |
| 44 | 45 |
| 45 inline SVGScriptElement::SVGScriptElement(const QualifiedName& tagName, Document
* document, bool wasInsertedByParser, bool alreadyStarted) | 46 inline SVGScriptElement::SVGScriptElement(const QualifiedName& tagName, Document
* document, bool wasInsertedByParser, bool alreadyStarted) |
| 46 : SVGElement(tagName, document) | 47 : SVGElement(tagName, document) |
| 47 , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired) | 48 , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired) |
| 48 , m_scriptElement(ScriptElement::create(this, wasInsertedByParser, alreadySt
arted)) | 49 , m_loader(ScriptLoader::create(this, wasInsertedByParser, alreadyStarted)) |
| 49 { | 50 { |
| 50 ASSERT(hasTagName(SVGNames::scriptTag)); | 51 ASSERT(hasTagName(SVGNames::scriptTag)); |
| 51 ScriptWrappable::init(this); | 52 ScriptWrappable::init(this); |
| 52 registerAnimatedPropertiesForSVGScriptElement(); | 53 registerAnimatedPropertiesForSVGScriptElement(); |
| 53 } | 54 } |
| 54 | 55 |
| 55 PassRefPtr<SVGScriptElement> SVGScriptElement::create(const QualifiedName& tagNa
me, Document* document, bool insertedByParser) | 56 PassRefPtr<SVGScriptElement> SVGScriptElement::create(const QualifiedName& tagNa
me, Document* document, bool insertedByParser) |
| 56 { | 57 { |
| 57 return adoptRef(new SVGScriptElement(tagName, document, insertedByParser, fa
lse)); | 58 return adoptRef(new SVGScriptElement(tagName, document, insertedByParser, fa
lse)); |
| 58 } | 59 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 SVGElement::svgAttributeChanged(attrName); | 101 SVGElement::svgAttributeChanged(attrName); |
| 101 return; | 102 return; |
| 102 } | 103 } |
| 103 | 104 |
| 104 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 105 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
| 105 | 106 |
| 106 if (attrName == SVGNames::typeAttr || attrName == HTMLNames::onerrorAttr) | 107 if (attrName == SVGNames::typeAttr || attrName == HTMLNames::onerrorAttr) |
| 107 return; | 108 return; |
| 108 | 109 |
| 109 if (SVGURIReference::isKnownAttribute(attrName)) { | 110 if (SVGURIReference::isKnownAttribute(attrName)) { |
| 110 m_scriptElement->handleSourceAttribute(href()); | 111 m_loader->handleSourceAttribute(href()); |
| 111 return; | 112 return; |
| 112 } | 113 } |
| 113 | 114 |
| 114 if (SVGExternalResourcesRequired::handleAttributeChange(this, attrName)) | 115 if (SVGExternalResourcesRequired::handleAttributeChange(this, attrName)) |
| 115 return; | 116 return; |
| 116 | 117 |
| 117 ASSERT_NOT_REACHED(); | 118 ASSERT_NOT_REACHED(); |
| 118 } | 119 } |
| 119 | 120 |
| 120 Node::InsertionNotificationRequest SVGScriptElement::insertedInto(ContainerNode*
rootParent) | 121 Node::InsertionNotificationRequest SVGScriptElement::insertedInto(ContainerNode*
rootParent) |
| 121 { | 122 { |
| 122 SVGElement::insertedInto(rootParent); | 123 SVGElement::insertedInto(rootParent); |
| 123 m_scriptElement->insertedInto(rootParent); | 124 m_loader->insertedInto(rootParent); |
| 124 if (rootParent->inDocument()) | 125 if (rootParent->inDocument()) |
| 125 SVGExternalResourcesRequired::insertedIntoDocument(this); | 126 SVGExternalResourcesRequired::insertedIntoDocument(this); |
| 126 return InsertionDone; | 127 return InsertionDone; |
| 127 } | 128 } |
| 128 | 129 |
| 129 void SVGScriptElement::childrenChanged(bool changedByParser, Node* beforeChange,
Node* afterChange, int childCountDelta) | 130 void SVGScriptElement::childrenChanged(bool changedByParser, Node* beforeChange,
Node* afterChange, int childCountDelta) |
| 130 { | 131 { |
| 131 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil
dCountDelta); | 132 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil
dCountDelta); |
| 132 m_scriptElement->childrenChanged(); | 133 m_loader->childrenChanged(); |
| 133 } | 134 } |
| 134 | 135 |
| 135 bool SVGScriptElement::isURLAttribute(const Attribute& attribute) const | 136 bool SVGScriptElement::isURLAttribute(const Attribute& attribute) const |
| 136 { | 137 { |
| 137 return attribute.name() == sourceAttributeValue(); | 138 return attribute.name() == sourceAttributeValue(); |
| 138 } | 139 } |
| 139 | 140 |
| 140 void SVGScriptElement::finishParsingChildren() | 141 void SVGScriptElement::finishParsingChildren() |
| 141 { | 142 { |
| 142 SVGElement::finishParsingChildren(); | 143 SVGElement::finishParsingChildren(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 return false; | 201 return false; |
| 201 } | 202 } |
| 202 | 203 |
| 203 bool SVGScriptElement::hasSourceAttribute() const | 204 bool SVGScriptElement::hasSourceAttribute() const |
| 204 { | 205 { |
| 205 return hasAttribute(XLinkNames::hrefAttr); | 206 return hasAttribute(XLinkNames::hrefAttr); |
| 206 } | 207 } |
| 207 | 208 |
| 208 PassRefPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren() | 209 PassRefPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren() |
| 209 { | 210 { |
| 210 return adoptRef(new SVGScriptElement(tagQName(), document(), false, m_script
Element->alreadyStarted())); | 211 return adoptRef(new SVGScriptElement(tagQName(), document(), false, m_loader
->alreadyStarted())); |
| 211 } | 212 } |
| 212 | 213 |
| 213 void SVGScriptElement::setHaveFiredLoadEvent(bool haveFiredLoadEvent) | 214 void SVGScriptElement::setHaveFiredLoadEvent(bool haveFiredLoadEvent) |
| 214 { | 215 { |
| 215 m_scriptElement->setHaveFiredLoadEvent(haveFiredLoadEvent); | 216 m_loader->setHaveFiredLoadEvent(haveFiredLoadEvent); |
| 216 } | 217 } |
| 217 | 218 |
| 218 bool SVGScriptElement::isParserInserted() const | 219 bool SVGScriptElement::isParserInserted() const |
| 219 { | 220 { |
| 220 return m_scriptElement->isParserInserted(); | 221 return m_loader->isParserInserted(); |
| 221 } | 222 } |
| 222 | 223 |
| 223 bool SVGScriptElement::haveFiredLoadEvent() const | 224 bool SVGScriptElement::haveFiredLoadEvent() const |
| 224 { | 225 { |
| 225 return m_scriptElement->haveFiredLoadEvent(); | 226 return m_loader->haveFiredLoadEvent(); |
| 226 } | 227 } |
| 227 | 228 |
| 228 Timer<SVGElement>* SVGScriptElement::svgLoadEventTimer() | 229 Timer<SVGElement>* SVGScriptElement::svgLoadEventTimer() |
| 229 { | 230 { |
| 230 return &m_svgLoadEventTimer; | 231 return &m_svgLoadEventTimer; |
| 231 } | 232 } |
| 232 | 233 |
| 233 } | 234 } |
| OLD | NEW |