Issue #2532 - Implement form[method=dialog]

See bug 1557303
This commit is contained in:
Moonchild 2024-06-15 10:11:00 +02:00 committed by roytam1
commit 6ee3f46900
11 changed files with 162 additions and 2 deletions

View file

@ -944,6 +944,30 @@ HTMLFormSubmission::GetFromForm(nsGenericHTMLElement* aForm,
charset.AssignLiteral("UTF-8");
}
if (method == NS_FORM_METHOD_DIALOG) {
HTMLDialogElement* dialog = nullptr;
for (nsIContent* parent = aForm->GetParent(); parent;
parent = parent->GetParent()) {
dialog = HTMLDialogElement::FromContentOrNull(parent);
if (dialog) {
break;
}
}
// If there isn't one, or if it does not have an open attribute, do
// nothing.
if (!dialog || !dialog->Open()) {
return NS_OK;
}
nsAutoString result;
if (aOriginatingElement) {
aOriginatingElement->ResultForDialogSubmit(result);
}
*aFormSubmission = new DialogFormSubmission(result, charset, aOriginatingElement, dialog);
return NS_OK;
}
// Choose encoder
if (method == NS_FORM_METHOD_POST &&
enctype == NS_FORM_ENCTYPE_MULTIPART) {