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

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

Issue 1858163002: Rename inDocument() to inShadowIncludingDocument() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 void ScriptLoader::didNotifySubtreeInsertionsToDocument() 90 void ScriptLoader::didNotifySubtreeInsertionsToDocument()
91 { 91 {
92 if (!m_parserInserted) 92 if (!m_parserInserted)
93 prepareScript(); // FIXME: Provide a real starting line number here. 93 prepareScript(); // FIXME: Provide a real starting line number here.
94 } 94 }
95 95
96 void ScriptLoader::childrenChanged() 96 void ScriptLoader::childrenChanged()
97 { 97 {
98 if (!m_parserInserted && m_element->inDocument()) 98 if (!m_parserInserted && m_element->inShadowIncludingDocument())
99 prepareScript(); // FIXME: Provide a real starting line number here. 99 prepareScript(); // FIXME: Provide a real starting line number here.
100 } 100 }
101 101
102 void ScriptLoader::handleSourceAttribute(const String& sourceUrl) 102 void ScriptLoader::handleSourceAttribute(const String& sourceUrl)
103 { 103 {
104 if (ignoresLoadRequest() || sourceUrl.isEmpty()) 104 if (ignoresLoadRequest() || sourceUrl.isEmpty())
105 return; 105 return;
106 106
107 prepareScript(); // FIXME: Provide a real starting line number here. 107 prepareScript(); // FIXME: Provide a real starting line number here.
108 } 108 }
(...skipping 92 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->inDocument()) 211 if (!m_element->inShadowIncludingDocument())
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 ASSERT(m_element); 287 ASSERT(m_element);
288 288
289 RawPtr<Document> elementDocument(m_element->document()); 289 RawPtr<Document> elementDocument(m_element->document());
290 if (!m_element->inDocument() || m_element->document() != elementDocument) 290 if (!m_element->inShadowIncludingDocument() || m_element->document() != elem entDocument)
291 return false; 291 return false;
292 292
293 ASSERT(!m_resource); 293 ASSERT(!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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 dispatchErrorEvent(); 477 dispatchErrorEvent();
478 detach(); 478 detach();
479 return; 479 return;
480 } 480 }
481 contextDocument->scriptRunner()->notifyScriptReady(this, runOrder); 481 contextDocument->scriptRunner()->notifyScriptReady(this, runOrder);
482 m_pendingScript->stopWatchingForLoad(); 482 m_pendingScript->stopWatchingForLoad();
483 } 483 }
484 484
485 bool ScriptLoader::ignoresLoadRequest() const 485 bool ScriptLoader::ignoresLoadRequest() const
486 { 486 {
487 return m_alreadyStarted || m_isExternalScript || m_parserInserted || !elemen t() || !element()->inDocument(); 487 return m_alreadyStarted || m_isExternalScript || m_parserInserted || !elemen t() || !element()->inShadowIncludingDocument();
488 } 488 }
489 489
490 bool ScriptLoader::isScriptForEventSupported() const 490 bool ScriptLoader::isScriptForEventSupported() const
491 { 491 {
492 String eventAttribute = client()->eventAttributeValue(); 492 String eventAttribute = client()->eventAttributeValue();
493 String forAttribute = client()->forAttributeValue(); 493 String forAttribute = client()->forAttributeValue();
494 if (eventAttribute.isNull() || forAttribute.isNull()) 494 if (eventAttribute.isNull() || forAttribute.isNull())
495 return true; 495 return true;
496 496
497 forAttribute = forAttribute.stripWhiteSpace(); 497 forAttribute = forAttribute.stripWhiteSpace();
(...skipping 25 matching lines...) Expand all
523 if (isHTMLScriptLoader(element)) 523 if (isHTMLScriptLoader(element))
524 return toHTMLScriptElement(element)->loader(); 524 return toHTMLScriptElement(element)->loader();
525 525
526 if (isSVGScriptLoader(element)) 526 if (isSVGScriptLoader(element))
527 return toSVGScriptElement(element)->loader(); 527 return toSVGScriptElement(element)->loader();
528 528
529 return 0; 529 return 0;
530 } 530 }
531 531
532 } // namespace blink 532 } // 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