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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1945563002: Set currentScript for SVGScriptElements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary include Created 4 years, 7 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/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/Document.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index b4fde8e7cfcc90578583eb715896d7731fe159c5..9055674635432851a1ddf89dbd5453b92d7e0e18 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -196,6 +196,7 @@
#include "core/page/scrolling/RootScroller.h"
#include "core/page/scrolling/ScrollingCoordinator.h"
#include "core/svg/SVGDocumentExtensions.h"
+#include "core/svg/SVGScriptElement.h"
#include "core/svg/SVGTitleElement.h"
#include "core/svg/SVGUseElement.h"
#include "core/timing/DOMWindowPerformance.h"
@@ -4582,16 +4583,22 @@ KURL Document::openSearchDescriptionURL()
return KURL();
}
-HTMLScriptElement* Document::currentScriptForBinding() const
+void Document::currentScriptForBinding(HTMLScriptElementOrSVGScriptElement& scriptElement) const
{
- if (HTMLScriptElement* script = currentScript())
- return script->isInV1ShadowTree() ? nullptr : script;
- return nullptr;
+ if (Element* script = currentScript()) {
+ if (script->isInV1ShadowTree())
+ return;
+ if (isHTMLScriptElement(script))
+ scriptElement.setHTMLScriptElement(toHTMLScriptElement(script));
+ else if (isSVGScriptElement(script))
+ scriptElement.setSVGScriptElement(toSVGScriptElement(script));
+ }
}
-void Document::pushCurrentScript(HTMLScriptElement* newCurrentScript)
+void Document::pushCurrentScript(Element* newCurrentScript)
{
DCHECK(newCurrentScript);
Srirama 2016/05/04 18:26:28 I think we can remove this DCHECK now. It is taken
ramya.v 2016/05/05 03:50:34 Removed in https://codereview.chromium.org/1943403
+ DCHECK(isHTMLScriptElement(newCurrentScript) || isSVGScriptElement(newCurrentScript));
m_currentScriptStack.append(newCurrentScript);
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/Document.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698