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

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: Eliminate redundant TODOs. 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/RefPtr.h"
37 #include "wtf/Vector.h" 36 #include "wtf/Vector.h"
38 #include "wtf/text/StringBuilder.h" 37 #include "wtf/text/StringBuilder.h"
39 38
40 namespace blink { 39 namespace blink {
41 40
42 struct HTMLConstructionSiteTask { 41 struct HTMLConstructionSiteTask {
43 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 42 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
44 public: 43 public:
45 enum Operation { 44 enum Operation {
46 Insert, 45 Insert,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 93
95 enum FlushMode { 94 enum FlushMode {
96 // Flush pending text. Flush queued tasks. 95 // Flush pending text. Flush queued tasks.
97 FlushAlways, 96 FlushAlways,
98 97
99 // Flush pending text if node has length limit. Flush queued tasks. 98 // Flush pending text if node has length limit. Flush queued tasks.
100 FlushIfAtTextLimit, 99 FlushIfAtTextLimit,
101 }; 100 };
102 101
103 class AtomicHTMLToken; 102 class AtomicHTMLToken;
103 class CustomElementDefinition;
104 class Document; 104 class Document;
105 class Element; 105 class Element;
106 class HTMLFormElement; 106 class HTMLFormElement;
107 class HTMLParserReentryPermit;
107 108
108 class HTMLConstructionSite final { 109 class HTMLConstructionSite final {
109 WTF_MAKE_NONCOPYABLE(HTMLConstructionSite); 110 WTF_MAKE_NONCOPYABLE(HTMLConstructionSite);
110 DISALLOW_NEW(); 111 DISALLOW_NEW();
111 public: 112 public:
112 HTMLConstructionSite(Document&, ParserContentPolicy); 113 HTMLConstructionSite(HTMLParserReentryPermit*, Document&, ParserContentPolic y);
113 ~HTMLConstructionSite(); 114 ~HTMLConstructionSite();
114 DECLARE_TRACE(); 115 DECLARE_TRACE();
115 116
116 void initFragmentParsing(DocumentFragment*, Element* contextElement); 117 void initFragmentParsing(DocumentFragment*, Element* contextElement);
117 118
118 void detach(); 119 void detach();
119 120
120 // executeQueuedTasks empties the queue but does not flush pending text. 121 // executeQueuedTasks empties the queue but does not flush pending text.
121 // NOTE: Possible reentrancy via JavaScript execution. 122 // NOTE: Possible reentrancy via JavaScript execution.
122 void executeQueuedTasks(); 123 void executeQueuedTasks();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 237
237 CreateElementFlags getCreateElementFlags() const; 238 CreateElementFlags getCreateElementFlags() const;
238 HTMLElement* createHTMLElement(AtomicHTMLToken*); 239 HTMLElement* createHTMLElement(AtomicHTMLToken*);
239 Element* createElement(AtomicHTMLToken*, const AtomicString& namespaceURI); 240 Element* createElement(AtomicHTMLToken*, const AtomicString& namespaceURI);
240 241
241 void mergeAttributesFromTokenIntoElement(AtomicHTMLToken*, Element*); 242 void mergeAttributesFromTokenIntoElement(AtomicHTMLToken*, Element*);
242 243
243 void executeTask(HTMLConstructionSiteTask&); 244 void executeTask(HTMLConstructionSiteTask&);
244 void queueTask(const HTMLConstructionSiteTask&); 245 void queueTask(const HTMLConstructionSiteTask&);
245 246
247 CustomElementDefinition* lookUpCustomElementDefinition(Document&, AtomicHTML Token*);
248
249 HTMLParserReentryPermit* m_reentryPermit;
246 Member<Document> m_document; 250 Member<Document> m_document;
247 251
248 // This is the root ContainerNode to which the parser attaches all newly 252 // This is the root ContainerNode to which the parser attaches all newly
249 // constructed nodes. It points to a DocumentFragment when parsing fragments 253 // constructed nodes. It points to a DocumentFragment when parsing fragments
250 // and a Document in all other cases. 254 // and a Document in all other cases.
251 Member<ContainerNode> m_attachmentRoot; 255 Member<ContainerNode> m_attachmentRoot;
252 256
253 // https://html.spec.whatwg.org/multipage/syntax.html#head-element-pointer 257 // https://html.spec.whatwg.org/multipage/syntax.html#head-element-pointer
254 Member<HTMLStackItem> m_head; 258 Member<HTMLStackItem> m_head;
255 // https://html.spec.whatwg.org/multipage/syntax.html#form-element-pointer 259 // 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 322 // "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. 323 // be foster parented." This flag tracks whether we're in that state.
320 bool m_redirectAttachToFosterParent; 324 bool m_redirectAttachToFosterParent;
321 325
322 bool m_inQuirksMode; 326 bool m_inQuirksMode;
323 }; 327 };
324 328
325 } // namespace blink 329 } // namespace blink
326 330
327 #endif 331 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698