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 "core/SVGNames.h" | 24 #include "core/SVGNames.h" |
25 #include "core/dom/ScriptLoaderClient.h" | 25 #include "core/dom/ScriptElementBase.h" |
26 #include "core/svg/SVGElement.h" | 26 #include "core/svg/SVGElement.h" |
27 #include "core/svg/SVGURIReference.h" | 27 #include "core/svg/SVGURIReference.h" |
28 #include "platform/heap/Handle.h" | 28 #include "platform/heap/Handle.h" |
29 | 29 |
30 namespace blink { | 30 namespace blink { |
31 | 31 |
32 class ScriptLoader; | 32 class ScriptLoader; |
33 | 33 |
34 class SVGScriptElement final : public SVGElement, | 34 class SVGScriptElement final : public SVGElement, |
35 public SVGURIReference, | 35 public SVGURIReference, |
36 public ScriptLoaderClient { | 36 public ScriptElementBase { |
37 DEFINE_WRAPPERTYPEINFO(); | 37 DEFINE_WRAPPERTYPEINFO(); |
38 USING_GARBAGE_COLLECTED_MIXIN(SVGScriptElement); | 38 USING_GARBAGE_COLLECTED_MIXIN(SVGScriptElement); |
39 | 39 |
40 public: | 40 public: |
41 static SVGScriptElement* create(Document&, bool wasInsertedByParser); | 41 static SVGScriptElement* create(Document&, bool wasInsertedByParser); |
42 | 42 |
43 ScriptLoader* loader() const { return m_loader.get(); } | 43 ScriptLoader* loader() const { return m_loader.get(); } |
44 | 44 |
45 #if DCHECK_IS_ON() | 45 #if DCHECK_IS_ON() |
46 bool isAnimatableAttribute(const QualifiedName&) const override; | 46 bool isAnimatableAttribute(const QualifiedName&) const override; |
47 #endif | 47 #endif |
48 | 48 |
| 49 bool isScriptElement() const override { return true; } |
| 50 |
49 DECLARE_VIRTUAL_TRACE(); | 51 DECLARE_VIRTUAL_TRACE(); |
50 | 52 |
51 private: | 53 private: |
52 SVGScriptElement(Document&, bool wasInsertedByParser, bool alreadyStarted); | 54 SVGScriptElement(Document&, bool wasInsertedByParser, bool alreadyStarted); |
53 | 55 |
54 void parseAttribute(const AttributeModificationParams&) override; | 56 void parseAttribute(const AttributeModificationParams&) override; |
55 InsertionNotificationRequest insertedInto(ContainerNode*) override; | 57 InsertionNotificationRequest insertedInto(ContainerNode*) override; |
56 void didNotifySubtreeInsertionsToDocument() override; | 58 void didNotifySubtreeInsertionsToDocument() override; |
57 void childrenChanged(const ChildrenChange&) override; | 59 void childrenChanged(const ChildrenChange&) override; |
58 void didMoveToNewDocument(Document& oldDocument) override; | 60 void didMoveToNewDocument(Document& oldDocument) override; |
59 | 61 |
60 void svgAttributeChanged(const QualifiedName&) override; | 62 void svgAttributeChanged(const QualifiedName&) override; |
61 bool isURLAttribute(const Attribute&) const override; | 63 bool isURLAttribute(const Attribute&) const override; |
62 bool isStructurallyExternal() const override { return hasSourceAttribute(); } | 64 bool isStructurallyExternal() const override { return hasSourceAttribute(); } |
63 void finishParsingChildren() override; | 65 void finishParsingChildren() override; |
64 | 66 |
65 bool haveLoadedRequiredResources() override; | 67 bool haveLoadedRequiredResources() override; |
66 | 68 |
| 69 // ScriptElementBase overrides: |
| 70 bool asyncAttributeValue() const { return false; } |
| 71 String charsetAttributeValue() const { return String(); } |
| 72 String crossOriginAttributeValue() const { return String(); } |
| 73 bool deferAttributeValue() const { return false; } |
| 74 String eventAttributeValue() const { return String(); } |
| 75 String forAttributeValue() const { return String(); } |
| 76 String integrityAttributeValue() const { return String(); } |
| 77 String languageAttributeValue() const { return String(); } |
67 String sourceAttributeValue() const override; | 78 String sourceAttributeValue() const override; |
68 String charsetAttributeValue() const override; | |
69 String typeAttributeValue() const override; | 79 String typeAttributeValue() const override; |
70 String languageAttributeValue() const override; | 80 String textFromChildren() override; |
71 String forAttributeValue() const override; | 81 String textContent() const override; |
72 String eventAttributeValue() const override; | |
73 bool asyncAttributeValue() const override; | |
74 bool deferAttributeValue() const override; | |
75 bool hasSourceAttribute() const override; | 82 bool hasSourceAttribute() const override; |
76 | 83 bool isConnected() const override; |
| 84 bool hasChildren() const override; |
| 85 bool isNonceableElement() const; |
| 86 bool allowInlineScriptForCSP(const AtomicString& nonce, |
| 87 const WTF::OrdinalNumber&, |
| 88 const String& scriptContent) override; |
| 89 AtomicString initiatorName() const override; |
| 90 Document& document() const override; |
77 void dispatchLoadEvent() override; | 91 void dispatchLoadEvent() override; |
| 92 void dispatchErrorEvent() override; |
| 93 void setScriptElementForBinding( |
| 94 HTMLScriptElementOrSVGScriptElement&) override; |
78 | 95 |
79 Element* cloneElementWithoutAttributesAndChildren() override; | 96 Element* cloneElementWithoutAttributesAndChildren() override; |
80 bool layoutObjectIsNeeded(const ComputedStyle&) override { return false; } | 97 bool layoutObjectIsNeeded(const ComputedStyle&) override { return false; } |
81 | |
82 Member<ScriptLoader> m_loader; | |
83 }; | 98 }; |
84 | 99 |
85 } // namespace blink | 100 } // namespace blink |
86 | 101 |
87 #endif // SVGScriptElement_h | 102 #endif // SVGScriptElement_h |
OLD | NEW |