| 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, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
| 16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
| 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 #include "core/svg/SVGScriptElement.h" | 21 #include "core/svg/SVGScriptElement.h" |
| 22 | 22 |
| 23 #include "bindings/core/v8/ScriptEventListener.h" | 23 #include "bindings/core/v8/ScriptEventListener.h" |
| 24 #include "core/HTMLNames.h" | 24 #include "core/HTMLNames.h" |
| 25 #include "core/dom/Attribute.h" | 25 #include "core/dom/Attribute.h" |
| 26 #include "core/dom/ScriptLoader.h" | |
| 27 #include "core/dom/ScriptRunner.h" | 26 #include "core/dom/ScriptRunner.h" |
| 28 #include "core/events/Event.h" | 27 #include "core/events/Event.h" |
| 29 | 28 |
| 30 namespace blink { | 29 namespace blink { |
| 31 | 30 |
| 32 inline SVGScriptElement::SVGScriptElement(Document& document, bool wasInsertedBy
Parser, bool alreadyStarted) | 31 inline SVGScriptElement::SVGScriptElement(Document& document, int constructionCo
ntextFlags) |
| 33 : SVGElement(SVGNames::scriptTag, document) | 32 : SVGElement(SVGNames::scriptTag, document) |
| 34 , SVGURIReference(this) | 33 , SVGURIReference(this) |
| 35 , m_loader(ScriptLoader::create(this, wasInsertedByParser, alreadyStarted)) | 34 , m_loader(ScriptLoader::create(this, constructionContextFlags)) |
| 36 { | 35 { |
| 37 } | 36 } |
| 38 | 37 |
| 39 SVGScriptElement* SVGScriptElement::create(Document& document, bool insertedByPa
rser) | 38 SVGScriptElement* SVGScriptElement::create(Document& document, int constructionC
ontextFlags) |
| 40 { | 39 { |
| 41 return new SVGScriptElement(document, insertedByParser, false); | 40 return new SVGScriptElement(document, constructionContextFlags); |
| 42 } | 41 } |
| 43 | 42 |
| 44 void SVGScriptElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& oldValue, const AtomicString& value) | 43 void SVGScriptElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& oldValue, const AtomicString& value) |
| 45 { | 44 { |
| 46 if (name == HTMLNames::onerrorAttr) | 45 if (name == HTMLNames::onerrorAttr) |
| 47 setAttributeEventListener(EventTypeNames::error, createAttributeEventLis
tener(this, name, value, eventParameterName())); | 46 setAttributeEventListener(EventTypeNames::error, createAttributeEventLis
tener(this, name, value, eventParameterName())); |
| 48 else | 47 else |
| 49 SVGElement::parseAttribute(name, oldValue, value); | 48 SVGElement::parseAttribute(name, oldValue, value); |
| 50 } | 49 } |
| 51 | 50 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 return false; | 141 return false; |
| 143 } | 142 } |
| 144 | 143 |
| 145 bool SVGScriptElement::hasSourceAttribute() const | 144 bool SVGScriptElement::hasSourceAttribute() const |
| 146 { | 145 { |
| 147 return href()->isSpecified(); | 146 return href()->isSpecified(); |
| 148 } | 147 } |
| 149 | 148 |
| 150 RawPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren() | 149 RawPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren() |
| 151 { | 150 { |
| 152 return new SVGScriptElement(document(), false, m_loader->alreadyStarted()); | 151 int constructionContextFlags = m_loader->alreadyStarted() ? AlreadyStarted :
DefaultContext; |
| 152 return new SVGScriptElement(document(), constructionContextFlags); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void SVGScriptElement::dispatchLoadEvent() | 155 void SVGScriptElement::dispatchLoadEvent() |
| 156 { | 156 { |
| 157 dispatchEvent(Event::create(EventTypeNames::load)); | 157 dispatchEvent(Event::create(EventTypeNames::load)); |
| 158 } | 158 } |
| 159 | 159 |
| 160 #if ENABLE(ASSERT) | 160 #if ENABLE(ASSERT) |
| 161 bool SVGScriptElement::isAnimatableAttribute(const QualifiedName& name) const | 161 bool SVGScriptElement::isAnimatableAttribute(const QualifiedName& name) const |
| 162 { | 162 { |
| 163 if (name == SVGNames::typeAttr) | 163 if (name == SVGNames::typeAttr) |
| 164 return false; | 164 return false; |
| 165 | 165 |
| 166 return SVGElement::isAnimatableAttribute(name); | 166 return SVGElement::isAnimatableAttribute(name); |
| 167 } | 167 } |
| 168 #endif | 168 #endif |
| 169 | 169 |
| 170 DEFINE_TRACE(SVGScriptElement) | 170 DEFINE_TRACE(SVGScriptElement) |
| 171 { | 171 { |
| 172 visitor->trace(m_loader); | 172 visitor->trace(m_loader); |
| 173 SVGElement::trace(visitor); | 173 SVGElement::trace(visitor); |
| 174 SVGURIReference::trace(visitor); | 174 SVGURIReference::trace(visitor); |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace blink | 177 } // namespace blink |
| OLD | NEW |