WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
WIP Patch
SubmitEvent_support_wip.patch (text/plain), 14.60 KB, created by
Chris Dumez
on 2021-07-15 17:01:33 PDT
(
hide
)
Description:
WIP Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2021-07-15 17:01:33 PDT
Size:
14.60 KB
patch
obsolete
>diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt >index e81ecbb91171..f19283fe3991 100644 >--- a/Source/WebCore/CMakeLists.txt >+++ b/Source/WebCore/CMakeLists.txt >@@ -1024,6 +1024,7 @@ set(WebCore_NON_SVG_IDL_FILES > html/MediaError.idl > html/OffscreenCanvas.idl > html/RadioNodeList.idl >+ html/SubmitEvent.idl > html/TextMetrics.idl > html/TimeRanges.idl > html/URLSearchParams.idl >diff --git a/Source/WebCore/DerivedSources-input.xcfilelist b/Source/WebCore/DerivedSources-input.xcfilelist >index b57b886cd3b4..da9efc09b374 100644 >--- a/Source/WebCore/DerivedSources-input.xcfilelist >+++ b/Source/WebCore/DerivedSources-input.xcfilelist >@@ -1050,6 +1050,7 @@ $(PROJECT_DIR)/html/MediaEncryptedEvent.idl > $(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 >diff --git a/Source/WebCore/DerivedSources-output.xcfilelist b/Source/WebCore/DerivedSources-output.xcfilelist >index f150e3b2776c..fdf4e9f5d496 100644 >--- a/Source/WebCore/DerivedSources-output.xcfilelist >+++ b/Source/WebCore/DerivedSources-output.xcfilelist >@@ -2243,6 +2243,8 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSStyleSheet.cpp > $(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 >diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make >index 6c1bb60d7681..c7bf44bc99c4 100644 >--- a/Source/WebCore/DerivedSources.make >+++ b/Source/WebCore/DerivedSources.make >@@ -900,6 +900,7 @@ JS_BINDING_IDLS := \ > $(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 \ >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index 3cbfa5ab5a4b..d8f9f18def6a 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -1297,6 +1297,7 @@ html/RubyElement.cpp > html/RubyTextElement.cpp > html/SearchInputType.cpp > html/StepRange.cpp >+html/SubmitEvent.cpp > html/SubmitInputType.cpp > html/TelephoneInputType.cpp > html/TextDocument.cpp >@@ -3671,6 +3672,7 @@ JSStylePropertyMap.cpp > JSStylePropertyMapReadOnly.cpp > JSStyleSheet.cpp > JSStyleSheetList.cpp >+JSSubmitEvent.cpp > JSSubtleCrypto.cpp > JSText.cpp > JSTextDecoder.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 4a1d78654768..bebbd08a612e 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -1316,6 +1316,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, ); }; }; > 46DFF4981DC2603100B80B48 /* ShadowRootMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DFF4961DC2601300B80B48 /* ShadowRootMode.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 46DFF49C1DC2620B00B80B48 /* JSShadowRootMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DFF49A1DC261F900B80B48 /* JSShadowRootMode.h */; }; >@@ -8392,6 +8393,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>"; }; > 46DFF4961DC2601300B80B48 /* ShadowRootMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowRootMode.h; sourceTree = "<group>"; }; > 46DFF4971DC2601300B80B48 /* ShadowRootMode.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ShadowRootMode.idl; sourceTree = "<group>"; }; >@@ -24162,6 +24166,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 */, >@@ -35329,6 +35336,7 @@ > E4AFD00C0DAF335400F5F55C /* SMILTime.h in Headers */, > E4AFD00E0DAF335500F5F55C /* SMILTimeContainer.h in Headers */, > 5C7C88D81D0F1F4A009D2F6D /* SocketProvider.h in Headers */, >+ 46D0004026A0FEB300D1BF1E /* SubmitEvent.h in Headers */, > 510D4A34103165EE0049EA54 /* SocketStreamError.h in Headers */, > 510D4A37103165EE0049EA54 /* SocketStreamHandle.h in Headers */, > 510D4A38103165EE0049EA54 /* SocketStreamHandleClient.h in Headers */, >diff --git a/Source/WebCore/dom/EventNames.in b/Source/WebCore/dom/EventNames.in >index 6c7ce3127b97..55697d3d8d48 100644 >--- a/Source/WebCore/dom/EventNames.in >+++ b/Source/WebCore/dom/EventNames.in >@@ -35,6 +35,7 @@ PageTransitionEvent > PopStateEvent > ProgressEvent > PromiseRejectionEvent >+SubmitEvent > TextEvent > TransitionEvent > UIEvent >diff --git a/Source/WebCore/html/HTMLFormElement.cpp b/Source/WebCore/html/HTMLFormElement.cpp >index 9abcac210214..3e2638c556fc 100644 >--- a/Source/WebCore/html/HTMLFormElement.cpp >+++ b/Source/WebCore/html/HTMLFormElement.cpp >@@ -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> >@@ -289,7 +290,7 @@ void HTMLFormElement::submitIfPossible(Event* event, HTMLFormControlElement* sub > > 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. >diff --git a/Source/WebCore/html/SubmitEvent.cpp b/Source/WebCore/html/SubmitEvent.cpp >new file mode 100644 >index 000000000000..8a19fc796110 >--- /dev/null >+++ b/Source/WebCore/html/SubmitEvent.cpp >@@ -0,0 +1,59 @@ >+/* >+ * 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" >+ >+namespace WebCore { >+ >+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 >diff --git a/Source/WebCore/html/SubmitEvent.h b/Source/WebCore/html/SubmitEvent.h >new file mode 100644 >index 000000000000..f73bd69f52ca >--- /dev/null >+++ b/Source/WebCore/html/SubmitEvent.h >@@ -0,0 +1,56 @@ >+/* >+ * 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 { >+public: >+ struct Init : EventInit { >+ RefPtr<HTMLElement> submitter; >+ }; >+ >+ static Ref<SubmitEvent> create(const AtomString& type, Init&& 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 >diff --git a/Source/WebCore/html/SubmitEvent.idl b/Source/WebCore/html/SubmitEvent.idl >new file mode 100644 >index 000000000000..915a9c15b56e >--- /dev/null >+++ b/Source/WebCore/html/SubmitEvent.idl >@@ -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; >+};
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 202978
:
433637
|
433643
|
433657