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

Side by Side Diff: third_party/WebKit/Source/core/dom/ScriptLoader.cpp

Issue 2149893003: Rename Node::inShadowIncludingDocument() to Node::isConnected() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Created 4 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 90
91 void ScriptLoader::didNotifySubtreeInsertionsToDocument() 91 void ScriptLoader::didNotifySubtreeInsertionsToDocument()
92 { 92 {
93 if (!m_parserInserted) 93 if (!m_parserInserted)
94 prepareScript(); // FIXME: Provide a real starting line number here. 94 prepareScript(); // FIXME: Provide a real starting line number here.
95 } 95 }
96 96
97 void ScriptLoader::childrenChanged() 97 void ScriptLoader::childrenChanged()
98 { 98 {
99 if (!m_parserInserted && m_element->inShadowIncludingDocument()) 99 if (!m_parserInserted && m_element->isConnected())
100 prepareScript(); // FIXME: Provide a real starting line number here. 100 prepareScript(); // FIXME: Provide a real starting line number here.
101 } 101 }
102 102
103 void ScriptLoader::handleSourceAttribute(const String& sourceUrl) 103 void ScriptLoader::handleSourceAttribute(const String& sourceUrl)
104 { 104 {
105 if (ignoresLoadRequest() || sourceUrl.isEmpty()) 105 if (ignoresLoadRequest() || sourceUrl.isEmpty())
106 return; 106 return;
107 107
108 prepareScript(); // FIXME: Provide a real starting line number here. 108 prepareScript(); // FIXME: Provide a real starting line number here.
109 } 109 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 wasParserInserted = false; 201 wasParserInserted = false;
202 } 202 }
203 203
204 if (wasParserInserted && !client->asyncAttributeValue()) 204 if (wasParserInserted && !client->asyncAttributeValue())
205 m_forceAsync = true; 205 m_forceAsync = true;
206 206
207 // FIXME: HTML5 spec says we should check that all children are either comme nts or empty text nodes. 207 // FIXME: HTML5 spec says we should check that all children are either comme nts or empty text nodes.
208 if (!client->hasSourceAttribute() && !m_element->hasChildren()) 208 if (!client->hasSourceAttribute() && !m_element->hasChildren())
209 return false; 209 return false;
210 210
211 if (!m_element->inShadowIncludingDocument()) 211 if (!m_element->isConnected())
212 return false; 212 return false;
213 213
214 if (!isScriptTypeSupported(supportLegacyTypes)) 214 if (!isScriptTypeSupported(supportLegacyTypes))
215 return false; 215 return false;
216 216
217 if (wasParserInserted) { 217 if (wasParserInserted) {
218 m_parserInserted = true; 218 m_parserInserted = true;
219 m_forceAsync = false; 219 m_forceAsync = false;
220 } 220 }
221 221
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 } 280 }
281 281
282 return true; 282 return true;
283 } 283 }
284 284
285 bool ScriptLoader::fetchScript(const String& sourceUrl, FetchRequest::DeferOptio n defer) 285 bool ScriptLoader::fetchScript(const String& sourceUrl, FetchRequest::DeferOptio n defer)
286 { 286 {
287 DCHECK(m_element); 287 DCHECK(m_element);
288 288
289 Document* elementDocument = &(m_element->document()); 289 Document* elementDocument = &(m_element->document());
290 if (!m_element->inShadowIncludingDocument() || m_element->document() != elem entDocument) 290 if (!m_element->isConnected() || m_element->document() != elementDocument)
291 return false; 291 return false;
292 292
293 DCHECK(!m_resource); 293 DCHECK(!m_resource);
294 if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) { 294 if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) {
295 FetchRequest request(ResourceRequest(elementDocument->completeURL(source Url)), m_element->localName()); 295 FetchRequest request(ResourceRequest(elementDocument->completeURL(source Url)), m_element->localName());
296 296
297 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue(m_elem ent->fastGetAttribute(HTMLNames::crossoriginAttr)); 297 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue(m_elem ent->fastGetAttribute(HTMLNames::crossoriginAttr));
298 if (crossOrigin != CrossOriginAttributeNotSet) 298 if (crossOrigin != CrossOriginAttributeNotSet)
299 request.setCrossOriginAccessControl(elementDocument->getSecurityOrig in(), crossOrigin); 299 request.setCrossOriginAccessControl(elementDocument->getSecurityOrig in(), crossOrigin);
300 request.setCharset(scriptCharset()); 300 request.setCharset(scriptCharset());
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 detach(); 473 detach();
474 dispatchErrorEvent(); 474 dispatchErrorEvent();
475 return; 475 return;
476 } 476 }
477 contextDocument->scriptRunner()->notifyScriptReady(this, runOrder); 477 contextDocument->scriptRunner()->notifyScriptReady(this, runOrder);
478 m_pendingScript->stopWatchingForLoad(); 478 m_pendingScript->stopWatchingForLoad();
479 } 479 }
480 480
481 bool ScriptLoader::ignoresLoadRequest() const 481 bool ScriptLoader::ignoresLoadRequest() const
482 { 482 {
483 return m_alreadyStarted || m_isExternalScript || m_parserInserted || !elemen t() || !element()->inShadowIncludingDocument(); 483 return m_alreadyStarted || m_isExternalScript || m_parserInserted || !elemen t() || !element()->isConnected();
484 } 484 }
485 485
486 bool ScriptLoader::isScriptForEventSupported() const 486 bool ScriptLoader::isScriptForEventSupported() const
487 { 487 {
488 String eventAttribute = client()->eventAttributeValue(); 488 String eventAttribute = client()->eventAttributeValue();
489 String forAttribute = client()->forAttributeValue(); 489 String forAttribute = client()->forAttributeValue();
490 if (eventAttribute.isNull() || forAttribute.isNull()) 490 if (eventAttribute.isNull() || forAttribute.isNull())
491 return true; 491 return true;
492 492
493 forAttribute = forAttribute.stripWhiteSpace(); 493 forAttribute = forAttribute.stripWhiteSpace();
(...skipping 25 matching lines...) Expand all
519 if (isHTMLScriptLoader(element)) 519 if (isHTMLScriptLoader(element))
520 return toHTMLScriptElement(element)->loader(); 520 return toHTMLScriptElement(element)->loader();
521 521
522 if (isSVGScriptLoader(element)) 522 if (isSVGScriptLoader(element))
523 return toSVGScriptElement(element)->loader(); 523 return toSVGScriptElement(element)->loader();
524 524
525 return 0; 525 return 0;
526 } 526 }
527 527
528 } // namespace blink 528 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/RangeBoundaryPoint.h ('k') | third_party/WebKit/Source/core/dom/SelectorQuery.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698