Title: [279979] trunk
Revision
279979
Author
[email protected]
Date
2021-07-15 23:52:15 -0700 (Thu, 15 Jul 2021)

Log Message

Implement 'SubmitEvent' interface
https://bugs.webkit.org/show_bug.cgi?id=202978

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline WPT tests now that more checks are passing.

* web-platform-tests/html/semantics/forms/form-submission-0/SubmitEvent.window-expected.txt:
* web-platform-tests/html/semantics/forms/form-submission-0/implicit-submission.optional-expected.txt:

Source/WebCore:

Implement 'SubmitEvent' interface as per:
- https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submitevent

Both Chrome and Firefox already ship this.

No new tests, rebaselined existing tests.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/EventNames.in:
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::submitIfPossible):
* html/SubmitEvent.cpp: Added.
(WebCore::SubmitEvent::create):
(WebCore::SubmitEvent::SubmitEvent):
(WebCore::SubmitEvent::eventInterface const):
* html/SubmitEvent.h: Added.
(WebCore::SubmitEvent::submitter const):
* html/SubmitEvent.idl: Added.

* html/SubmitInputType.cpp:
(WebCore::SubmitInputType::handleDOMActivateEvent):
Make sure SubmitInputType::handleDOMActivateEvent() passes its element as submitter
when submitting the form. One of the subtests in html/semantics/forms/form-submission-0/implicit-submission.optional.html
covers this.

LayoutTests:

Rebaseline WPT test now that more checks are passing.

* 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:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (279978 => 279979)


--- trunk/LayoutTests/ChangeLog	2021-07-16 06:15:47 UTC (rev 279978)
+++ trunk/LayoutTests/ChangeLog	2021-07-16 06:52:15 UTC (rev 279979)
@@ -1,5 +1,17 @@
 2021-07-15  Chris Dumez  <[email protected]>
 
+        Implement 'SubmitEvent' interface
+        https://bugs.webkit.org/show_bug.cgi?id=202978
+
+        Reviewed by Alex Christensen.
+
+        Rebaseline WPT test now that more checks are passing.
+
+        * 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:
+
+2021-07-15  Chris Dumez  <[email protected]>
+
         Add support for MediaError.message
         https://bugs.webkit.org/show_bug.cgi?id=228008
 

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (279978 => 279979)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-07-16 06:15:47 UTC (rev 279978)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-07-16 06:52:15 UTC (rev 279979)
@@ -1,5 +1,17 @@
 2021-07-15  Chris Dumez  <[email protected]>
 
