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

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

Issue 2537133005: New interface and function for form association (Closed)
Patch Set: Add interface to ListedElement and HTMLImageElement 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
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..76f3cef99602f56022004fe6113883ae10d4bd21 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,9 @@ HTMLElement* HTMLConstructionSite::createHTMLElement(AtomicHTMLToken* token) {
// occur after construction to allow better code sharing here.
element = HTMLElementFactory::createHTMLElement(
token->name(), document, form, getCreateElementFlags());
+ if (FormAssociated* fa = element->toFormAssociated()) {
+ fa->setAssociatedForm(form);
+ }
// Definition for the created element does not exist here and it cannot be
// custom or failed.
DCHECK_NE(element->getCustomElementState(), CustomElementState::Custom);

Powered by Google App Engine
This is Rietveld 408576698