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

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

Issue 2200613002: The HTML parser synchronously creates custom elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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 13 matching lines...) Expand all
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #ifndef HTMLConstructionSite_h 27 #ifndef HTMLConstructionSite_h
28 #define HTMLConstructionSite_h 28 #define HTMLConstructionSite_h
29 29
30 #include "core/dom/Document.h" 30 #include "core/dom/Document.h"
31 #include "core/dom/ParserContentPolicy.h" 31 #include "core/dom/ParserContentPolicy.h"
32 #include "core/html/parser/HTMLElementStack.h" 32 #include "core/html/parser/HTMLElementStack.h"
33 #include "core/html/parser/HTMLFormattingElementList.h" 33 #include "core/html/parser/HTMLFormattingElementList.h"
34 #include "platform/heap/Handle.h"
34 #include "wtf/Noncopyable.h" 35 #include "wtf/Noncopyable.h"
35 #include "wtf/PassRefPtr.h" 36 #include "wtf/PassRefPtr.h"
36 #include "wtf/RefPtr.h" 37 #include "wtf/RefPtr.h"
37 #include "wtf/Vector.h" 38 #include "wtf/Vector.h"
38 #include "wtf/text/StringBuilder.h" 39 #include "wtf/text/StringBuilder.h"
39 40
40 namespace blink { 41 namespace blink {
41 42
42 struct HTMLConstructionSiteTask { 43 struct HTMLConstructionSiteTask {
43 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 44 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 95
95 enum FlushMode { 96 enum FlushMode {
96 // Flush pending text. Flush queued tasks. 97 // Flush pending text. Flush queued tasks.
97 FlushAlways, 98 FlushAlways,
98 99
99 // Flush pending text if node has length limit. Flush queued tasks. 100 // Flush pending text if node has length limit. Flush queued tasks.
100 FlushIfAtTextLimit, 101 FlushIfAtTextLimit,
101 }; 102 };
102 103
103 class AtomicHTMLToken; 104 class AtomicHTMLToken;
105 class CustomElementDefinition;
104 class Document; 106 class Document;
105 class Element; 107 class Element;
106 class HTMLFormElement; 108 class HTMLFormElement;
109 class HTMLParserReentryPermit;
107 110
108 class HTMLConstructionSite final { 111 class HTMLConstructionSite final {
109 WTF_MAKE_NONCOPYABLE(HTMLConstructionSite); 112 WTF_MAKE_NONCOPYABLE(HTMLConstructionSite);
110 DISALLOW_NEW(); 113 DISALLOW_NEW();
111 public: 114 public:
112 HTMLConstructionSite(Document&, ParserContentPolicy); 115 HTMLConstructionSite(HTMLParserReentryPermit*, Document&, ParserContentPolic y);
113 ~HTMLConstructionSite(); 116 ~HTMLConstructionSite();
114 DECLARE_TRACE(); 117 DECLARE_TRACE();
115 118
116 void initFragmentParsing(DocumentFragment*, Element* contextElement); 119 void initFragmentParsing(DocumentFragment*, Element* contextElement);
117 120
118 void detach(); 121 void detach();
119 122
120 // executeQueuedTasks empties the queue but does not flush pending text. 123 // executeQueuedTasks empties the queue but does not flush pending text.
121 // NOTE: Possible reentrancy via JavaScript execution. 124 // NOTE: Possible reentrancy via JavaScript execution.
122 void executeQueuedTasks(); 125 void executeQueuedTasks();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 239
237 CreateElementFlags getCreateElementFlags() const; 240 CreateElementFlags getCreateElementFlags() const;
238 HTMLElement* createHTMLElement(AtomicHTMLToken*); 241 HTMLElement* createHTMLElement(AtomicHTMLToken*);
239 Element* createElement(AtomicHTMLToken*, const AtomicString& namespaceURI); 242 Element* createElement(AtomicHTMLToken*, const AtomicString& namespaceURI);
240 243
241 void mergeAttributesFromTokenIntoElement(AtomicHTMLToken*, Element*); 244 void mergeAttributesFromTokenIntoElement(AtomicHTMLToken*, Element*);
242 245
243 void executeTask(HTMLConstructionSiteTask&); 246 void executeTask(HTMLConstructionSiteTask&);
244 void queueTask(const HTMLConstructionSiteTask&); 247 void queueTask(const HTMLConstructionSiteTask&);
245 248
249 CustomElementDefinition* lookUpCustomElementDefinition(Document&, AtomicHTML Token*);
250
251 Member<HTMLParserReentryPermit> m_reentryPermit;
246 Member<Document> m_document; 252 Member<Document> m_document;
247 253
248 // This is the root ContainerNode to which the parser attaches all newly 254 // This is the root ContainerNode to which the parser attaches all newly
249 // constructed nodes. It points to a DocumentFragment when parsing fragments 255 // constructed nodes. It points to a DocumentFragment when parsing fragments
250 // and a Document in all other cases. 256 // and a Document in all other cases.
251 Member<ContainerNode> m_attachmentRoot; 257 Member<ContainerNode> m_attachmentRoot;
252 258
253 // https://html.spec.whatwg.org/multipage/syntax.html#head-element-pointer 259 // https://html.spec.whatwg.org/multipage/syntax.html#head-element-pointer
254 Member<HTMLStackItem> m_head; 260 Member<HTMLStackItem> m_head;
255 // https://html.spec.whatwg.org/multipage/syntax.html#form-element-pointer 261 // https://html.spec.whatwg.org/multipage/syntax.html#form-element-pointer
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 // "whenever a node would be inserted into the current node, it must instead 324 // "whenever a node would be inserted into the current node, it must instead
319 // be foster parented." This flag tracks whether we're in that state. 325 // be foster parented." This flag tracks whether we're in that state.
320 bool m_redirectAttachToFosterParent; 326 bool m_redirectAttachToFosterParent;
321 327
322 bool m_inQuirksMode; 328 bool m_inQuirksMode;
323 }; 329 };
324 330
325 } // namespace blink 331 } // namespace blink
326 332
327 #endif 333 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698