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

Side by Side Diff: Source/core/svg/SVGScriptElement.cpp

Issue 496443008: Transfer pending async script loader to new document. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Robustify new test wrt expected output Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « Source/core/svg/SVGScriptElement.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21 #include "config.h" 21 #include "config.h"
22 22
23 #include "core/svg/SVGScriptElement.h" 23 #include "core/svg/SVGScriptElement.h"
24 24
25 #include "bindings/core/v8/ScriptEventListener.h" 25 #include "bindings/core/v8/ScriptEventListener.h"
26 #include "core/HTMLNames.h" 26 #include "core/HTMLNames.h"
27 #include "core/XLinkNames.h" 27 #include "core/XLinkNames.h"
28 #include "core/dom/Attribute.h" 28 #include "core/dom/Attribute.h"
29 #include "core/dom/ScriptLoader.h" 29 #include "core/dom/ScriptLoader.h"
30 #include "core/dom/ScriptRunner.h"
30 #include "core/events/Event.h" 31 #include "core/events/Event.h"
31 32
32 namespace blink { 33 namespace blink {
33 34
34 inline SVGScriptElement::SVGScriptElement(Document& document, bool wasInsertedBy Parser, bool alreadyStarted) 35 inline SVGScriptElement::SVGScriptElement(Document& document, bool wasInsertedBy Parser, bool alreadyStarted)
35 : SVGElement(SVGNames::scriptTag, document) 36 : SVGElement(SVGNames::scriptTag, document)
36 , SVGURIReference(this) 37 , SVGURIReference(this)
37 , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired) 38 , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired)
38 , m_loader(ScriptLoader::create(this, wasInsertedByParser, alreadyStarted)) 39 , m_loader(ScriptLoader::create(this, wasInsertedByParser, alreadyStarted))
39 { 40 {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 sendSVGLoadEventIfPossibleAsynchronously(); 117 sendSVGLoadEventIfPossibleAsynchronously();
117 } 118 }
118 } 119 }
119 120
120 void SVGScriptElement::childrenChanged(const ChildrenChange& change) 121 void SVGScriptElement::childrenChanged(const ChildrenChange& change)
121 { 122 {
122 SVGElement::childrenChanged(change); 123 SVGElement::childrenChanged(change);
123 m_loader->childrenChanged(); 124 m_loader->childrenChanged();
124 } 125 }
125 126
127 void SVGScriptElement::didMoveToNewDocument(Document& oldDocument)
128 {
129 oldDocument.scriptRunner()->movePendingAsyncScript(document().scriptRunner() , m_loader.get());
130 SVGElement::didMoveToNewDocument(oldDocument);
131 }
132
126 bool SVGScriptElement::isURLAttribute(const Attribute& attribute) const 133 bool SVGScriptElement::isURLAttribute(const Attribute& attribute) const
127 { 134 {
128 return attribute.name() == AtomicString(sourceAttributeValue()); 135 return attribute.name() == AtomicString(sourceAttributeValue());
129 } 136 }
130 137
131 void SVGScriptElement::finishParsingChildren() 138 void SVGScriptElement::finishParsingChildren()
132 { 139 {
133 SVGElement::finishParsingChildren(); 140 SVGElement::finishParsingChildren();
134 m_loader->setHaveFiredLoadEvent(true); 141 m_loader->setHaveFiredLoadEvent(true);
135 } 142 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 bool SVGScriptElement::isAnimatableAttribute(const QualifiedName& name) const 205 bool SVGScriptElement::isAnimatableAttribute(const QualifiedName& name) const
199 { 206 {
200 if (name == SVGNames::typeAttr) 207 if (name == SVGNames::typeAttr)
201 return false; 208 return false;
202 209
203 return SVGElement::isAnimatableAttribute(name); 210 return SVGElement::isAnimatableAttribute(name);
204 } 211 }
205 #endif 212 #endif
206 213
207 } 214 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGScriptElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698