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

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

Issue 2002063003: Change "bool createdByParser" of createElement() to enum (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cestate
Patch Set: Build fix Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp b/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp
index e40177f6081aa854534c78ef80d5941220094e16..0e0a893328f36f9b798b612b34e38c1c73a1237a 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp
@@ -738,10 +738,18 @@ void HTMLConstructionSite::takeAllChildren(HTMLStackItem* newParent, HTMLElement
queueTask(task);
}
+CreateElementFlags HTMLConstructionSite::getCreateElementFlags() const
+{
+ // Set SynchronousCustomElements if not for HTML fragment parsing algorithm.
+ // https://html.spec.whatwg.org/#create-an-element-for-the-token
+ return static_cast<CreateElementFlags>(CreatedByParser
+ | (m_isParsingFragment ? AsynchronousCustomElements : SynchronousCustomElements));
+}
+
Element* HTMLConstructionSite::createElement(AtomicHTMLToken* token, const AtomicString& namespaceURI)
{
QualifiedName tagName(nullAtom, token->name(), namespaceURI);
- Element* element = ownerDocumentForCurrentNode().createElement(tagName, true);
+ Element* element = ownerDocumentForCurrentNode().createElement(tagName, getCreateElementFlags());
setAttributes(element, token, m_parserContentPolicy);
return element;
}
@@ -762,7 +770,7 @@ HTMLElement* HTMLConstructionSite::createHTMLElement(AtomicHTMLToken* token)
// FIXME: This can't use HTMLConstructionSite::createElement because we
// have to pass the current form element. We should rework form association
// to occur after construction to allow better code sharing here.
- HTMLElement* element = HTMLElementFactory::createHTMLElement(token->name(), document, form, true);
+ HTMLElement* element = HTMLElementFactory::createHTMLElement(token->name(), document, form, getCreateElementFlags());
setAttributes(element, token, m_parserContentPolicy);
return element;
}

Powered by Google App Engine
This is Rietveld 408576698