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

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: Added test case Created 4 years, 8 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/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..e8b430c6d85d0a3c1374aa4b5a9189c2b80cf59c 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,17 +4583,27 @@ KURL Document::openSearchDescriptionURL()
return KURL();
}
-HTMLScriptElement* Document::currentScriptForBinding() const
+void Document::currentScriptForBinding(ScriptElement& 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));
+ }
fs 2016/05/03 10:56:00 NOTREACHED()?
ramya.v 2016/05/04 04:18:41 Below test cases are failing if we put ASSERT_NOT_
fs 2016/05/04 08:42:54 Well, the placement in PS3 is definitely wrong - c
ramya.v 2016/05/04 09:35:51 Got your point. Thanks. Done.
}
-void Document::pushCurrentScript(HTMLScriptElement* newCurrentScript)
+void Document::pushCurrentScript(const ScriptElement& newCurrentScript)
{
- DCHECK(newCurrentScript);
- m_currentScriptStack.append(newCurrentScript);
+ DCHECK(!newCurrentScript.isNull());
+ Element* scriptToPush;
+ if (newCurrentScript.isHTMLScriptElement())
+ scriptToPush = newCurrentScript.getAsHTMLScriptElement();
+ else
+ scriptToPush = newCurrentScript.getAsSVGScriptElement();
+ m_currentScriptStack.append(scriptToPush);
}
void Document::popCurrentScript()

Powered by Google App Engine
This is Rietveld 408576698