+        Implement 'SubmitEvent' interface
+        https://bugs.webkit.org/show_bug.cgi?id=202978
+
+        Reviewed by Alex Christensen.
+
+        Rebaseline WPT tests now that more checks are passing.
+
+        * web-platform-tests/html/semantics/forms/form-submission-0/SubmitEvent.window-expected.txt:
+        * web-platform-tests/html/semantics/forms/form-submission-0/implicit-submission.optional-expected.txt:
+
+2021-07-15  Chris Dumez  <[email protected]>
+
         Add initial support for BroadcastChannel behind a runtime flag
         https://bugs.webkit.org/show_bug.cgi?id=227924
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/SubmitEvent.window-expected.txt (279978 => 279979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/SubmitEvent.window-expected.txt	2021-07-16 06:15:47 UTC (rev 279978)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/SubmitEvent.window-expected.txt	2021-07-16 06:52:15 UTC (rev 279979)
@@ -1,10 +1,8 @@
 
-FAIL Failing SubmitEvent constructor assert_throws_js: 0 arguments function "() => { new SubmitEvent() }" threw object "ReferenceError: Can't find variable: SubmitEvent" ("ReferenceError") expected instance of function "function TypeError() {
-    [native code]
-}" ("TypeError")
-FAIL Successful SubmitEvent constructor Can't find variable: SubmitEvent
-FAIL Successful SubmitEvent constructor; null/undefined submitter Can't find variable: SubmitEvent
-FAIL Successful SubmitEvent constructor; null/undefined dictionary Can't find variable: SubmitEvent
-FAIL Successful SubmitEvent constructor; empty dictionary Can't find variable: SubmitEvent
-FAIL Successful SubmitEvent constructor; missing dictionary Can't find variable: SubmitEvent
+PASS Failing SubmitEvent constructor
+PASS Successful SubmitEvent constructor
+PASS Successful SubmitEvent constructor; null/undefined submitter
+PASS Successful SubmitEvent constructor; null/undefined dictionary
+PASS Successful SubmitEvent constructor; empty dictionary
+PASS Successful SubmitEvent constructor; missing dictionary
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/implicit-submission.optional-expected.txt (279978 => 279979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/implicit-submission.optional-expected.txt	2021-07-16 06:15:47 UTC (rev 279978)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/implicit-submission.optional-expected.txt	2021-07-16 06:52:15 UTC (rev 279979)
@@ -2,6 +2,6 @@
 
 
 
-FAIL Submit event with a submit button assert_equals: expected (object) Element node <input name="submitButton" type="submit"></input> but got (undefined) undefined
-FAIL Submit event with no submit button assert_equals: expected (object) null but got (undefined) undefined
+PASS Submit event with a submit button
+PASS Submit event with no submit button
 

Modified: trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (279978 => 279979)


--- trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-07-16 06:15:47 UTC (rev 279978)
+++ trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-07-16 06:52:15 UTC (rev 279979)
@@ -3766,13 +3766,13 @@
 PASS ValidityState interface: document.createElement("input").validity must inherit property "badInput" with the proper type
 PASS ValidityState interface: document.createElement("input").validity must inherit property "customError" with the proper type
 PASS ValidityState interface: document.createElement("input").validity must inherit property "valid" with the proper type
-FAIL SubmitEvent interface: existence and properties of interface object assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
-FAIL SubmitEvent interface object length assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
-FAIL SubmitEvent interface object name assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
-FAIL SubmitEvent interface: existence and properties of interface prototype object assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
-FAIL SubmitEvent interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
-FAIL SubmitEvent interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
-FAIL SubmitEvent interface: attribute submitter assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
+PASS SubmitEvent interface: existence and properties of interface object
+PASS SubmitEvent interface object length
+PASS SubmitEvent interface object name
+PASS SubmitEvent interface: existence and properties of interface prototype object
+PASS SubmitEvent interface: existence and properties of interface prototype object's "constructor" property
+PASS SubmitEvent interface: existence and properties of interface prototype object's @@unscopables property
+PASS SubmitEvent interface: attribute submitter
 FAIL FormDataEvent interface: existence and properties of interface object assert_own_property: self does not have own property "FormDataEvent" expected property "FormDataEvent" missing
 FAIL FormDataEvent interface object length assert_own_property: self does not have own property "FormDataEvent" expected property "FormDataEvent" missing
 FAIL FormDataEvent interface object name assert_own_property: self does not have own property "FormDataEvent" expected property "FormDataEvent" missing

Modified: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (279978 => 279979)


--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-07-16 06:15:47 UTC (rev 279978)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-07-16 06:52:15 UTC (rev 279979)
@@ -3776,13 +3776,13 @@
 PASS ValidityState interface: document.createElement("input").validity must inherit property "badInput" with the proper type
 PASS ValidityState interface: document.createElement("input").validity must inherit property "customError" with the proper type
 PASS ValidityState interface: document.createElement("input").validity must inherit property "valid" with the proper type
-FAIL SubmitEvent interface: existence and properties of interface object assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
-FAIL SubmitEvent interface object length assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
-FAIL SubmitEvent interface object name assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
-FAIL SubmitEvent interface: existence and properties of interface prototype object assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
-FAIL SubmitEvent interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
-FAIL SubmitEvent interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
-FAIL SubmitEvent interface: attribute submitter assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
+PASS SubmitEvent interface: existence and properties of interface object
+PASS SubmitEvent interface object length
+PASS SubmitEvent interface object name
+PASS SubmitEvent interface: existence and properties of interface prototype object
+PASS SubmitEvent interface: existence and properties of interface prototype object's "constructor" property
+PASS SubmitEvent interface: existence and properties of interface prototype object's @@unscopables property
+PASS SubmitEvent interface: attribute submitter
 FAIL FormDataEvent interface: existence and properties of interface object assert_own_property: self does not have own property "FormDataEvent" expected property "FormDataEvent" missing
 FAIL FormDataEvent interface object length assert_own_property: self does not have own property "FormDataEvent" expected property "FormDataEvent" missing
 FAIL FormDataEvent interface object name assert_own_property: self does not have own property "FormDataEvent" expected property "FormDataEvent" missing

Modified: trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (279978 => 279979)


--- trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-07-16 06:15:47 UTC (rev 279978)
+++ trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-07-16 06:52:15 UTC (rev 279979)
@@ -3776,13 +3776,13 @@
 PASS ValidityState interface: document.createElement("input").validity must inherit property "badInput" with the proper type
 PASS ValidityState interface: document.createElement("input").validity must inherit property "customError" with the proper type
 PASS ValidityState interface: document.createElement("input").validity must inherit property "valid" with the proper type
-FAIL SubmitEvent interface: existence and properties of interface object assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
-FAIL SubmitEvent interface object length assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
-FAIL SubmitEvent interface object name assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
-FAIL SubmitEvent interface: existence and properties of interface prototype object assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
-FAIL SubmitEvent interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
-FAIL SubmitEvent interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
-FAIL SubmitEvent interface: attribute submitter assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
+PASS SubmitEvent interface: existence and properties of interface object
+PASS SubmitEvent interface object length
+PASS SubmitEvent interface object name
+PASS SubmitEvent interface: existence and properties of interface prototype object
+PASS SubmitEvent interface: existence and properties of interface prototype object's "constructor" property
+PASS SubmitEvent interface: existence and properties of interface prototype object's @@unscopables property
+PASS SubmitEvent interface: attribute submitter
 FAIL FormDataEvent interface: existence and properties of interface object assert_own_property: self does not have own property "FormDataEvent" expected property "FormDataEvent" missing
 FAIL FormDataEvent interface object length assert_own_property: self does not have own property "FormDataEvent" expected property "FormDataEvent" missing
 FAIL FormDataEvent interface object name assert_own_property: self does not have own property "FormDataEvent" expected property "FormDataEvent" missing

Modified: trunk/Source/WebCore/CMakeLists.txt (279978 => 279979)


--- trunk/Source/WebCore/CMakeLists.txt	2021-07-16 06:15:47 UTC (rev 279978)
+++ trunk/Source/WebCore/CMakeLists.txt	2021-07-16 06:52:15 UTC (rev 279979)
@@ -1025,6 +1025,7 @@
     html/MediaError.idl
     html/OffscreenCanvas.idl
     html/RadioNodeList.idl
+    html/SubmitEvent.idl
     html/TextMetrics.idl
     html/TimeRanges.idl
     html/URLSearchParams.idl

Modified: trunk/Source/WebCore/ChangeLog (279978 => 279979)


--- trunk/Source/WebCore/ChangeLog	2021-07-16 06:15:47 UTC (rev 279978)
+++ trunk/Source/WebCore/ChangeLog	2021-07-16 06:52:15 UTC (rev 279979)
@@ -1,5 +1,42 @@
 2021-07-15  Chris Dumez  <[email protected]>
 
+        Implement 'SubmitEvent' interface
+        https://bugs.webkit.org/show_bug.cgi?id=202978
+
+        Reviewed by Alex Christensen.
+
+        Implement 'SubmitEvent' interface as per:
+        - https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submitevent
+
+        Both Chrome and Firefox already ship this.
+
+        No new tests, rebaselined existing tests.
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/EventNames.in:
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::submitIfPossible):
+        * html/SubmitEvent.cpp: Added.
+        (WebCore::SubmitEvent::create):
+        (WebCore::SubmitEvent::SubmitEvent):
+        (WebCore::SubmitEvent::eventInterface const):
+        * html/SubmitEvent.h: Added.
+        (WebCore::SubmitEvent::submitter const):
+        * html/SubmitEvent.idl: Added.
+
+        * html/SubmitInputType.cpp:
+        (WebCore::SubmitInputType::handleDOMActivateEvent):
+        Make sure SubmitInputType::handleDOMActivateEvent() passes its element as submitter
+        when submitting the form. One of the subtests in html/semantics/forms/form-submission-0/implicit-submission.optional.html
+        covers this.
+
+2021-07-15  Chris Dumez  <[email protected]>
+
         Add support for MediaError.message
         https://bugs.webkit.org/show_bug.cgi?id=228008
 

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (279978 => 279979)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2021-07-16 06:15:47 UTC (rev 279978)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2021-07-16 06:52:15 UTC (rev 279979)
@@ -1051,6 +1051,7 @@
 $(PROJECT_DIR)/html/MediaError.idl
 $(PROJECT_DIR)/html/OffscreenCanvas.idl
 $(PROJECT_DIR)/html/RadioNodeList.idl
