1 /* 2 Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann (at) kde.org> 3 2004, 2005, 2007 Rob Buis <buis (at) kde.org> 4 5 This library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Library General Public 7 License as published by the Free Software Foundation; either 8 version 2 of the License, or (at your option) any later version. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Library General Public License for more details. 14 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 17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef SVGScriptElement_h 22 #define SVGScriptElement_h 23 24 #if ENABLE(SVG) 25 #include "ScriptElement.h" 26 #include "SVGElement.h" 27 #include "SVGURIReference.h" 28 #include "SVGExternalResourcesRequired.h" 29 30 namespace WebCore { 31 32 class SVGScriptElement : public SVGElement 33 , public SVGURIReference 34 , public SVGExternalResourcesRequired 35 , public ScriptElement { 36 public: 37 SVGScriptElement(const QualifiedName&, Document*, bool createdByParser); 38 virtual ~SVGScriptElement(); 39 40 virtual String scriptContent() const; 41 42 virtual void parseMappedAttribute(MappedAttribute*); 43 virtual void insertedIntoDocument(); 44 virtual void removedFromDocument(); 45 virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); 46 47 virtual void svgAttributeChanged(const QualifiedName&); 48 virtual void synchronizeProperty(const QualifiedName&); 49 virtual bool isURLAttribute(Attribute*) const; 50 virtual void finishParsingChildren(); 51 52 String type() const; 53 void setType(const String&); 54 55 virtual String scriptCharset() const; 56 57 virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; 58 59 virtual bool shouldExecuteAsJavaScript() const { return false; } 60 61 protected: 62 virtual bool haveLoadedRequiredResources(); 63 64 virtual String sourceAttributeValue() const; 65 virtual String charsetAttributeValue() const; 66 virtual String typeAttributeValue() const; 67 virtual String languageAttributeValue() const; 68 virtual String forAttributeValue() const; 69 70 virtual void dispatchLoadEvent(); 71 virtual void dispatchErrorEvent(); 72 73 private: 74 // SVGURIReference 75 DECLARE_ANIMATED_PROPERTY(SVGScriptElement, XLinkNames::hrefAttr, String, Href, href) 76 77 // SVGExternalResourcesRequired 78 DECLARE_ANIMATED_PROPERTY(SVGScriptElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) 79 80 private: 81 ScriptElementData m_data; 82 String m_type; 83 }; 84 85 } // namespace WebCore 86 87 #endif // ENABLE(SVG) 88 #endif 89