Diff
Modified: trunk/LayoutTests/ChangeLog (277256 => 277257)
--- trunk/LayoutTests/ChangeLog 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/LayoutTests/ChangeLog 2021-05-10 07:16:13 UTC (rev 277257)
@@ -1,3 +1,18 @@
+2021-05-10 Rob Buis <[email protected]>
+
+ Implement <form>.requestSubmit()
+ https://bugs.webkit.org/show_bug.cgi?id=197958
+
+ Reviewed by Darin Adler.
+
+ Update improved test results.
+
+ * platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
+ * platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
+ * platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
+ * platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
+ * platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
+
2021-05-08 Ricky Mondello <[email protected]>
Fix a typo
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (277256 => 277257)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-05-10 07:16:13 UTC (rev 277257)
@@ -1,3 +1,20 @@
+2021-05-10 Rob Buis <[email protected]>
+
+ Implement <form>.requestSubmit()
+ https://bugs.webkit.org/show_bug.cgi?id=197958
+
+ Reviewed by Darin Adler.
+
+ Update improved test results and import requestSubmit tests.
+
+ * web-platform-tests/html/dom/idlharness.https-expected.txt:
+ * web-platform-tests/html/semantics/forms/form-submission-0/request-submit-activation-expected.txt: Added.
+ * web-platform-tests/html/semantics/forms/form-submission-0/request-submit-activation.html: Added.
+ * web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit-autofocus-expected.txt: Added.
+ * web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit-autofocus.html: Added.
+ * web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit-expected.txt:
+ * web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit.html:
+
2021-05-06 Tim Nguyen <[email protected]>
Re-import css/mediaqueries/test_media_queries.html WPT
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (277256 => 277257)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-05-10 07:16:13 UTC (rev 277257)
@@ -1698,7 +1698,7 @@
PASS HTMLFormElement interface: attribute elements
PASS HTMLFormElement interface: attribute length
PASS HTMLFormElement interface: operation submit()
-FAIL HTMLFormElement interface: operation requestSubmit(HTMLElement) assert_own_property: interface prototype object missing non-static operation expected property "requestSubmit" missing
+PASS HTMLFormElement interface: operation requestSubmit(HTMLElement)
PASS HTMLFormElement interface: operation reset()
PASS HTMLFormElement interface: operation checkValidity()
PASS HTMLFormElement interface: operation reportValidity()
@@ -1718,8 +1718,8 @@
PASS HTMLFormElement interface: document.createElement("form") must inherit property "elements" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "length" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "submit()" with the proper type
-FAIL HTMLFormElement interface: document.createElement("form") must inherit property "requestSubmit(HTMLElement)" with the proper type assert_inherits: property "requestSubmit" not found in prototype chain
-FAIL HTMLFormElement interface: calling requestSubmit(HTMLElement) on document.createElement("form") with too few arguments must throw TypeError assert_inherits: property "requestSubmit" not found in prototype chain
+PASS HTMLFormElement interface: document.createElement("form") must inherit property "requestSubmit(HTMLElement)" with the proper type
+PASS HTMLFormElement interface: calling requestSubmit(HTMLElement) on document.createElement("form") with too few arguments must throw TypeError
PASS HTMLFormElement interface: document.createElement("form") must inherit property "reset()" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "checkValidity()" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "reportValidity()" with the proper type
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/request-submit-activation-expected.txt (0 => 277257)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/request-submit-activation-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/request-submit-activation-expected.txt 2021-05-10 07:16:13 UTC (rev 277257)
@@ -0,0 +1,7 @@
+
+
+
+
+PASS Test activation of submitter for requestSubmit
+PASS Test activation of submitter for requestSubmit 2
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/request-submit-activation.html (0 => 277257)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/request-submit-activation.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/request-submit-activation.html 2021-05-10 07:16:13 UTC (rev 277257)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<link rel="help" href=""
+<script src=""
+<script src=""
+<script src=""
+<body>
+<script>
+promise_test(async () => {
+ let form = populateForm('<input type=submit name=n1 value=v1><button type=submit name=n2 value=v2></button>');
+ let submitter = form.querySelector('button');
+ let iframe = form.previousSibling;
+ let event;
+ form.requestSubmit(submitter);
+ await loadPromise(iframe);
+ assert_true(iframe.contentWindow.location.search.indexOf('n1=v1') == -1, "n1=v1");
+ assert_true(iframe.contentWindow.location.search.indexOf('n2=v2') > 0), "n2=v2";
+}, 'Test activation of submitter for requestSubmit');
+
+promise_test(async () => {
+ let form = populateForm('<input type=submit name=n1 value=v1><button type=submit name=n2 value=v2></button>');
+ let submitter = form.querySelector('input');
+ let iframe = form.previousSibling;
+ let event;
+ form.requestSubmit(submitter);
+ await loadPromise(iframe);
+ assert_true(iframe.contentWindow.location.search.indexOf('n1=v1') > 0, "n1=v1");
+ assert_true(iframe.contentWindow.location.search.indexOf('n2=v2') == -1), "n2=v2";
+}, 'Test activation of submitter for requestSubmit 2');
+</script>
+</body>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit-autofocus-expected.txt (0 => 277257)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit-autofocus-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit-autofocus-expected.txt 2021-05-10 07:16:13 UTC (rev 277257)
@@ -0,0 +1,5 @@
+
+
+PASS Due to autofocus an event handler can run that changes submitter type, so verify that it is processed before the requestSubmit checks.
+PASS Due to autofocus an event handler can run that removes the submitter, so verify that it is processed before the requestSubmit checks.
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit-autofocus.html (0 => 277257)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit-autofocus.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit-autofocus.html 2021-05-10 07:16:13 UTC (rev 277257)
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+
+<body>
+<div id="target"></div>
+<script>
+
+async_test(t => {
+ target.innerHTML = '<form><input id="submitter" type="submit"></input></form>';
+ let form = document.querySelector('form');
+ let submitter = document.querySelector('input');
+ let iframe = document.createElement('iframe');
+ iframe._onload_ = t.step_func_done(() => {
+ assert_throws_js(TypeError, () => {
+ form.requestSubmit(submitter);
+ });
+ });
+
+ submitter.autofocus = true;
+ submitter._onfocus_ = t.step_func(() => {
+ submitter.type = 'button';
+ });
+ target.appendChild(iframe);
+}, 'Due to autofocus an event handler can run that changes submitter type, so ' +
+ 'verify that it is processed before the requestSubmit checks.');
+
+async_test(t => {
+ target.innerHTML = '<form><input id="submitter" type="submit"></input></form>';
+ let form = document.querySelector('form');
+ let submitter = document.querySelector('input');
+ let iframe = document.createElement('iframe');
+ iframe._onload_ = t.step_func_done(() => {
+ assert_throws_dom("NotFoundError", () => {
+ form.requestSubmit(submitter);
+ });
+ });
+
+ submitter.autofocus = true;
+ submitter._onfocus_ = t.step_func(() => {
+ form.removeChild(submitter);
+ });
+ target.appendChild(iframe);
+}, 'Due to autofocus an event handler can run that removes the submitter, so ' +
+ 'verify that it is processed before the requestSubmit checks.');
+</script>
+</body>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit-expected.txt (277256 => 277257)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit-expected.txt 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit-expected.txt 2021-05-10 07:16:13 UTC (rev 277257)
@@ -8,14 +8,16 @@
+
+
PASS Passing an element which is not a submit button should throw
-FAIL Passing a submit button not owned by the context object should throw assert_throws_dom: function "() => {
- form.requestSubmit(submitButton);
- }" threw object "TypeError: form.requestSubmit is not a function. (In 'form.requestSubmit(submitButton)', 'form.requestSubmit' is undefined)" that is not a DOMException NotFoundError: property "code" is equal to undefined, expected 8
-FAIL requestSubmit() should accept button[type=submit], input[type=submit], and input[type=image] form.requestSubmit is not a function. (In 'form.requestSubmit(control)', 'form.requestSubmit' is undefined)
-FAIL requestSubmit() should trigger interactive form validation form.requestSubmit is not a function. (In 'form.requestSubmit()', 'form.requestSubmit' is undefined)
-FAIL requestSubmit() doesn't run form submission reentrantly form.requestSubmit is not a function. (In 'form.requestSubmit()', 'form.requestSubmit' is undefined)
-FAIL requestSubmit() doesn't run interactive validation reentrantly form.requestSubmit is not a function. (In 'form.requestSubmit()', 'form.requestSubmit' is undefined)
-FAIL requestSubmit() for a disconnected form should not submit the form form.requestSubmit is not a function. (In 'form.requestSubmit()', 'form.requestSubmit' is undefined)
-FAIL The value of the submitter should be appended, and form* attributes of the submitter should be handled. form.requestSubmit is not a function. (In 'form.requestSubmit(form.querySelector('[type=submit]'))', 'form.requestSubmit' is undefined)
+PASS Passing a submit button not owned by the context object should throw
+PASS requestSubmit() should accept button[type=submit], input[type=submit], and input[type=image]
+PASS requestSubmit() should trigger interactive form validation
+PASS requestSubmit() doesn't run form submission reentrantly
+PASS requestSubmit() doesn't run interactive validation reentrantly
+PASS requestSubmit() for a disconnected form should not submit the form
+PASS The value of the submitter should be appended, and form* attributes of the submitter should be handled.
+PASS The constructed FormData object should not contain an entry for the submit button that was used to submit the form.
+PASS Using requestSubmit on a disabled button (via disabled attribute) should trigger submit but not be visible in FormData
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit.html (277256 => 277257)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit.html 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit.html 2021-05-10 07:16:13 UTC (rev 277257)
@@ -173,4 +173,43 @@
}));
}, 'The value of the submitter should be appended, and form* ' +
'attributes of the submitter should be handled.');
+
+test(() => {
+ document.body.insertAdjacentHTML('afterbegin', `<form>
+ <input name="n1" value="v1">
+ <button type="submit" name="n2" value="v2"></button>
+ </form>
+ <form id="form2"></form>`);
+ let form = document.querySelector('form');
+ let formDataInEvent = null;
+ let submitter = form.querySelector('button[type=submit]');
+ form.addEventListener('submit', e => {
+ e.preventDefault();
+ formDataInEvent = new FormData(e.target);
+ });
+
+ form.requestSubmit(submitter);
+ assert_equals(formDataInEvent.get('n1'), 'v1');
+ assert_false(formDataInEvent.has('n2'));
+}, 'The constructed FormData object should not contain an entry for the submit button that was used to submit the form.');
+
+async_test(t => {
+ document.body.insertAdjacentHTML('afterbegin', `<form>
+ <button type="submit" name="n1" value="v1" disabled=""></button>
+ </form>`);
+ let form = document.querySelector('form');
+ let formDataInEvent = null;
+ let submitter = form.querySelector('button[type=submit]');
+
+ form.addEventListener("submit", t.step_func_done(ev => {
+ ev.preventDefault();
+ formDataInEvent = new FormData(ev.target);
+ assert_false(formDataInEvent.has('n1'));
+ assert_equals(ev.target, form);
+ }));
+
+ form.requestSubmit(submitter);
+
+}, "Using requestSubmit on a disabled button (via disabled attribute) should trigger submit but not be visible in FormData");
+
</script>
Modified: trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (277256 => 277257)
--- trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-05-10 07:16:13 UTC (rev 277257)
@@ -1847,7 +1847,7 @@
PASS HTMLFormElement interface: attribute elements
PASS HTMLFormElement interface: attribute length
PASS HTMLFormElement interface: operation submit()
-FAIL HTMLFormElement interface: operation requestSubmit(optional HTMLElement?) assert_own_property: interface prototype object missing non-static operation expected property "requestSubmit" missing
+PASS HTMLFormElement interface: operation requestSubmit(optional HTMLElement?)
PASS HTMLFormElement interface: operation reset()
PASS HTMLFormElement interface: operation checkValidity()
PASS HTMLFormElement interface: operation reportValidity()
@@ -1867,8 +1867,8 @@
PASS HTMLFormElement interface: document.createElement("form") must inherit property "elements" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "length" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "submit()" with the proper type
-FAIL HTMLFormElement interface: document.createElement("form") must inherit property "requestSubmit(optional HTMLElement?)" with the proper type assert_inherits: property "requestSubmit" not found in prototype chain
-FAIL HTMLFormElement interface: calling requestSubmit(optional HTMLElement?) on document.createElement("form") with too few arguments must throw TypeError assert_inherits: property "requestSubmit" not found in prototype chain
+PASS HTMLFormElement interface: document.createElement("form") must inherit property "requestSubmit(optional HTMLElement?)" with the proper type
+PASS HTMLFormElement interface: calling requestSubmit(optional HTMLElement?) on document.createElement("form") with too few arguments must throw TypeError
PASS HTMLFormElement interface: document.createElement("form") must inherit property "reset()" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "checkValidity()" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "reportValidity()" with the proper type
Modified: trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (277256 => 277257)
--- trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-05-10 07:16:13 UTC (rev 277257)
@@ -1837,7 +1837,7 @@
PASS HTMLFormElement interface: attribute elements
PASS HTMLFormElement interface: attribute length
PASS HTMLFormElement interface: operation submit()
-FAIL HTMLFormElement interface: operation requestSubmit(optional HTMLElement?) assert_own_property: interface prototype object missing non-static operation expected property "requestSubmit" missing
+PASS HTMLFormElement interface: operation requestSubmit(optional HTMLElement?)
PASS HTMLFormElement interface: operation reset()
PASS HTMLFormElement interface: operation checkValidity()
PASS HTMLFormElement interface: operation reportValidity()
@@ -1857,8 +1857,8 @@
PASS HTMLFormElement interface: document.createElement("form") must inherit property "elements" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "length" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "submit()" with the proper type
-FAIL HTMLFormElement interface: document.createElement("form") must inherit property "requestSubmit(optional HTMLElement?)" with the proper type assert_inherits: property "requestSubmit" not found in prototype chain
-FAIL HTMLFormElement interface: calling requestSubmit(optional HTMLElement?) on document.createElement("form") with too few arguments must throw TypeError assert_inherits: property "requestSubmit" not found in prototype chain
+PASS HTMLFormElement interface: document.createElement("form") must inherit property "requestSubmit(optional HTMLElement?)" with the proper type
+PASS HTMLFormElement interface: calling requestSubmit(optional HTMLElement?) on document.createElement("form") with too few arguments must throw TypeError
PASS HTMLFormElement interface: document.createElement("form") must inherit property "reset()" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "checkValidity()" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "reportValidity()" with the proper type
Modified: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (277256 => 277257)
--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-05-10 07:16:13 UTC (rev 277257)
@@ -1847,7 +1847,7 @@
PASS HTMLFormElement interface: attribute elements
PASS HTMLFormElement interface: attribute length
PASS HTMLFormElement interface: operation submit()
-FAIL HTMLFormElement interface: operation requestSubmit(optional HTMLElement?) assert_own_property: interface prototype object missing non-static operation expected property "requestSubmit" missing
+PASS HTMLFormElement interface: operation requestSubmit(optional HTMLElement?)
PASS HTMLFormElement interface: operation reset()
PASS HTMLFormElement interface: operation checkValidity()
PASS HTMLFormElement interface: operation reportValidity()
@@ -1867,8 +1867,8 @@
PASS HTMLFormElement interface: document.createElement("form") must inherit property "elements" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "length" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "submit()" with the proper type
-FAIL HTMLFormElement interface: document.createElement("form") must inherit property "requestSubmit(optional HTMLElement?)" with the proper type assert_inherits: property "requestSubmit" not found in prototype chain
-FAIL HTMLFormElement interface: calling requestSubmit(optional HTMLElement?) on document.createElement("form") with too few arguments must throw TypeError assert_inherits: property "requestSubmit" not found in prototype chain
+PASS HTMLFormElement interface: document.createElement("form") must inherit property "requestSubmit(optional HTMLElement?)" with the proper type
+PASS HTMLFormElement interface: calling requestSubmit(optional HTMLElement?) on document.createElement("form") with too few arguments must throw TypeError
PASS HTMLFormElement interface: document.createElement("form") must inherit property "reset()" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "checkValidity()" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "reportValidity()" with the proper type
Modified: trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (277256 => 277257)
--- trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-05-10 07:16:13 UTC (rev 277257)
@@ -1847,7 +1847,7 @@
PASS HTMLFormElement interface: attribute elements
PASS HTMLFormElement interface: attribute length
PASS HTMLFormElement interface: operation submit()
-FAIL HTMLFormElement interface: operation requestSubmit(optional HTMLElement?) assert_own_property: interface prototype object missing non-static operation expected property "requestSubmit" missing
+PASS HTMLFormElement interface: operation requestSubmit(optional HTMLElement?)
PASS HTMLFormElement interface: operation reset()
PASS HTMLFormElement interface: operation checkValidity()
PASS HTMLFormElement interface: operation reportValidity()
@@ -1867,8 +1867,8 @@
PASS HTMLFormElement interface: document.createElement("form") must inherit property "elements" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "length" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "submit()" with the proper type
-FAIL HTMLFormElement interface: document.createElement("form") must inherit property "requestSubmit(optional HTMLElement?)" with the proper type assert_inherits: property "requestSubmit" not found in prototype chain
-FAIL HTMLFormElement interface: calling requestSubmit(optional HTMLElement?) on document.createElement("form") with too few arguments must throw TypeError assert_inherits: property "requestSubmit" not found in prototype chain
+PASS HTMLFormElement interface: document.createElement("form") must inherit property "requestSubmit(optional HTMLElement?)" with the proper type
+PASS HTMLFormElement interface: calling requestSubmit(optional HTMLElement?) on document.createElement("form") with too few arguments must throw TypeError
PASS HTMLFormElement interface: document.createElement("form") must inherit property "reset()" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "checkValidity()" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "reportValidity()" with the proper type
Modified: trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (277256 => 277257)
--- trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-05-10 07:16:13 UTC (rev 277257)
@@ -1847,7 +1847,7 @@
PASS HTMLFormElement interface: attribute elements
PASS HTMLFormElement interface: attribute length
PASS HTMLFormElement interface: operation submit()
-FAIL HTMLFormElement interface: operation requestSubmit(optional HTMLElement?) assert_own_property: interface prototype object missing non-static operation expected property "requestSubmit" missing
+PASS HTMLFormElement interface: operation requestSubmit(optional HTMLElement?)
PASS HTMLFormElement interface: operation reset()
PASS HTMLFormElement interface: operation checkValidity()
PASS HTMLFormElement interface: operation reportValidity()
@@ -1867,8 +1867,8 @@
PASS HTMLFormElement interface: document.createElement("form") must inherit property "elements" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "length" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "submit()" with the proper type
-FAIL HTMLFormElement interface: document.createElement("form") must inherit property "requestSubmit(optional HTMLElement?)" with the proper type assert_inherits: property "requestSubmit" not found in prototype chain
-FAIL HTMLFormElement interface: calling requestSubmit(optional HTMLElement?) on document.createElement("form") with too few arguments must throw TypeError assert_inherits: property "requestSubmit" not found in prototype chain
+PASS HTMLFormElement interface: document.createElement("form") must inherit property "requestSubmit(optional HTMLElement?)" with the proper type
+PASS HTMLFormElement interface: calling requestSubmit(optional HTMLElement?) on document.createElement("form") with too few arguments must throw TypeError
PASS HTMLFormElement interface: document.createElement("form") must inherit property "reset()" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "checkValidity()" with the proper type
PASS HTMLFormElement interface: document.createElement("form") must inherit property "reportValidity()" with the proper type
Modified: trunk/Source/WTF/ChangeLog (277256 => 277257)
--- trunk/Source/WTF/ChangeLog 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/Source/WTF/ChangeLog 2021-05-10 07:16:13 UTC (rev 277257)
@@ -1,3 +1,14 @@
+2021-05-10 Rob Buis <[email protected]>
+
+ Implement <form>.requestSubmit()
+ https://bugs.webkit.org/show_bug.cgi?id=197958
+
+ Reviewed by Darin Adler.
+
+ Add requestSubmit as experimental feature, disabled by default.
+
+ * Scripts/Preferences/WebPreferencesExperimental.yaml:
+
2021-05-09 Darin Adler <[email protected]>
Remove uses of the String::toInt family of functions from WebCore/html and similar directories
Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml (277256 => 277257)
--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml 2021-05-10 07:16:13 UTC (rev 277257)
@@ -864,6 +864,18 @@
WebCore:
default: false
+RequestSubmitEnabled:
+ type: bool
+ humanReadableName: "Form requestSubmit"
+ humanReadableDescription: "Form requestSubmit method"
+ defaultValue:
+ WebKitLegacy:
+ default: false
+ WebKit:
+ default: false
+ WebCore:
+ default: false
+
# FIXME: This is on by default in WebKit2. Perhaps we should consider turning it on for WebKitLegacy as well.
ResizeObserverEnabled:
type: bool
Modified: trunk/Source/WebCore/ChangeLog (277256 => 277257)
--- trunk/Source/WebCore/ChangeLog 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/Source/WebCore/ChangeLog 2021-05-10 07:16:13 UTC (rev 277257)
@@ -1,3 +1,51 @@
+2021-05-10 Rob Buis <[email protected]>
+
+ Implement <form>.requestSubmit()
+ https://bugs.webkit.org/show_bug.cgi?id=197958
+
+ Reviewed by Darin Adler.
+
+ Implement the requestSubmit method as defined here [1].
+
+ Behavior matches Chrome and Firefox.
+
+ [1] https://html.spec.whatwg.org/multipage/forms.html#dom-form-requestsubmit
+
+ Tests: imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit.html
+ imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/request-submit-activation.html
+ imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit-autofocus.html
+
+ * html/HTMLButtonElement.cpp:
+ (WebCore::HTMLButtonElement::defaultEventHandler):
+ (WebCore::HTMLButtonElement::isSubmitButton const):
+ * html/HTMLButtonElement.h:
+ * html/HTMLFormControlElement.h:
+ (WebCore::HTMLFormControlElement::isSubmitButton const):
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::submitImplicitly):
+ (WebCore::HTMLFormElement::submitIfPossible):
+ (WebCore::HTMLFormElement::requestSubmit):
+ (WebCore::HTMLFormElement::findSubmitButton):
+ (WebCore::HTMLFormElement::submit):
+ (WebCore::HTMLFormElement::effectiveTarget const):
+ (WebCore::HTMLFormElement::findSubmitter const):
+ (WebCore::HTMLFormElement::reportValidity):
+ (WebCore::HTMLFormElement::prepareForSubmission): Deleted.
+ (WebCore::HTMLFormElement::findSubmitButton const): Deleted.
+ * html/HTMLFormElement.h:
+ * html/HTMLFormElement.idl:
+ * html/HTMLInputElement.h:
+ * html/ImageInputType.cpp:
+ (WebCore::ImageInputType::handleDOMActivateEvent):
+ * html/ImageInputType.h:
+ * html/InputType.h:
+ (WebCore::InputType::isSubmitButton const):
+ * html/SubmitInputType.cpp:
+ (WebCore::SubmitInputType::handleDOMActivateEvent):
+ * loader/FormSubmission.cpp:
+ (WebCore::FormSubmission::create):
+ * loader/FormSubmission.h:
+
2021-05-09 Sam Weinig <[email protected]>
Add back protection of the pixel buffer in ImageBufferCGBackend::toCFData removed in r277237
Modified: trunk/Source/WebCore/html/HTMLButtonElement.cpp (277256 => 277257)
--- trunk/Source/WebCore/html/HTMLButtonElement.cpp 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/Source/WebCore/html/HTMLButtonElement.cpp 2021-05-10 07:16:13 UTC (rev 277257)
@@ -138,7 +138,7 @@
if (auto currentForm = form()) {
if (m_type == SUBMIT) {
SetForScope<bool> activatedSubmitState(m_isActivatedSubmit, true);
- currentForm->prepareForSubmission(event);
+ currentForm->submitIfPossible(&event);
}
if (m_type == RESET)
@@ -237,4 +237,9 @@
return m_type == SUBMIT && HTMLFormControlElement::computeWillValidate();
}
+bool HTMLButtonElement::isSubmitButton() const
+{
+ return m_type == SUBMIT;
+}
+
} // namespace
Modified: trunk/Source/WebCore/html/HTMLButtonElement.h (277256 => 277257)
--- trunk/Source/WebCore/html/HTMLButtonElement.h 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/Source/WebCore/html/HTMLButtonElement.h 2021-05-10 07:16:13 UTC (rev 277257)
@@ -76,6 +76,8 @@
bool isOptionalFormControl() const final { return true; }
bool computeWillValidate() const final;
+ bool isSubmitButton() const final;
+
Type m_type;
bool m_isActivatedSubmit;
};
Modified: trunk/Source/WebCore/html/HTMLFormControlElement.h (277256 => 277257)
--- trunk/Source/WebCore/html/HTMLFormControlElement.h 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.h 2021-05-10 07:16:13 UTC (rev 277257)
@@ -126,6 +126,8 @@
WEBCORE_EXPORT AutofillData autofillData() const;
+ virtual bool isSubmitButton() const { return false; }
+
using Node::ref;
using Node::deref;
Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (277256 => 277257)
--- trunk/Source/WebCore/html/HTMLFormElement.cpp 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp 2021-05-10 07:16:13 UTC (rev 277257)
@@ -45,6 +45,7 @@
#include "HTMLObjectElement.h"
#include "HTMLParserIdioms.h"
#include "HTMLTableElement.h"
+#include "InputTypeNames.h"
#include "MIMETypeRegistry.h"
#include "MixedContentChecker.h"
#include "NodeRareData.h"
@@ -210,7 +211,7 @@
// Older iOS apps using WebViews expect the behavior of auto submitting multi-input forms.
if (fromImplicitSubmissionTrigger && (submissionTriggerCount == 1 || document().settings().allowMultiElementImplicitSubmission()))
- prepareForSubmission(event);
+ submitIfPossible(&event);
}
bool HTMLFormElement::validateInteractively()
@@ -253,7 +254,7 @@
return false;
}
-void HTMLFormElement::prepareForSubmission(Event& event)
+void HTMLFormElement::submitIfPossible(Event* event, HTMLFormControlElement* submitter, FormSubmissionTrigger trigger)
{
if (!isConnected())
return;
@@ -268,7 +269,7 @@
bool shouldValidate = document().page() && document().page()->settings().interactiveFormValidationEnabled() && !noValidate();
if (shouldValidate) {
- auto submitElement = findSubmitButton(&event);
+ auto submitElement = makeRefPtr(submitter ? submitter : findSubmitter(event));
if (submitElement && submitElement->formNoValidate())
shouldValidate = false;
}
@@ -279,7 +280,7 @@
return;
}
- auto targetFrame = frame->loader().findFrameForNavigation(effectiveTarget(&event), &document());
+ auto targetFrame = frame->loader().findFrameForNavigation(effectiveTarget(event, submitter), &document());
if (!targetFrame)
targetFrame = frame.get();
auto formState = FormState::create(*this, textFieldValues(), document(), NotSubmittedByJavaScript);
@@ -297,7 +298,7 @@
m_isSubmittingOrPreparingForSubmission = false;
if (m_shouldSubmit)
- submit(&event, true, true, NotSubmittedByJavaScript);
+ submit(event, true, !submitter, trigger, submitter);
}
void HTMLFormElement::submit()
@@ -310,6 +311,28 @@
submit(nullptr, false, UserGestureIndicator::processingUserGesture(), SubmittedByJavaScript);
}
+ExceptionOr<void> HTMLFormElement::requestSubmit(HTMLElement* submitter)
+{
+ // Update layout before processing form actions in case the style changes
+ // the form or button relationships.
+ document().updateLayoutIgnorePendingStylesheets();
+
+ RefPtr<HTMLFormControlElement> control;
+ if (submitter) {
+ // https://html.spec.whatwg.org/multipage/forms.html#dom-form-requestsubmit
+ if (!is<HTMLFormControlElement>(submitter))
+ return Exception { TypeError };
+ control = downcast<HTMLFormControlElement>(submitter);
+ if (!control->isSubmitButton())
+ return Exception { TypeError };
+ if (control->form() != this)
+ return Exception { NotFoundError };
+ }
+
+ submitIfPossible(nullptr, control.get(), SubmittedByJavaScript);
+ return { };
+}
+
StringPairVector HTMLFormElement::textFieldValues() const
{
StringPairVector result;
@@ -326,9 +349,28 @@
return result;
}
-void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool processingUserGesture, FormSubmissionTrigger formSubmissionTrigger)
+RefPtr<HTMLFormControlElement> HTMLFormElement::findSubmitButton(HTMLFormControlElement* submitter, bool needButtonActivation)
{
- // The prepareForSubmission function also does this check, but we need to do it here
+ if (submitter)
+ return submitter;
+ if (!needButtonActivation)
+ return nullptr;
+ RefPtr<HTMLFormControlElement> firstSuccessfulSubmitButton;
+ for (auto& associatedElement : m_associatedElements) {
+ if (!is<HTMLFormControlElement>(*associatedElement))
+ continue;
+ auto& control = downcast<HTMLFormControlElement>(*associatedElement);
+ if (control.isActivatedSubmit())
+ return nullptr;
+ if (!firstSuccessfulSubmitButton && control.isSuccessfulSubmitButton())
+ firstSuccessfulSubmitButton = &control;
+ }
+ return firstSuccessfulSubmitButton;
+}
+
+void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool processingUserGesture, FormSubmissionTrigger trigger, HTMLFormControlElement* submitter)
+{
+ // The submitIfPossible function also does this check, but we need to do it here
// too, since there are some code paths that bypass that function.
if (!isConnected())
return;
@@ -346,28 +388,14 @@
m_isSubmittingOrPreparingForSubmission = true;
m_wasUserSubmitted = processingUserGesture;
- RefPtr<HTMLFormControlElement> firstSuccessfulSubmitButton;
- bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button?
-
- for (auto& associatedElement : m_associatedElements) {
- if (!is<HTMLFormControlElement>(*associatedElement))
- continue;
- if (needButtonActivation) {
- HTMLFormControlElement& control = downcast<HTMLFormControlElement>(*associatedElement);
- if (control.isActivatedSubmit())
- needButtonActivation = false;
- else if (!firstSuccessfulSubmitButton && control.isSuccessfulSubmitButton())
- firstSuccessfulSubmitButton = &control;
- }
- }
-
- if (needButtonActivation && firstSuccessfulSubmitButton)
+ auto firstSuccessfulSubmitButton = findSubmitButton(submitter, activateSubmitButton);
+ if (firstSuccessfulSubmitButton)
firstSuccessfulSubmitButton->setActivatedSubmit(true);
auto protectedThis = makeRef(*this); // Form submission can execute arbitary _javascript_.
auto shouldLockHistory = processingUserGesture ? LockHistory::No : LockHistory::Yes;
- auto formSubmission = FormSubmission::create(*this, m_attributes, event, shouldLockHistory, formSubmissionTrigger);
+ auto formSubmission = FormSubmission::create(*this, submitter, m_attributes, event, shouldLockHistory, trigger);
if (m_plannedFormSubmission)
m_plannedFormSubmission->cancel();
@@ -385,7 +413,7 @@
m_plannedFormSubmission = makeWeakPtr(formSubmission.get());
frame->loader().submitForm(WTFMove(formSubmission));
- if (needButtonActivation && firstSuccessfulSubmitButton)
+ if (firstSuccessfulSubmitButton)
firstSuccessfulSubmitButton->setActivatedSubmit(false);
if (imageOrMediaFiles) {
@@ -682,10 +710,10 @@
return attributeWithoutSynchronization(targetAttr);
}
-String HTMLFormElement::effectiveTarget(const Event* event) const
+String HTMLFormElement::effectiveTarget(const Event* event, HTMLFormControlElement* overrideSubmitter) const
{
- if (auto* submitButton = findSubmitButton(event)) {
- auto targetValue = submitButton->attributeWithoutSynchronization(formtargetAttr);
+ if (auto submitter = makeRefPtr(overrideSubmitter ? overrideSubmitter : findSubmitter(event))) {
+ auto targetValue = submitter->attributeWithoutSynchronization(formtargetAttr);
if (!targetValue.isNull())
return targetValue;
}
@@ -702,7 +730,7 @@
return m_wasUserSubmitted;
}
-HTMLFormControlElement* HTMLFormElement::findSubmitButton(const Event* event) const
+HTMLFormControlElement* HTMLFormElement::findSubmitter(const Event* event) const
{
if (!event || !is<Node>(event->target()))
return nullptr;
@@ -776,7 +804,7 @@
Ref<HTMLFormElement> protectedThis(*this);
// Update layout before processing form actions in case the style changes
- // the Form or button relationships.
+ // the form or button relationships.
document().updateLayoutIgnorePendingStylesheets();
return validateInteractively();
Modified: trunk/Source/WebCore/html/HTMLFormElement.h (277256 => 277257)
--- trunk/Source/WebCore/html/HTMLFormElement.h 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/Source/WebCore/html/HTMLFormElement.h 2021-05-10 07:16:13 UTC (rev 277257)
@@ -77,9 +77,10 @@
void registerImgElement(HTMLImageElement*);
void removeImgElement(HTMLImageElement*);
- void prepareForSubmission(Event&); // FIXME: This function doesn't only prepare, it sometimes calls submit() itself.
+ void submitIfPossible(Event*, HTMLFormControlElement* = nullptr, FormSubmissionTrigger = NotSubmittedByJavaScript);
WEBCORE_EXPORT void submit();
void submitFromJavaScript();
+ ExceptionOr<void> requestSubmit(HTMLElement* submitter);
WEBCORE_EXPORT void reset();
void setDemoted(bool demoted) { m_wasDemoted = demoted; }
@@ -101,11 +102,11 @@
WEBCORE_EXPORT void setMethod(const String&);
String target() const final;
- String effectiveTarget(const Event*) const;
+ String effectiveTarget(const Event*, HTMLFormControlElement* submitter) const;
bool wasUserSubmitted() const;
- HTMLFormControlElement* findSubmitButton(const Event*) const;
+ HTMLFormControlElement* findSubmitter(const Event*) const;
HTMLFormControlElement* defaultButton() const;
void resetDefaultButton();
@@ -140,7 +141,7 @@
void copyNonAttributePropertiesFromElement(const Element&) final;
- void submit(Event*, bool activateSubmitButton, bool processingUserGesture, FormSubmissionTrigger);
+ void submit(Event*, bool activateSubmitButton, bool processingUserGesture, FormSubmissionTrigger, HTMLFormControlElement* submitter = nullptr);
unsigned formElementIndexWithFormAttribute(Element*, unsigned rangeStart, unsigned rangeEnd);
unsigned formElementIndex(FormAssociatedElement*);
@@ -164,6 +165,8 @@
void resetAssociatedFormControlElements();
+ RefPtr<HTMLFormControlElement> findSubmitButton(HTMLFormControlElement* submitter, bool needButtonActivation);
+
FormSubmission::Attributes m_attributes;
HashMap<AtomString, WeakPtr<HTMLElement>> m_pastNamesMap;
Modified: trunk/Source/WebCore/html/HTMLFormElement.idl (277256 => 277257)
--- trunk/Source/WebCore/html/HTMLFormElement.idl 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/Source/WebCore/html/HTMLFormElement.idl 2021-05-10 07:16:13 UTC (rev 277257)
@@ -40,6 +40,7 @@
getter (RadioNodeList or Element)? (DOMString name);
[ImplementedAs=submitFromJavaScript] undefined submit();
+ [EnabledBySetting=RequestSubmit] undefined requestSubmit(optional HTMLElement? submitter);
[CEReactions=NotNeeded] undefined reset();
boolean checkValidity();
[EnabledBySetting=InteractiveFormValidation] boolean reportValidity();
Modified: trunk/Source/WebCore/html/HTMLInputElement.h (277256 => 277257)
--- trunk/Source/WebCore/html/HTMLInputElement.h 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/Source/WebCore/html/HTMLInputElement.h 2021-05-10 07:16:13 UTC (rev 277257)
@@ -122,7 +122,7 @@
WEBCORE_EXPORT bool isFileUpload() const;
bool isImageButton() const;
WEBCORE_EXPORT bool isNumberField() const;
- bool isSubmitButton() const;
+ bool isSubmitButton() const final;
WEBCORE_EXPORT bool isTelephoneField() const;
WEBCORE_EXPORT bool isURLField() const;
WEBCORE_EXPORT bool isDateField() const;
Modified: trunk/Source/WebCore/html/ImageInputType.cpp (277256 => 277257)
--- trunk/Source/WebCore/html/ImageInputType.cpp 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/Source/WebCore/html/ImageInputType.cpp 2021-05-10 07:16:13 UTC (rev 277257)
@@ -103,7 +103,7 @@
protectedElement->document().updateLayoutIgnorePendingStylesheets();
if (auto currentForm = protectedElement->form())
- currentForm->prepareForSubmission(event); // Event handlers can run.
+ currentForm->submitIfPossible(&event); // Event handlers can run.
protectedElement->setActivatedSubmit(false);
event.setDefaultHandled();
Modified: trunk/Source/WebCore/html/ImageInputType.h (277256 => 277257)
--- trunk/Source/WebCore/html/ImageInputType.h 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/Source/WebCore/html/ImageInputType.h 2021-05-10 07:16:13 UTC (rev 277257)
@@ -56,7 +56,7 @@
unsigned height() const final;
unsigned width() const final;
- IntPoint m_clickLocation; // Valid only during HTMLFormElement::prepareForSubmission().
+ IntPoint m_clickLocation; // Valid only during HTMLFormElement::submitIfPossible().
};
} // namespace WebCore
Modified: trunk/Source/WebCore/html/InputType.h (277256 => 277257)
--- trunk/Source/WebCore/html/InputType.h 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/Source/WebCore/html/InputType.h 2021-05-10 07:16:13 UTC (rev 277257)
@@ -177,7 +177,7 @@
bool isRadioButton() const { return m_type == Type::Radio; }
bool isRangeControl() const { return m_type == Type::Range; }
bool isSearchField() const { return m_type == Type::Search; }
- bool isSubmitButton() const { return m_type == Type::Submit; }
+ bool isSubmitButton() const { return m_type == Type::Submit || m_type == Type::Image; }
bool isTelephoneField() const { return m_type == Type::Telephone; }
bool isTimeField() const { return m_type == Type::Time; }
bool isURLField() const { return m_type == Type::URL; }
Modified: trunk/Source/WebCore/html/SubmitInputType.cpp (277256 => 277257)
--- trunk/Source/WebCore/html/SubmitInputType.cpp 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/Source/WebCore/html/SubmitInputType.cpp 2021-05-10 07:16:13 UTC (rev 277257)
@@ -74,8 +74,8 @@
protectedElement->document().updateLayoutIgnorePendingStylesheets();
protectedElement->setActivatedSubmit(true);
- if (auto currentForm = protectedElement->form())
- currentForm->prepareForSubmission(event); // Event handlers can run.
+ if (auto currentForm = makeRefPtr(protectedElement->form()))
+ currentForm->submitIfPossible(&event); // Event handlers can run.
protectedElement->setActivatedSubmit(false);
event.setDefaultHandled();
}
Modified: trunk/Source/WebCore/loader/FormSubmission.cpp (277256 => 277257)
--- trunk/Source/WebCore/loader/FormSubmission.cpp 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/Source/WebCore/loader/FormSubmission.cpp 2021-05-10 07:16:13 UTC (rev 277257)
@@ -142,19 +142,20 @@
return document.textEncoding();
}
-Ref<FormSubmission> FormSubmission::create(HTMLFormElement& form, const Attributes& attributes, Event* event, LockHistory lockHistory, FormSubmissionTrigger trigger)
+Ref<FormSubmission> FormSubmission::create(HTMLFormElement& form, HTMLFormControlElement* overrideSubmitter, const Attributes& attributes, Event* event, LockHistory lockHistory, FormSubmissionTrigger trigger)
{
auto copiedAttributes = attributes;
- if (auto* submitButton = form.findSubmitButton(event)) {
+ auto submitter = makeRefPtr(overrideSubmitter ? overrideSubmitter : form.findSubmitter(event));
+ if (submitter) {
AtomString attributeValue;
- if (!(attributeValue = submitButton->attributeWithoutSynchronization(formactionAttr)).isNull())
+ if (!(attributeValue = submitter->attributeWithoutSynchronization(formactionAttr)).isNull())
copiedAttributes.parseAction(attributeValue);
- if (!(attributeValue = submitButton->attributeWithoutSynchronization(formenctypeAttr)).isNull())
+ if (!(attributeValue = submitter->attributeWithoutSynchronization(formenctypeAttr)).isNull())
copiedAttributes.updateEncodingType(attributeValue);
- if (!(attributeValue = submitButton->attributeWithoutSynchronization(formmethodAttr)).isNull())
+ if (!(attributeValue = submitter->attributeWithoutSynchronization(formmethodAttr)).isNull())
copiedAttributes.updateMethodType(attributeValue);
- if (!(attributeValue = submitButton->attributeWithoutSynchronization(formtargetAttr)).isNull())
+ if (!(attributeValue = submitter->attributeWithoutSynchronization(formtargetAttr)).isNull())
copiedAttributes.setTarget(attributeValue);
}
@@ -214,7 +215,7 @@
auto formState = FormState::create(form, WTFMove(formValues), document, trigger);
- return adoptRef(*new FormSubmission(copiedAttributes.method(), actionURL, form.effectiveTarget(event), encodingType, WTFMove(formState), formData.releaseNonNull(), boundary, lockHistory, event));
+ return adoptRef(*new FormSubmission(copiedAttributes.method(), actionURL, form.effectiveTarget(event, submitter.get()), encodingType, WTFMove(formState), formData.releaseNonNull(), boundary, lockHistory, event));
}
URL FormSubmission::requestURL() const
Modified: trunk/Source/WebCore/loader/FormSubmission.h (277256 => 277257)
--- trunk/Source/WebCore/loader/FormSubmission.h 2021-05-10 07:10:31 UTC (rev 277256)
+++ trunk/Source/WebCore/loader/FormSubmission.h 2021-05-10 07:16:13 UTC (rev 277257)
@@ -40,6 +40,7 @@
class Event;
class FormData;
class FrameLoadRequest;
+class HTMLFormControlElement;
class FormSubmission : public RefCounted<FormSubmission>, public CanMakeWeakPtr<FormSubmission> {
public:
@@ -75,7 +76,7 @@
String m_acceptCharset;
};
- static Ref<FormSubmission> create(HTMLFormElement&, const Attributes&, Event*, LockHistory, FormSubmissionTrigger);
+ static Ref<FormSubmission> create(HTMLFormElement&, HTMLFormControlElement* overrideSubmitter, const Attributes&, Event*, LockHistory, FormSubmissionTrigger);
void populateFrameLoadRequest(FrameLoadRequest&);
URL requestURL() const;