+$(PROJECT_DIR)/html/SubmitEvent.idl
 $(PROJECT_DIR)/html/TextMetrics.idl
 $(PROJECT_DIR)/html/TimeRanges.idl
 $(PROJECT_DIR)/html/URLSearchParams.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (279978 => 279979)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2021-07-16 06:15:47 UTC (rev 279978)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2021-07-16 06:52:15 UTC (rev 279979)
@@ -2245,6 +2245,8 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSStyleSheet.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSStyleSheetList.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSStyleSheetList.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSubmitEvent.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSubmitEvent.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSubtleCrypto.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSubtleCrypto.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSText.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (279978 => 279979)


--- trunk/Source/WebCore/DerivedSources.make	2021-07-16 06:15:47 UTC (rev 279978)
+++ trunk/Source/WebCore/DerivedSources.make	2021-07-16 06:52:15 UTC (rev 279979)
@@ -901,6 +901,7 @@
     $(WebCore)/html/MediaError.idl \
     $(WebCore)/html/OffscreenCanvas.idl \
     $(WebCore)/html/RadioNodeList.idl \
+    $(WebCore)/html/SubmitEvent.idl \
     $(WebCore)/html/TextMetrics.idl \
     $(WebCore)/html/TimeRanges.idl \
     $(WebCore)/html/URLSearchParams.idl \

