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

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

Issue 2537133005: New interface and function for form association (Closed)
Patch Set: Added to BUILD.gn Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLObjectElement.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1954a69616c8fd9ad9aa50e3e8cea660e2ac310b..c14205ed362668a2ff0c5168a02f709639dc24a4 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp
@@ -46,6 +46,7 @@
#include "core/dom/custom/CustomElementRegistry.h"
#include "core/frame/LocalDOMWindow.h"
#include "core/frame/LocalFrame.h"
+#include "core/html/FormAssociated.h"
#include "core/html/HTMLFormElement.h"
#include "core/html/HTMLHtmlElement.h"
#include "core/html/HTMLPlugInElement.h"
@@ -871,7 +872,7 @@ CustomElementDefinition* HTMLConstructionSite::lookUpCustomElementDefinition(
}
// "create an element for a token"
-// https://html.spec.whatwg.org/#create-an-element-for-the-token
+// https://html.spec.whatwg.org/multipage/syntax.html#create-an-element-for-the-token
// TODO(dominicc): When form association is separate from creation, unify this
// with foreign element creation. Add a namespace parameter and check for HTML
// namespace to lookupCustomElementDefinition.
@@ -937,6 +938,10 @@ HTMLElement* HTMLConstructionSite::createHTMLElement(AtomicHTMLToken* token) {
// occur after construction to allow better code sharing here.
element = HTMLElementFactory::createHTMLElement(
token->name(), document, form, getCreateElementFlags());
+ if (FormAssociated* formAssociatedElement =
+ element->toFormAssociatedOrNull()) {
+ formAssociatedElement->associateWith(form);
+ }
// Definition for the created element does not exist here and it cannot be
// custom or failed.
DCHECK_NE(element->getCustomElementState(), CustomElementState::Custom);
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLObjectElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698