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

Unified Diff: third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.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
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGScriptElement.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
diff --git a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
index 9cd21b6d35e61ddfb4dc3c0be6d07fa3a5d1175f..bcb2e728082c8317b6e23037a70d7b1906a84aec 100644
--- a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
+++ b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
@@ -448,7 +448,8 @@ void XMLDocumentParser::notifyFinished(Resource* unusedResource) {
Element* e = m_scriptElement;
m_scriptElement = nullptr;
- ScriptLoader* scriptLoader = toScriptLoaderIfPossible(e);
+ ScriptLoader* scriptLoader =
+ ScriptElementBase::fromElementIfPossible(e)->loader();
DCHECK(scriptLoader);
if (errorOccurred) {
@@ -1030,8 +1031,7 @@ void XMLDocumentParser::startElementNs(const AtomicString& localName,
newElement->beginParsingChildren();
- ScriptLoader* scriptLoader = toScriptLoaderIfPossible(newElement);
- if (scriptLoader)
+ if (newElement->isScriptElement())
m_scriptStartPosition = textPosition();
m_currentNode->parserAppendChild(newElement);
@@ -1076,8 +1076,12 @@ void XMLDocumentParser::endElementNs() {
if (m_currentNode->isElementNode())
toElement(n)->finishParsingChildren();
+ ScriptElementBase* scriptElementBase =
+ n->isElementNode()
+ ? ScriptElementBase::fromElementIfPossible(toElement(n))
+ : nullptr;
if (!scriptingContentIsAllowed(getParserContentPolicy()) &&
- n->isElementNode() && toScriptLoaderIfPossible(toElement(n))) {
+ scriptElementBase) {
popCurrentNode();
n->remove(IGNORE_EXCEPTION_FOR_TESTING);
return;
@@ -1097,7 +1101,8 @@ void XMLDocumentParser::endElementNs() {
return;
}
- ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element);
+ ScriptLoader* scriptLoader =
+ scriptElementBase ? scriptElementBase->loader() : nullptr;
if (!scriptLoader) {
popCurrentNode();
return;
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGScriptElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698