Modified: trunk/Source/WebCore/Sources.txt (279978 => 279979)


--- trunk/Source/WebCore/Sources.txt	2021-07-16 06:15:47 UTC (rev 279978)
+++ trunk/Source/WebCore/Sources.txt	2021-07-16 06:52:15 UTC (rev 279979)
@@ -1298,6 +1298,7 @@
 html/RubyTextElement.cpp
 html/SearchInputType.cpp
 html/StepRange.cpp
+html/SubmitEvent.cpp
 html/SubmitInputType.cpp
 html/TelephoneInputType.cpp
 html/TextDocument.cpp
@@ -3673,6 +3674,7 @@
 JSStylePropertyMapReadOnly.cpp
 JSStyleSheet.cpp
 JSStyleSheetList.cpp
+JSSubmitEvent.cpp
 JSSubtleCrypto.cpp
 JSText.cpp
 JSTextDecoder.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (279978 => 279979)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-07-16 06:15:47 UTC (rev 279978)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-07-16 06:52:15 UTC (rev 279979)
@@ -1317,6 +1317,7 @@
 		46C696CC1E7205FC00597937 /* CPUMonitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46C696CA1E7205E400597937 /* CPUMonitor.cpp */; };
 		46C83EFE1A9BBE2900A79A41 /* GeoNotifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C83EFC1A9BBE2900A79A41 /* GeoNotifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		46CA9C441F97BBE9004CFC3A /* VisibilityState.h in Headers */ = {isa = PBXBuildFile; fileRef = 46CA9C411F97BBE7004CFC3A /* VisibilityState.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		46D0004026A0FEB300D1BF1E /* SubmitEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 46D0003E26A0FE6F00D1BF1E /* SubmitEvent.h */; };
 		46DBB6501AB8C96F00D9A813 /* PowerObserverMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		46DD93D7269DE756001AFD88 /* BroadcastChannelIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DD93D5269DE74B001AFD88 /* BroadcastChannelIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		46DE9BB5269DF93E0024C5A6 /* BroadcastChannelRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DE9BB4269DF9320024C5A6 /* BroadcastChannelRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8398,6 +8399,9 @@
 		46C83EFC1A9BBE2900A79A41 /* GeoNotifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeoNotifier.h; sourceTree = "<group>"; };
 		46CA9C411F97BBE7004CFC3A /* VisibilityState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisibilityState.h; sourceTree = "<group>"; };
 		46CA9C421F97BBE7004CFC3A /* VisibilityState.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VisibilityState.idl; sourceTree = "<group>"; };
+		46D0003C26A0FE6F00D1BF1E /* SubmitEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubmitEvent.cpp; sourceTree = "<group>"; };
+		46D0003E26A0FE6F00D1BF1E /* SubmitEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubmitEvent.h; sourceTree = "<group>"; };
+		46D0003F26A0FE7000D1BF1E /* SubmitEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SubmitEvent.idl; sourceTree = "<group>"; };
 		46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PowerObserverMac.h; sourceTree = "<group>"; };
 		46DD93D5269DE74B001AFD88 /* BroadcastChannelIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BroadcastChannelIdentifier.h; sourceTree = "<group>"; };
 		46DE9BB4269DF9320024C5A6 /* BroadcastChannelRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BroadcastChannelRegistry.h; sourceTree = "<group>"; };
@@ -24170,6 +24174,9 @@
 				F55B3D9E1251F12D003EF269 /* SearchInputType.h */,
 				A5AFB34D115151A700B045CB /* StepRange.cpp */,
 				A5AFB34E115151A700B045CB /* StepRange.h */,
