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

Unified Diff: third_party/WebKit/Source/core/svg/SVGScriptElement.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/svg/SVGScriptElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp b/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp
index 96455cdd83e3836f3a58f23a22348cf22f22d3e6..8dcfb1bba67436dad9f69e21051f17c3daedcecd 100644
--- a/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp
@@ -20,6 +20,7 @@
#include "core/svg/SVGScriptElement.h"
+#include "bindings/core/v8/HTMLScriptElementOrSVGScriptElement.h"
#include "bindings/core/v8/ScriptEventListener.h"
#include "core/HTMLNames.h"
#include "core/XLinkNames.h"
@@ -34,10 +35,9 @@ namespace blink {
inline SVGScriptElement::SVGScriptElement(Document& document,
bool wasInsertedByParser,
bool alreadyStarted)
- : SVGElement(SVGNames::scriptTag, document),
- SVGURIReference(this),
- m_loader(
- ScriptLoader::create(this, wasInsertedByParser, alreadyStarted)) {}
+ : SVGElement(SVGNames::scriptTag, document), SVGURIReference(this) {
+ initializeScriptLoader(wasInsertedByParser, alreadyStarted, false);
+}
SVGScriptElement* SVGScriptElement::create(Document& document,
bool insertedByParser) {
@@ -114,36 +114,48 @@ String SVGScriptElement::sourceAttributeValue() const {
return hrefString();
}
-String SVGScriptElement::charsetAttributeValue() const {
- return String();
-}
-
String SVGScriptElement::typeAttributeValue() const {
return getAttribute(SVGNames::typeAttr).getString();
}
-String SVGScriptElement::languageAttributeValue() const {
- return String();
+String SVGScriptElement::textFromChildren() {
+ return Element::textFromChildren();
}
-String SVGScriptElement::forAttributeValue() const {
- return String();
+String SVGScriptElement::textContent() const {
+ return Node::textContent();
}
-String SVGScriptElement::eventAttributeValue() const {
- return String();
+bool SVGScriptElement::hasSourceAttribute() const {
+ return href()->isSpecified();
}
-bool SVGScriptElement::asyncAttributeValue() const {
- return false;
+bool SVGScriptElement::isConnected() const {
+ return Node::isConnected();
}
-bool SVGScriptElement::deferAttributeValue() const {
- return false;
+bool SVGScriptElement::hasChildren() const {
+ return Node::hasChildren();
}
-bool SVGScriptElement::hasSourceAttribute() const {
- return href()->isSpecified();
+bool SVGScriptElement::isNonceableElement() const {
+ return ContentSecurityPolicy::isNonceableElement(this);
+}
+
+bool SVGScriptElement::allowInlineScriptForCSP(
+ const AtomicString& nonce,
+ const WTF::OrdinalNumber& contextLine,
+ const String& scriptContent) {
+ return document().contentSecurityPolicy()->allowInlineScript(
+ this, document().url(), nonce, contextLine, scriptContent);
+}
+
+AtomicString SVGScriptElement::initiatorName() const {
+ return Element::localName();
+}
+
+Document& SVGScriptElement::document() const {
+ return Node::document();
}
Element* SVGScriptElement::cloneElementWithoutAttributesAndChildren() {
@@ -154,6 +166,16 @@ void SVGScriptElement::dispatchLoadEvent() {
dispatchEvent(Event::create(EventTypeNames::load));
}
+void SVGScriptElement::dispatchErrorEvent() {
+ dispatchEvent(Event::create(EventTypeNames::error));
+}
+
+void SVGScriptElement::setScriptElementForBinding(
+ HTMLScriptElementOrSVGScriptElement& element) {
+ if (!isInV1ShadowTree())
+ element.setSVGScriptElement(this);
+}
+
#if DCHECK_IS_ON()
bool SVGScriptElement::isAnimatableAttribute(const QualifiedName& name) const {
if (name == SVGNames::typeAttr || name == SVGNames::hrefAttr ||
@@ -164,9 +186,9 @@ bool SVGScriptElement::isAnimatableAttribute(const QualifiedName& name) const {
#endif
DEFINE_TRACE(SVGScriptElement) {
- visitor->trace(m_loader);
SVGElement::trace(visitor);
SVGURIReference::trace(visitor);
+ ScriptElementBase::trace(visitor);
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGScriptElement.h ('k') | third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698