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

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

Issue 2279703002: Add a scoped context object for synchronous CE creation (Closed)
Patch Set: Clean up Created 4 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 | « third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp ('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) 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 22 matching lines...) Expand all
33 #include "core/dom/Comment.h" 33 #include "core/dom/Comment.h"
34 #include "core/dom/DocumentFragment.h" 34 #include "core/dom/DocumentFragment.h"
35 #include "core/dom/DocumentType.h" 35 #include "core/dom/DocumentType.h"
36 #include "core/dom/Element.h" 36 #include "core/dom/Element.h"
37 #include "core/dom/ElementTraversal.h" 37 #include "core/dom/ElementTraversal.h"
38 #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h" 38 #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h"
39 #include "core/dom/ScriptLoader.h" 39 #include "core/dom/ScriptLoader.h"
40 #include "core/dom/TemplateContentDocumentFragment.h" 40 #include "core/dom/TemplateContentDocumentFragment.h"
41 #include "core/dom/Text.h" 41 #include "core/dom/Text.h"
42 #include "core/dom/custom/CEReactionsScope.h" 42 #include "core/dom/custom/CEReactionsScope.h"
43 #include "core/dom/custom/CustomElementCreationScope.h"
43 #include "core/dom/custom/CustomElementDefinition.h" 44 #include "core/dom/custom/CustomElementDefinition.h"
44 #include "core/dom/custom/CustomElementDescriptor.h" 45 #include "core/dom/custom/CustomElementDescriptor.h"
45 #include "core/dom/custom/CustomElementRegistry.h" 46 #include "core/dom/custom/CustomElementRegistry.h"
46 #include "core/frame/LocalDOMWindow.h" 47 #include "core/frame/LocalDOMWindow.h"
47 #include "core/frame/LocalFrame.h" 48 #include "core/frame/LocalFrame.h"
48 #include "core/html/HTMLFormElement.h" 49 #include "core/html/HTMLFormElement.h"
49 #include "core/html/HTMLHtmlElement.h" 50 #include "core/html/HTMLHtmlElement.h"
50 #include "core/html/HTMLPlugInElement.h" 51 #include "core/html/HTMLPlugInElement.h"
51 #include "core/html/HTMLScriptElement.h" 52 #include "core/html/HTMLScriptElement.h"
52 #include "core/html/HTMLTemplateElement.h" 53 #include "core/html/HTMLTemplateElement.h"
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 // level. 830 // level.
830 if (1u == m_reentryPermit->scriptNestingLevel()) 831 if (1u == m_reentryPermit->scriptNestingLevel())
831 Microtask::performCheckpoint(V8PerIsolateData::mainThreadIsolate()); 832 Microtask::performCheckpoint(V8PerIsolateData::mainThreadIsolate());
832 833
833 // "6.4 Push a new element queue onto the custom element 834 // "6.4 Push a new element queue onto the custom element
834 // reactions stack." 835 // reactions stack."
835 CEReactionsScope reactions; 836 CEReactionsScope reactions;
836 837
837 // 7. 838 // 7.
838 QualifiedName elementQName(nullAtom, token->name(), HTMLNames::xhtmlName spaceURI); 839 QualifiedName elementQName(nullAtom, token->name(), HTMLNames::xhtmlName spaceURI);
839 element = definition->createElementSync(document, elementQName); 840 {
841 CustomElementCreationScope scope(&document);
842 element = definition->createElementSync(document, elementQName);
843 }
840 844
841 // "8. Append each attribute in the given token to element." 845 // "8. Append each attribute in the given token to element."
842 // We don't use setAttributes here because the custom element 846 // We don't use setAttributes here because the custom element
843 // constructor may have manipulated attributes. 847 // constructor may have manipulated attributes.
844 for (const auto& attribute : token->attributes()) 848 for (const auto& attribute : token->attributes())
845 element->setAttribute(attribute.name(), attribute.value()); 849 element->setAttribute(attribute.name(), attribute.value());
846 850
847 // "9. If will execute script is true, then ..." etc. The 851 // "9. If will execute script is true, then ..." etc. The
848 // CEReactionsScope and ScriptNestingLevelIncrementer 852 // CEReactionsScope and ScriptNestingLevelIncrementer
849 // destructors implement steps 9.1-4. 853 // destructors implement steps 9.1-4.
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 queueTask(task); 983 queueTask(task);
980 } 984 }
981 985
982 DEFINE_TRACE(HTMLConstructionSite::PendingText) 986 DEFINE_TRACE(HTMLConstructionSite::PendingText)
983 { 987 {
984 visitor->trace(parent); 988 visitor->trace(parent);
985 visitor->trace(nextChild); 989 visitor->trace(nextChild);
986 } 990 }
987 991
988 } // namespace blink 992 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698