+				46D0003C26A0FE6F00D1BF1E /* SubmitEvent.cpp */,
+				46D0003E26A0FE6F00D1BF1E /* SubmitEvent.h */,
+				46D0003F26A0FE7000D1BF1E /* SubmitEvent.idl */,
 				F55B3D9F1251F12D003EF269 /* SubmitInputType.cpp */,
 				F55B3DA01251F12D003EF269 /* SubmitInputType.h */,
 				F55B3DA11251F12D003EF269 /* TelephoneInputType.cpp */,
@@ -35509,6 +35516,7 @@
 				BC5EB69A0E81DA6300B25965 /* StyleVisualData.h in Headers */,
 				D000ED2811C1B9CD00C47726 /* SubframeLoader.h in Headers */,
 				1FC40FBA1655CCB90040F29E /* SubimageCacheWithTimer.h in Headers */,
+				46D0004026A0FEB300D1BF1E /* SubmitEvent.h in Headers */,
 				F55B3DD41251F12D003EF269 /* SubmitInputType.h in Headers */,
 				656D37480ADBA5DE00A4554D /* SubresourceLoader.h in Headers */,
 				659A7D130B6DB4D9001155B3 /* SubstituteData.h in Headers */,

Modified: trunk/Source/WebCore/dom/EventNames.in (279978 => 279979)


--- trunk/Source/WebCore/dom/EventNames.in	2021-07-16 06:15:47 UTC (rev 279978)
+++ trunk/Source/WebCore/dom/EventNames.in	2021-07-16 06:52:15 UTC (rev 279979)
@@ -35,6 +35,7 @@
 PopStateEvent
 ProgressEvent
 PromiseRejectionEvent
+SubmitEvent
 TextEvent
 TransitionEvent
 UIEvent

Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (279978 => 279979)


--- trunk/Source/WebCore/html/HTMLFormElement.cpp	2021-07-16 06:15:47 UTC (rev 279978)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp	2021-07-16 06:52:15 UTC (rev 279979)
@@ -55,6 +55,7 @@
 #include "RuntimeEnabledFeatures.h"
 #include "ScriptDisallowedScope.h"
 #include "Settings.h"
+#include "SubmitEvent.h"
 #include "UserGestureIndicator.h"
 #include <limits>
 #include <wtf/IsoMallocInlines.h>
@@ -268,7 +269,6 @@
     m_shouldSubmit = false;
 
     bool shouldValidate = document().page() && document().page()->settings().interactiveFormValidationEnabled() && !noValidate();
