Home | History | Annotate | Download | only in svg
      1 /*
      2  * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann (at) kde.org>
      3  * Copyright (C) 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 #include "core/SVGNames.h"
     25 #include "core/dom/ScriptLoaderClient.h"
     26 #include "core/svg/SVGAnimatedBoolean.h"
     27 #include "core/svg/SVGAnimatedString.h"
     28 #include "core/svg/SVGElement.h"
     29 #include "core/svg/SVGURIReference.h"
     30 
     31 namespace blink {
     32 
     33 class ScriptLoader;
     34 
     35 class SVGScriptElement FINAL
     36     : public SVGElement
     37     , public SVGURIReference
     38     , public ScriptLoaderClient {
     39     DEFINE_WRAPPERTYPEINFO();
     40 public:
     41     static PassRefPtrWillBeRawPtr<SVGScriptElement> create(Document&, bool wasInsertedByParser);
     42 
     43     ScriptLoader* loader() const { return m_loader.get(); }
     44 
     45 #if ENABLE(ASSERT)
     46     virtual bool isAnimatableAttribute(const QualifiedName&) const OVERRIDE;
     47 #endif
     48 
     49 private:
     50     SVGScriptElement(Document&, bool wasInsertedByParser, bool alreadyStarted);
     51     virtual ~SVGScriptElement();
     52 
     53     bool isSupportedAttribute(const QualifiedName&);
     54     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
     55     virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
     56     virtual void didNotifySubtreeInsertionsToDocument() OVERRIDE;
     57     virtual void childrenChanged(const ChildrenChange&) OVERRIDE;
     58     virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;
     59 
     60     virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
     61     virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
     62     virtual bool isStructurallyExternal() const OVERRIDE { return hasSourceAttribute(); }
     63     virtual void finishParsingChildren() OVERRIDE;
     64 
     65     virtual bool haveLoadedRequiredResources() OVERRIDE;
     66 
     67     virtual String sourceAttributeValue() const OVERRIDE;
     68     virtual String charsetAttributeValue() const OVERRIDE;
     69     virtual String typeAttributeValue() const OVERRIDE;
     70     virtual String languageAttributeValue() const OVERRIDE;
     71     virtual String forAttributeValue() const OVERRIDE;
     72     virtual String eventAttributeValue() const OVERRIDE;
     73     virtual bool asyncAttributeValue() const OVERRIDE;
     74     virtual bool deferAttributeValue() const OVERRIDE;
     75     virtual bool hasSourceAttribute() const OVERRIDE;
     76 
     77     virtual void dispatchLoadEvent() OVERRIDE;
     78 
     79     virtual PassRefPtrWillBeRawPtr<Element> cloneElementWithoutAttributesAndChildren() OVERRIDE;
     80     virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
     81 
     82     virtual Timer<SVGElement>* svgLoadEventTimer() OVERRIDE { return &m_svgLoadEventTimer; }
     83 
     84 
     85     Timer<SVGElement> m_svgLoadEventTimer;
     86     OwnPtr<ScriptLoader> m_loader;
     87 };
     88 
     89 } // namespace blink
     90 
     91 #endif // SVGScriptElement_h
     92