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

Unified Diff: Source/core/dom/ScriptElement.cpp

Issue 16682004: Follow up patch for document.currentScript (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move things around a bit Created 7 years, 6 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 | « no previous file | Source/core/html/HTMLScriptElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ScriptElement.cpp
diff --git a/Source/core/dom/ScriptElement.cpp b/Source/core/dom/ScriptElement.cpp
index 22a1db41c7b0b49f843335ed3055fc1df014bd32..d80a9c840a442314821f34bd072c673b271655f0 100644
--- a/Source/core/dom/ScriptElement.cpp
+++ b/Source/core/dom/ScriptElement.cpp
@@ -277,7 +277,12 @@ bool ScriptElement::requestScript(const String& sourceUrl)
bool isHTMLScriptElement(Element* element)
{
- return element->isHTMLElement() && element->hasTagName(HTMLNames::scriptTag);
+ return element->hasTagName(HTMLNames::scriptTag);
+}
+
+bool isSVGScriptElement(Element* element)
+{
+ return element->hasTagName(SVGNames::scriptTag);
}
void ScriptElement::executeScript(const ScriptSourceCode& sourceCode)
@@ -305,7 +310,7 @@ void ScriptElement::executeScript(const ScriptSourceCode& sourceCode)
IgnoreDestructiveWriteCountIncrementer ignoreDesctructiveWriteCountIncrementer(m_isExternalScript ? document.get() : 0);
if (isHTMLScriptElement(m_element))
- document->pushCurrentScript(static_cast<HTMLScriptElement*>(m_element));
+ document->pushCurrentScript(toHTMLScriptElement(m_element));
// Create a script from the script element node, using the script
// block's source and the script block's type.
@@ -425,10 +430,10 @@ String ScriptElement::scriptContent() const
ScriptElement* toScriptElementIfPossible(Element* element)
{
if (isHTMLScriptElement(element))
- return static_cast<HTMLScriptElement*>(element);
+ return toHTMLScriptElement(element);
- if (element->isSVGElement() && element->hasTagName(SVGNames::scriptTag))
- return static_cast<SVGScriptElement*>(element);
+ if (isSVGScriptElement(element))
+ return toSVGScriptElement(element);
return 0;
}
« no previous file with comments | « no previous file | Source/core/html/HTMLScriptElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698