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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp

Issue 2723793002: De-Element ScriptLoader (Closed)
Patch Set: ScriptLoaderClient->ScriptElementBase, pure virtual interface, add fixme Created 3 years, 9 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) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 19 matching lines...) Expand all
30 #include "bindings/core/v8/Microtask.h" 30 #include "bindings/core/v8/Microtask.h"
31 #include "bindings/core/v8/V8PerIsolateData.h" 31 #include "bindings/core/v8/V8PerIsolateData.h"
32 #include "core/HTMLElementFactory.h" 32 #include "core/HTMLElementFactory.h"
33 #include "core/HTMLNames.h" 33 #include "core/HTMLNames.h"
34 #include "core/dom/Comment.h" 34 #include "core/dom/Comment.h"
35 #include "core/dom/DocumentFragment.h" 35 #include "core/dom/DocumentFragment.h"
36 #include "core/dom/DocumentType.h" 36 #include "core/dom/DocumentType.h"
37 #include "core/dom/Element.h" 37 #include "core/dom/Element.h"
38 #include "core/dom/ElementTraversal.h" 38 #include "core/dom/ElementTraversal.h"
39 #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h" 39 #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h"
40 #include "core/dom/ScriptLoader.h"
41 #include "core/dom/TemplateContentDocumentFragment.h" 40 #include "core/dom/TemplateContentDocumentFragment.h"
42 #include "core/dom/Text.h" 41 #include "core/dom/Text.h"
43 #include "core/dom/ThrowOnDynamicMarkupInsertionCountIncrementer.h" 42 #include "core/dom/ThrowOnDynamicMarkupInsertionCountIncrementer.h"
44 #include "core/dom/custom/CEReactionsScope.h" 43 #include "core/dom/custom/CEReactionsScope.h"
45 #include "core/dom/custom/CustomElementDefinition.h" 44 #include "core/dom/custom/CustomElementDefinition.h"
46 #include "core/dom/custom/CustomElementDescriptor.h" 45 #include "core/dom/custom/CustomElementDescriptor.h"
47 #include "core/dom/custom/CustomElementRegistry.h" 46 #include "core/dom/custom/CustomElementRegistry.h"
48 #include "core/frame/LocalDOMWindow.h" 47 #include "core/frame/LocalDOMWindow.h"
49 #include "core/frame/LocalFrame.h" 48 #include "core/frame/LocalFrame.h"
50 #include "core/frame/LocalFrameClient.h" 49 #include "core/frame/LocalFrameClient.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 void HTMLConstructionSite::queueTask(const HTMLConstructionSiteTask& task) { 279 void HTMLConstructionSite::queueTask(const HTMLConstructionSiteTask& task) {
281 flushPendingText(FlushAlways); 280 flushPendingText(FlushAlways);
282 ASSERT(m_pendingText.isEmpty()); 281 ASSERT(m_pendingText.isEmpty());
283 m_taskQueue.push_back(task); 282 m_taskQueue.push_back(task);
284 } 283 }
285 284
286 void HTMLConstructionSite::attachLater(ContainerNode* parent, 285 void HTMLConstructionSite::attachLater(ContainerNode* parent,
287 Node* child, 286 Node* child,
288 bool selfClosing) { 287 bool selfClosing) {
289 ASSERT(scriptingContentIsAllowed(m_parserContentPolicy) || 288 ASSERT(scriptingContentIsAllowed(m_parserContentPolicy) ||
290 !child->isElementNode() || 289 !child->isElementNode() || !toElement(child)->isScriptElement());
291 !toScriptLoaderIfPossible(toElement(child)));
292 ASSERT(pluginContentIsAllowed(m_parserContentPolicy) || 290 ASSERT(pluginContentIsAllowed(m_parserContentPolicy) ||
293 !isHTMLPlugInElement(child)); 291 !isHTMLPlugInElement(child));
294 292
295 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert); 293 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert);
296 task.parent = parent; 294 task.parent = parent;
297 task.child = child; 295 task.child = child;
298 task.selfClosing = selfClosing; 296 task.selfClosing = selfClosing;
299 297
300 if (shouldFosterParent()) { 298 if (shouldFosterParent()) {
301 fosterParent(task.child); 299 fosterParent(task.child);
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 749
752 void HTMLConstructionSite::insertForeignElement( 750 void HTMLConstructionSite::insertForeignElement(
753 AtomicHTMLToken* token, 751 AtomicHTMLToken* token,
754 const AtomicString& namespaceURI) { 752 const AtomicString& namespaceURI) {
755 ASSERT(token->type() == HTMLToken::StartTag); 753 ASSERT(token->type() == HTMLToken::StartTag);
756 // parseError when xmlns or xmlns:xlink are wrong. 754 // parseError when xmlns or xmlns:xlink are wrong.
757 DVLOG(1) << "Not implemented."; 755 DVLOG(1) << "Not implemented.";
758 756
759 Element* element = createElement(token, namespaceURI); 757 Element* element = createElement(token, namespaceURI);
760 if (scriptingContentIsAllowed(m_parserContentPolicy) || 758 if (scriptingContentIsAllowed(m_parserContentPolicy) ||
761 !toScriptLoaderIfPossible(element)) 759 !element->isScriptElement()) {
762 attachLater(currentNode(), element, token->selfClosing()); 760 attachLater(currentNode(), element, token->selfClosing());
761 }
763 if (!token->selfClosing()) 762 if (!token->selfClosing())
764 m_openElements.push(HTMLStackItem::create(element, token, namespaceURI)); 763 m_openElements.push(HTMLStackItem::create(element, token, namespaceURI));
765 } 764 }
766 765
767 void HTMLConstructionSite::insertTextNode(const StringView& string, 766 void HTMLConstructionSite::insertTextNode(const StringView& string,
768 WhitespaceMode whitespaceMode) { 767 WhitespaceMode whitespaceMode) {
769 HTMLConstructionSiteTask dummyTask(HTMLConstructionSiteTask::Insert); 768 HTMLConstructionSiteTask dummyTask(HTMLConstructionSiteTask::Insert);
770 dummyTask.parent = currentNode(); 769 dummyTask.parent = currentNode();
771 770
772 if (shouldFosterParent()) 771 if (shouldFosterParent())
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 ASSERT(task.parent); 1073 ASSERT(task.parent);
1075 queueTask(task); 1074 queueTask(task);
1076 } 1075 }
1077 1076
1078 DEFINE_TRACE(HTMLConstructionSite::PendingText) { 1077 DEFINE_TRACE(HTMLConstructionSite::PendingText) {
1079 visitor->trace(parent); 1078 visitor->trace(parent);
1080 visitor->trace(nextChild); 1079 visitor->trace(nextChild);
1081 } 1080 }
1082 1081
1083 } // namespace blink 1082 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698