| 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 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 namespace WebCore { | 35 namespace WebCore { |
| 36 | 36 |
| 37 // Animated property definitions | 37 // Animated property definitions |
| 38 | 38 |
| 39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGScriptElement) | 39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGScriptElement) |
| 40 END_REGISTER_ANIMATED_PROPERTIES | 40 END_REGISTER_ANIMATED_PROPERTIES |
| 41 | 41 |
| 42 inline SVGScriptElement::SVGScriptElement(Document& document, bool wasInsertedBy
Parser, bool alreadyStarted) | 42 inline SVGScriptElement::SVGScriptElement(Document& document, bool wasInsertedBy
Parser, bool alreadyStarted) |
| 43 : SVGElement(SVGNames::scriptTag, document) | 43 : SVGElement(SVGNames::scriptTag, document) |
| 44 , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::cr
eate())) | 44 , SVGURIReference(this) |
| 45 , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired) | 45 , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired) |
| 46 , m_loader(ScriptLoader::create(this, wasInsertedByParser, alreadyStarted)) | 46 , m_loader(ScriptLoader::create(this, wasInsertedByParser, alreadyStarted)) |
| 47 { | 47 { |
| 48 ScriptWrappable::init(this); | 48 ScriptWrappable::init(this); |
| 49 addToPropertyMap(m_href); | |
| 50 registerAnimatedPropertiesForSVGScriptElement(); | 49 registerAnimatedPropertiesForSVGScriptElement(); |
| 51 } | 50 } |
| 52 | 51 |
| 53 PassRefPtr<SVGScriptElement> SVGScriptElement::create(Document& document, bool i
nsertedByParser) | 52 PassRefPtr<SVGScriptElement> SVGScriptElement::create(Document& document, bool i
nsertedByParser) |
| 54 { | 53 { |
| 55 return adoptRef(new SVGScriptElement(document, insertedByParser, false)); | 54 return adoptRef(new SVGScriptElement(document, insertedByParser, false)); |
| 56 } | 55 } |
| 57 | 56 |
| 58 bool SVGScriptElement::isSupportedAttribute(const QualifiedName& attrName) | 57 bool SVGScriptElement::isSupportedAttribute(const QualifiedName& attrName) |
| 59 { | 58 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 70 { | 69 { |
| 71 if (!isSupportedAttribute(name)) { | 70 if (!isSupportedAttribute(name)) { |
| 72 SVGElement::parseAttribute(name, value); | 71 SVGElement::parseAttribute(name, value); |
| 73 return; | 72 return; |
| 74 } | 73 } |
| 75 | 74 |
| 76 SVGParsingError parseError = NoError; | 75 SVGParsingError parseError = NoError; |
| 77 if (name == SVGNames::typeAttr) | 76 if (name == SVGNames::typeAttr) |
| 78 return; | 77 return; |
| 79 | 78 |
| 80 if (name == HTMLNames::onerrorAttr) | 79 if (name == HTMLNames::onerrorAttr) { |
| 81 setAttributeEventListener(EventTypeNames::error, createAttributeEventLis
tener(this, name, value)); | 80 setAttributeEventListener(EventTypeNames::error, createAttributeEventLis
tener(this, name, value)); |
| 82 else if (name.matches(XLinkNames::hrefAttr)) | 81 } else if (SVGURIReference::parseAttribute(name, value, parseError)) { |
| 83 m_href->setBaseValueAsString(value, parseError); | 82 } else { |
| 84 else | |
| 85 ASSERT_NOT_REACHED(); | 83 ASSERT_NOT_REACHED(); |
| 84 } |
| 86 | 85 |
| 87 reportAttributeParsingError(parseError, name, value); | 86 reportAttributeParsingError(parseError, name, value); |
| 88 } | 87 } |
| 89 | 88 |
| 90 void SVGScriptElement::svgAttributeChanged(const QualifiedName& attrName) | 89 void SVGScriptElement::svgAttributeChanged(const QualifiedName& attrName) |
| 91 { | 90 { |
| 92 if (!isSupportedAttribute(attrName)) { | 91 if (!isSupportedAttribute(attrName)) { |
| 93 SVGElement::svgAttributeChanged(attrName); | 92 SVGElement::svgAttributeChanged(attrName); |
| 94 return; | 93 return; |
| 95 } | 94 } |
| 96 | 95 |
| 97 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 96 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
| 98 | 97 |
| 99 if (attrName == SVGNames::typeAttr || attrName == HTMLNames::onerrorAttr) | 98 if (attrName == SVGNames::typeAttr || attrName == HTMLNames::onerrorAttr) |
| 100 return; | 99 return; |
| 101 | 100 |
| 102 if (SVGURIReference::isKnownAttribute(attrName)) { | 101 if (SVGURIReference::isKnownAttribute(attrName)) { |
| 103 m_loader->handleSourceAttribute(m_href->currentValue()->value()); | 102 m_loader->handleSourceAttribute(hrefString()); |
| 104 return; | 103 return; |
| 105 } | 104 } |
| 106 | 105 |
| 107 ASSERT_NOT_REACHED(); | 106 ASSERT_NOT_REACHED(); |
| 108 } | 107 } |
| 109 | 108 |
| 110 Node::InsertionNotificationRequest SVGScriptElement::insertedInto(ContainerNode*
rootParent) | 109 Node::InsertionNotificationRequest SVGScriptElement::insertedInto(ContainerNode*
rootParent) |
| 111 { | 110 { |
| 112 SVGElement::insertedInto(rootParent); | 111 SVGElement::insertedInto(rootParent); |
| 113 return InsertionShouldCallDidNotifySubtreeInsertions; | 112 return InsertionShouldCallDidNotifySubtreeInsertions; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 140 m_loader->setHaveFiredLoadEvent(true); | 139 m_loader->setHaveFiredLoadEvent(true); |
| 141 } | 140 } |
| 142 | 141 |
| 143 bool SVGScriptElement::haveLoadedRequiredResources() | 142 bool SVGScriptElement::haveLoadedRequiredResources() |
| 144 { | 143 { |
| 145 return m_loader->haveFiredLoadEvent(); | 144 return m_loader->haveFiredLoadEvent(); |
| 146 } | 145 } |
| 147 | 146 |
| 148 String SVGScriptElement::sourceAttributeValue() const | 147 String SVGScriptElement::sourceAttributeValue() const |
| 149 { | 148 { |
| 150 return m_href->currentValue()->value(); | 149 return hrefString(); |
| 151 } | 150 } |
| 152 | 151 |
| 153 String SVGScriptElement::charsetAttributeValue() const | 152 String SVGScriptElement::charsetAttributeValue() const |
| 154 { | 153 { |
| 155 return String(); | 154 return String(); |
| 156 } | 155 } |
| 157 | 156 |
| 158 String SVGScriptElement::typeAttributeValue() const | 157 String SVGScriptElement::typeAttributeValue() const |
| 159 { | 158 { |
| 160 return getAttribute(SVGNames::typeAttr).string(); | 159 return getAttribute(SVGNames::typeAttr).string(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 180 return false; | 179 return false; |
| 181 } | 180 } |
| 182 | 181 |
| 183 bool SVGScriptElement::deferAttributeValue() const | 182 bool SVGScriptElement::deferAttributeValue() const |
| 184 { | 183 { |
| 185 return false; | 184 return false; |
| 186 } | 185 } |
| 187 | 186 |
| 188 bool SVGScriptElement::hasSourceAttribute() const | 187 bool SVGScriptElement::hasSourceAttribute() const |
| 189 { | 188 { |
| 190 return m_href->isSpecified(); | 189 return href()->isSpecified(); |
| 191 } | 190 } |
| 192 | 191 |
| 193 PassRefPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren() | 192 PassRefPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren() |
| 194 { | 193 { |
| 195 return adoptRef(new SVGScriptElement(document(), false, m_loader->alreadySta
rted())); | 194 return adoptRef(new SVGScriptElement(document(), false, m_loader->alreadySta
rted())); |
| 196 } | 195 } |
| 197 | 196 |
| 198 void SVGScriptElement::dispatchLoadEvent() | 197 void SVGScriptElement::dispatchLoadEvent() |
| 199 { | 198 { |
| 200 dispatchEvent(Event::create(EventTypeNames::load)); | 199 dispatchEvent(Event::create(EventTypeNames::load)); |
| 201 } | 200 } |
| 202 | 201 |
| 203 #ifndef NDEBUG | 202 #ifndef NDEBUG |
| 204 bool SVGScriptElement::isAnimatableAttribute(const QualifiedName& name) const | 203 bool SVGScriptElement::isAnimatableAttribute(const QualifiedName& name) const |
| 205 { | 204 { |
| 206 if (name == SVGNames::typeAttr) | 205 if (name == SVGNames::typeAttr) |
| 207 return false; | 206 return false; |
| 208 | 207 |
| 209 return SVGElement::isAnimatableAttribute(name); | 208 return SVGElement::isAnimatableAttribute(name); |
| 210 } | 209 } |
| 211 #endif | 210 #endif |
| 212 | 211 |
| 213 } | 212 } |
| OLD | NEW |