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 #ifndef SVGScriptElement_h | 21 #ifndef SVGScriptElement_h |
22 #define SVGScriptElement_h | 22 #define SVGScriptElement_h |
23 | 23 |
24 #include "SVGNames.h" | 24 #include "SVGNames.h" |
25 #include "core/dom/ScriptLoaderClient.h" | 25 #include "core/dom/ScriptLoaderClient.h" |
26 #include "core/svg/SVGAnimatedBoolean.h" | 26 #include "core/svg/SVGAnimatedBoolean.h" |
27 #include "core/svg/SVGAnimatedString.h" | 27 #include "core/svg/SVGAnimatedString.h" |
28 #include "core/svg/SVGElement.h" | 28 #include "core/svg/SVGElement.h" |
29 #include "core/svg/SVGExternalResourcesRequired.h" | |
30 #include "core/svg/SVGURIReference.h" | 29 #include "core/svg/SVGURIReference.h" |
31 | 30 |
32 namespace WebCore { | 31 namespace WebCore { |
33 | 32 |
34 class ScriptLoader; | 33 class ScriptLoader; |
35 | 34 |
36 class SVGScriptElement FINAL | 35 class SVGScriptElement FINAL |
37 : public SVGElement | 36 : public SVGElement |
38 , public SVGURIReference | 37 , public SVGURIReference |
39 , public SVGExternalResourcesRequired | |
40 , public ScriptLoaderClient { | 38 , public ScriptLoaderClient { |
41 public: | 39 public: |
42 static PassRefPtr<SVGScriptElement> create(Document&, bool wasInsertedByPars
er); | 40 static PassRefPtr<SVGScriptElement> create(Document&, bool wasInsertedByPars
er); |
43 | 41 |
44 String type() const; | 42 String type() const; |
45 void setType(const String&); | 43 void setType(const String&); |
46 | 44 |
47 ScriptLoader* loader() const { return m_loader.get(); } | 45 ScriptLoader* loader() const { return m_loader.get(); } |
48 | 46 |
49 private: | 47 private: |
50 SVGScriptElement(Document&, bool wasInsertedByParser, bool alreadyStarted); | 48 SVGScriptElement(Document&, bool wasInsertedByParser, bool alreadyStarted); |
51 | 49 |
52 bool isSupportedAttribute(const QualifiedName&); | 50 bool isSupportedAttribute(const QualifiedName&); |
53 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; | 51 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; |
54 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; | 52 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; |
55 virtual void didNotifySubtreeInsertionsToDocument() OVERRIDE; | 53 virtual void didNotifySubtreeInsertionsToDocument() OVERRIDE; |
56 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang
e = 0, Node* afterChange = 0, int childCountDelta = 0); | 54 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang
e = 0, Node* afterChange = 0, int childCountDelta = 0); |
57 | 55 |
58 virtual void svgAttributeChanged(const QualifiedName&); | 56 virtual void svgAttributeChanged(const QualifiedName&); |
59 virtual bool isURLAttribute(const Attribute&) const OVERRIDE; | 57 virtual bool isURLAttribute(const Attribute&) const OVERRIDE; |
| 58 virtual bool isStructurallyExternal() const { return hasSourceAttribute(); } |
60 virtual void finishParsingChildren(); | 59 virtual void finishParsingChildren(); |
61 | 60 |
62 virtual bool haveLoadedRequiredResources() { return SVGExternalResourcesRequ
ired::haveLoadedRequiredResources(); } | 61 virtual bool haveLoadedRequiredResources() OVERRIDE; |
63 | 62 |
64 virtual String sourceAttributeValue() const; | 63 virtual String sourceAttributeValue() const; |
65 virtual String charsetAttributeValue() const; | 64 virtual String charsetAttributeValue() const; |
66 virtual String typeAttributeValue() const; | 65 virtual String typeAttributeValue() const; |
67 virtual String languageAttributeValue() const; | 66 virtual String languageAttributeValue() const; |
68 virtual String forAttributeValue() const; | 67 virtual String forAttributeValue() const; |
69 virtual String eventAttributeValue() const; | 68 virtual String eventAttributeValue() const; |
70 virtual bool asyncAttributeValue() const; | 69 virtual bool asyncAttributeValue() const; |
71 virtual bool deferAttributeValue() const; | 70 virtual bool deferAttributeValue() const; |
72 virtual bool hasSourceAttribute() const; | 71 virtual bool hasSourceAttribute() const; |
73 | 72 |
74 virtual void dispatchLoadEvent() { SVGExternalResourcesRequired::dispatchLoa
dEvent(this); } | 73 virtual void dispatchLoadEvent(); |
75 | 74 |
76 virtual PassRefPtr<Element> cloneElementWithoutAttributesAndChildren(); | 75 virtual PassRefPtr<Element> cloneElementWithoutAttributesAndChildren(); |
77 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; } | 76 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; } |
78 | 77 |
79 // SVGExternalResourcesRequired | 78 virtual Timer<SVGElement>* svgLoadEventTimer() OVERRIDE { return &m_svgLoadE
ventTimer; } |
80 virtual void setHaveFiredLoadEvent(bool) OVERRIDE; | |
81 virtual bool isParserInserted() const OVERRIDE; | |
82 virtual bool haveFiredLoadEvent() const OVERRIDE; | |
83 virtual Timer<SVGElement>* svgLoadEventTimer() OVERRIDE; | |
84 | 79 |
85 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGScriptElement) | 80 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGScriptElement) |
86 DECLARE_ANIMATED_STRING(Href, href) | 81 DECLARE_ANIMATED_STRING(Href, href) |
87 DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesReq
uired) | |
88 END_DECLARE_ANIMATED_PROPERTIES | 82 END_DECLARE_ANIMATED_PROPERTIES |
89 | 83 |
90 String m_type; | 84 String m_type; |
91 Timer<SVGElement> m_svgLoadEventTimer; | 85 Timer<SVGElement> m_svgLoadEventTimer; |
92 OwnPtr<ScriptLoader> m_loader; | 86 OwnPtr<ScriptLoader> m_loader; |
93 }; | 87 }; |
94 | 88 |
95 DEFINE_NODE_TYPE_CASTS(SVGScriptElement, hasTagName(SVGNames::scriptTag)); | 89 DEFINE_NODE_TYPE_CASTS(SVGScriptElement, hasTagName(SVGNames::scriptTag)); |
96 | 90 |
97 } // namespace WebCore | 91 } // namespace WebCore |
98 | 92 |
99 #endif | 93 #endif |
OLD | NEW |