-
     if (shouldValidate) {
         auto submitElement = makeRefPtr(submitter ? submitter : findSubmitter(event));
         if (submitElement && submitElement->formNoValidate())
@@ -289,7 +289,7 @@
 
     auto protectedThis = makeRef(*this);
 
-    auto submitEvent = Event::create(eventNames().submitEvent, Event::CanBubble::Yes, Event::IsCancelable::Yes);
+    auto submitEvent = SubmitEvent::create(submitter);
     dispatchEvent(submitEvent);
 
     // Event handling could have resulted in m_shouldSubmit becoming true as a side effect, too.

Added: trunk/Source/WebCore/html/SubmitEvent.cpp (0 => 279979)


--- trunk/Source/WebCore/html/SubmitEvent.cpp	                        (rev 0)
+++ trunk/Source/WebCore/html/SubmitEvent.cpp	2021-07-16 06:52:15 UTC (rev 279979)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SubmitEvent.h"
+
+#include "EventNames.h"
+#include "HTMLElement.h"
+#include <wtf/IsoMallocInlines.h>
+
+namespace WebCore {
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(SubmitEvent);
+
+Ref<SubmitEvent> SubmitEvent::create(const WTF::AtomString& type, Init&& init)
+{
+    return adoptRef(*new SubmitEvent(type, WTFMove(init)));
+}
+
+Ref<SubmitEvent> SubmitEvent::create(RefPtr<HTMLElement>&& submitter)
+{
+    return adoptRef(*new SubmitEvent(WTFMove(submitter)));
+}
+
+SubmitEvent::SubmitEvent(const AtomString& type, Init&& init)
+    : Event(type, init, IsTrusted::No)
+    , m_submitter(WTFMove(init.submitter))
+{ }
+
+SubmitEvent::SubmitEvent(RefPtr<HTMLElement>&& submitter)
+    : Event(eventNames().submitEvent, CanBubble::Yes, IsCancelable::Yes)
+    , m_submitter(WTFMove(submitter))
+{ }
+
+EventInterface SubmitEvent::eventInterface() const
+{
+    return SubmitEventInterfaceType;
+}
+
+} // namespace WebCore

Added: trunk/Source/WebCore/html/SubmitEvent.h (0 => 279979)


--- trunk/Source/WebCore/html/SubmitEvent.h	                        (rev 0)
+++ trunk/Source/WebCore/html/SubmitEvent.h	2021-07-16 06:52:15 UTC (rev 279979)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "Event.h"
+#include "EventInit.h"
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class HTMLElement;
+
+class SubmitEvent : public Event {
+    WTF_MAKE_ISO_ALLOCATED(SubmitEvent);
+public:
+    struct Init : EventInit {
+        RefPtr<HTMLElement> submitter;
+    };
+
+    static Ref<SubmitEvent> create(const AtomString& type, Init&&);
+    static Ref<SubmitEvent> create(RefPtr<HTMLElement>&& submitter);
+
+    HTMLElement* submitter() const { return m_submitter.get(); }
+
+private:
+    SubmitEvent(const AtomString& type, Init&&);
+    explicit SubmitEvent(RefPtr<HTMLElement>&& submitter);
+
+    EventInterface eventInterface() const final;
+
+    RefPtr<HTMLElement> m_submitter;
+};
+
+} // namespace WebCore

Added: trunk/Source/WebCore/html/SubmitEvent.idl (0 => 279979)


--- trunk/Source/WebCore/html/SubmitEvent.idl	                        (rev 0)
+++ trunk/Source/WebCore/html/SubmitEvent.idl	2021-07-16 06:52:15 UTC (rev 279979)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2021 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Exposed=Window
+] interface SubmitEvent : Event {
+    constructor(DOMString type, optional SubmitEventInit eventInitDict);
+
+    readonly attribute HTMLElement? submitter;
+};
+
+dictionary SubmitEventInit : EventInit {
+    HTMLElement? submitter = null;
+};

Modified: trunk/Source/WebCore/html/SubmitInputType.cpp (279978 => 279979)


--- trunk/Source/WebCore/html/SubmitInputType.cpp	2021-07-16 06:15:47 UTC (rev 279978)
+++ trunk/Source/WebCore/html/SubmitInputType.cpp	2021-07-16 06:52:15 UTC (rev 279979)
@@ -75,7 +75,7 @@
 
     protectedElement->setActivatedSubmit(true);
     if (auto currentForm = makeRefPtr(protectedElement->form()))
-        currentForm->submitIfPossible(&event); // Event handlers can run.
+        currentForm->submitIfPossible(&event, element()); // Event handlers can run.
     protectedElement->setActivatedSubmit(false);
     event.setDefaultHandled();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to