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

Unified Diff: third_party/WebKit/Source/core/html/HTMLScriptElement.cpp

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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLScriptElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLScriptElement.cpp b/third_party/WebKit/Source/core/html/HTMLScriptElement.cpp
index e48b70460928144da4fbf581aef440c20c8e1090..f424afcd081071d816bb6e4d1f7b49c838488934 100644
--- a/third_party/WebKit/Source/core/html/HTMLScriptElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLScriptElement.cpp
@@ -24,6 +24,7 @@
#include "core/html/HTMLScriptElement.h"
#include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/HTMLScriptElementOrSVGScriptElement.h"
#include "bindings/core/v8/ScriptEventListener.h"
#include "core/HTMLNames.h"
#include "core/dom/Attribute.h"
@@ -43,11 +44,10 @@ inline HTMLScriptElement::HTMLScriptElement(Document& document,
bool wasInsertedByParser,
bool alreadyStarted,
bool createdDuringDocumentWrite)
- : HTMLElement(scriptTag, document),
- m_loader(ScriptLoader::create(this,
- wasInsertedByParser,
- alreadyStarted,
- createdDuringDocumentWrite)) {}
+ : HTMLElement(scriptTag, document) {
+ initializeScriptLoader(wasInsertedByParser, alreadyStarted,
+ createdDuringDocumentWrite);
+}
HTMLScriptElement* HTMLScriptElement::create(Document& document,
bool wasInsertedByParser,
@@ -157,6 +157,22 @@ String HTMLScriptElement::eventAttributeValue() const {
return getAttribute(eventAttr).getString();
}
+String HTMLScriptElement::crossOriginAttributeValue() const {
+ return getAttribute(crossoriginAttr);
+}
+
+String HTMLScriptElement::integrityAttributeValue() const {
+ return getAttribute(integrityAttr);
+}
+
+String HTMLScriptElement::textFromChildren() {
+ return Element::textFromChildren();
+}
+
+String HTMLScriptElement::textContent() const {
+ return Element::textContent();
+}
+
bool HTMLScriptElement::asyncAttributeValue() const {
return fastHasAttribute(asyncAttr);
}
@@ -169,19 +185,57 @@ bool HTMLScriptElement::hasSourceAttribute() const {
return fastHasAttribute(srcAttr);
}
+bool HTMLScriptElement::isConnected() const {
+ return Node::isConnected();
+}
+
+bool HTMLScriptElement::hasChildren() const {
+ return Node::hasChildren();
+}
+
+bool HTMLScriptElement::isNonceableElement() const {
+ return ContentSecurityPolicy::isNonceableElement(this);
+}
+
+bool HTMLScriptElement::allowInlineScriptForCSP(
+ const AtomicString& nonce,
+ const WTF::OrdinalNumber& contextLine,
+ const String& scriptContent) {
+ return document().contentSecurityPolicy()->allowInlineScript(
+ this, document().url(), nonce, contextLine, scriptContent);
+}
+
+AtomicString HTMLScriptElement::initiatorName() const {
+ return Element::localName();
+}
+
+Document& HTMLScriptElement::document() const {
+ return Node::document();
+}
+
void HTMLScriptElement::dispatchLoadEvent() {
DCHECK(!m_loader->haveFiredLoadEvent());
dispatchEvent(Event::create(EventTypeNames::load));
}
+void HTMLScriptElement::dispatchErrorEvent() {
+ dispatchEvent(Event::create(EventTypeNames::error));
+}
+
+void HTMLScriptElement::setScriptElementForBinding(
+ HTMLScriptElementOrSVGScriptElement& element) {
+ if (!isInV1ShadowTree())
+ element.setHTMLScriptElement(this);
+}
+
Element* HTMLScriptElement::cloneElementWithoutAttributesAndChildren() {
return new HTMLScriptElement(document(), false, m_loader->alreadyStarted(),
false);
}
DEFINE_TRACE(HTMLScriptElement) {
- visitor->trace(m_loader);
HTMLElement::trace(visitor);
+ ScriptElementBase::trace(visitor);
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLScriptElement.h ('k') | third_party/WebKit/Source/core/html/LinkStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698