Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLScriptElement.h

Issue 2723793002: De-Element ScriptLoader (Closed)
Patch Set: ScriptLoaderClient->ScriptElementBase, pure virtual interface, add fixme Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights
5 * reserved. 5 * reserved.
6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * 12 *
13 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details. 16 * Library General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Library General Public License 18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to 19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 * 22 *
23 */ 23 */
24 24
25 #ifndef HTMLScriptElement_h 25 #ifndef HTMLScriptElement_h
26 #define HTMLScriptElement_h 26 #define HTMLScriptElement_h
27 27
28 #include "core/CoreExport.h" 28 #include "core/CoreExport.h"
29 #include "core/dom/ScriptElementBase.h"
29 #include "core/dom/ScriptLoader.h" 30 #include "core/dom/ScriptLoader.h"
30 #include "core/dom/ScriptLoaderClient.h"
31 #include "core/html/HTMLElement.h" 31 #include "core/html/HTMLElement.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 class CORE_EXPORT HTMLScriptElement final : public HTMLElement, 35 class CORE_EXPORT HTMLScriptElement final : public HTMLElement,
36 public ScriptLoaderClient { 36 public ScriptElementBase {
37 DEFINE_WRAPPERTYPEINFO(); 37 DEFINE_WRAPPERTYPEINFO();
38 USING_GARBAGE_COLLECTED_MIXIN(HTMLScriptElement);
38 39
39 public: 40 public:
40 static HTMLScriptElement* create(Document&, 41 static HTMLScriptElement* create(Document&,
41 bool wasInsertedByParser, 42 bool wasInsertedByParser,
42 bool alreadyStarted = false, 43 bool alreadyStarted = false,
43 bool createdDuringDocumentWrite = false); 44 bool createdDuringDocumentWrite = false);
44 45
45 String text() { return textFromChildren(); } 46 String text() { return textFromChildren(); }
46 void setText(const String&); 47 void setText(const String&);
47 48
48 KURL src() const; 49 KURL src() const;
49 50
50 void setAsync(bool); 51 void setAsync(bool);
51 bool async() const; 52 bool async() const;
52 53
53 ScriptLoader* loader() const { return m_loader.get(); } 54 ScriptLoader* loader() const { return m_loader.get(); }
54 55
56 bool isScriptElement() const override { return true; }
57 Document& document() const override;
58
55 DECLARE_VIRTUAL_TRACE(); 59 DECLARE_VIRTUAL_TRACE();
56 60
57 private: 61 private:
58 HTMLScriptElement(Document&, 62 HTMLScriptElement(Document&,
59 bool wasInsertedByParser, 63 bool wasInsertedByParser,
60 bool alreadyStarted, 64 bool alreadyStarted,
61 bool createdDuringDocumentWrite); 65 bool createdDuringDocumentWrite);
62 66
63 void parseAttribute(const AttributeModificationParams&) override; 67 void parseAttribute(const AttributeModificationParams&) override;
64 InsertionNotificationRequest insertedInto(ContainerNode*) override; 68 InsertionNotificationRequest insertedInto(ContainerNode*) override;
65 void didNotifySubtreeInsertionsToDocument() override; 69 void didNotifySubtreeInsertionsToDocument() override;
66 void childrenChanged(const ChildrenChange&) override; 70 void childrenChanged(const ChildrenChange&) override;
67 void didMoveToNewDocument(Document& oldDocument) override; 71 void didMoveToNewDocument(Document& oldDocument) override;
68 72
69 bool isURLAttribute(const Attribute&) const override; 73 bool isURLAttribute(const Attribute&) const override;
70 bool hasLegalLinkAttribute(const QualifiedName&) const override; 74 bool hasLegalLinkAttribute(const QualifiedName&) const override;
71 const QualifiedName& subResourceAttributeName() const override; 75 const QualifiedName& subResourceAttributeName() const override;
72 76
77 // ScriptElementBase overrides:
73 String sourceAttributeValue() const override; 78 String sourceAttributeValue() const override;
74 String charsetAttributeValue() const override; 79 String charsetAttributeValue() const override;
75 String typeAttributeValue() const override; 80 String typeAttributeValue() const override;
76 String languageAttributeValue() const override; 81 String languageAttributeValue() const override;
77 String forAttributeValue() const override; 82 String forAttributeValue() const override;
78 String eventAttributeValue() const override; 83 String eventAttributeValue() const override;
84 String crossOriginAttributeValue() const override;
85 String integrityAttributeValue() const override;
86 String textFromChildren() override;
87 String textContent() const override;
79 bool asyncAttributeValue() const override; 88 bool asyncAttributeValue() const override;
80 bool deferAttributeValue() const override; 89 bool deferAttributeValue() const override;
81 bool hasSourceAttribute() const override; 90 bool hasSourceAttribute() const override;
82 91 bool isConnected() const override;
92 bool hasChildren() const override;
93 bool isNonceableElement() const override;
94 bool allowInlineScriptForCSP(const AtomicString& nonce,
95 const WTF::OrdinalNumber&,
96 const String& scriptContent) override;
97 AtomicString initiatorName() const override;
83 void dispatchLoadEvent() override; 98 void dispatchLoadEvent() override;
99 void dispatchErrorEvent() override;
100 void setScriptElementForBinding(
101 HTMLScriptElementOrSVGScriptElement&) override;
84 102
85 Element* cloneElementWithoutAttributesAndChildren() override; 103 Element* cloneElementWithoutAttributesAndChildren() override;
86
87 Member<ScriptLoader> m_loader;
88 }; 104 };
89 105
90 } // namespace blink 106 } // namespace blink
91 107
92 #endif // HTMLScriptElement_h 108 #endif // HTMLScriptElement_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLOptionElement.cpp ('k') | third_party/WebKit/Source/core/html/HTMLScriptElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698