From 99b3a16505f8e33c592e4b2981d150485cb2f9fd Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Thu, 25 Jul 2024 06:22:27 -0700 Subject: [PATCH] rename Invokers features from invoke to command https://bugs.webkit.org/show_bug.cgi?id=276616 Reviewed by Anne van Kesteren. This renames the attributes invoketarget->commandfor and invokeaction->command, as well as renaming the InvokeEvent to CommandEvent, and it's action property to command. It also drops the `auto` action, requiring explicit `command` attribute for each action. Lastly, this also adds the logic preventing invokers from being triggered within a form without an explicit type=button attribute. These changes are based on a set of discussions around the proposals naming and semantics, which starts here: https://github.com/whatwg/html/issues/9625#issuecomment-2115718679 and concludes here; https://github.com/whatwg/html/issues/9625#issuecomment-2209335876 * LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/idlharness.tentative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invokeelement-interface.tentative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invokeevent-dispatch-shadow.tentative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invokeevent-interface.tentative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-button-event-dispatch.tentative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-popover-behavior.tentative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-popover-invalid-behavior.tentative-expected.txt: * LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative-expected.txt. * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: * Source/WebCore/CMakeLists.txt: * Source/WebCore/DerivedSources-input.xcfilelist: * Source/WebCore/DerivedSources-output.xcfilelist: * Source/WebCore/DerivedSources.make: * Source/WebCore/Headers.cmake: * Source/WebCore/SmartPointerExpectations/UncountedLocalVarsCheckerExpectations: * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/bindings/js/WebCoreBuiltinNames.h: * Source/WebCore/dom/CommandEvent.cpp: Renamed from Source/WebCore/dom/InvokeEvent.cpp. (WebCore::CommandEvent::CommandEvent): (WebCore::CommandEvent::create): (WebCore::CommandEvent::createForBindings): (WebCore::CommandEvent::isCommandEvent const): (WebCore::CommandEvent::invoker const): * Source/WebCore/dom/CommandEvent.h: Renamed from Source/WebCore/dom/InvokeEvent.h. * Source/WebCore/dom/CommandEvent.idl: Renamed from Source/WebCore/dom/InvokeEvent.idl. * Source/WebCore/dom/DeviceOrientationAndMotionAccessController.h: * Source/WebCore/dom/Document.cpp: (WebCore::Document::handlePopoverLightDismiss): * Source/WebCore/dom/Element.cpp: (WebCore::Element::isElementReflectionAttribute): * Source/WebCore/dom/Element.h: (WebCore::Element::isValidCommandType): (WebCore::Element::handleCommandInternal): (WebCore::Element::isValidInvokeAction): Deleted. (WebCore::Element::handleInvokeInternal): Deleted. * Source/WebCore/dom/Event.h: (WebCore::Event::isCommandEvent const): (WebCore::Event::isInputEvent const): (WebCore::Event::isInvokeEvent const): Deleted. * Source/WebCore/dom/EventInterfaces.in: * Source/WebCore/dom/EventNames.json: * Source/WebCore/html/HTMLAttributeNames.in: * Source/WebCore/html/HTMLButtonElement.cpp: (WebCore::HTMLButtonElement::defaultEventHandler): * Source/WebCore/html/HTMLDialogElement.cpp: (WebCore::HTMLDialogElement::isValidCommandType): (WebCore::HTMLDialogElement::handleCommandInternal): (WebCore::HTMLDialogElement::isValidInvokeAction): Deleted. (WebCore::HTMLDialogElement::handleInvokeInternal): Deleted. * Source/WebCore/html/HTMLDialogElement.h: * Source/WebCore/html/HTMLElement.cpp: (WebCore::HTMLElement::isValidCommandType): (WebCore::HTMLElement::handleCommandInternal): (WebCore::HTMLElement::isValidInvokeAction): Deleted. (WebCore::HTMLElement::handleInvokeInternal): Deleted. * Source/WebCore/html/HTMLElement.h: * Source/WebCore/html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::commandForElement const): (WebCore::HTMLFormControlElement::commandType const): (WebCore::HTMLFormControlElement::handleCommand): (WebCore::HTMLFormControlElement::invokeTargetElement const): Deleted. (WebCore::HTMLFormControlElement::invokeAction const): Deleted. (WebCore::HTMLFormControlElement::handleInvokeAction): Deleted. * Source/WebCore/html/HTMLFormControlElement.h: * Source/WebCore/html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::defaultEventHandler): * Source/WebCore/html/InvokerElement.idl: * Source/WebCore/page/FragmentDirective.h: Canonical link: https://commits.webkit.org/281345@main --- .../idlharness.tentative-expected.txt | 24 ++++---- ...keelement-interface.tentative-expected.txt | 22 +++---- ...ent-dispatch-shadow.tentative-expected.txt | 4 +- ...vokeevent-interface.tentative-expected.txt | 61 +++++++------------ ...tton-event-dispatch.tentative-expected.txt | 38 ++++++------ ...-on-dialog-behavior.tentative-expected.txt | 42 ++++++------- ...on-popover-behavior.tentative-expected.txt | 28 ++++----- ...er-invalid-behavior.tentative-expected.txt | 14 ++--- ...-on-dialog-behavior.tentative-expected.txt | 49 +++++++++++++++ .../Preferences/UnifiedWebPreferences.yaml | 4 +- Source/WebCore/CMakeLists.txt | 2 +- .../WebCore/DerivedSources-input.xcfilelist | 2 +- .../WebCore/DerivedSources-output.xcfilelist | 4 +- Source/WebCore/DerivedSources.make | 3 +- Source/WebCore/Headers.cmake | 2 +- .../UncountedLocalVarsCheckerExpectations | 2 +- Source/WebCore/Sources.txt | 4 +- .../WebCore/WebCore.xcodeproj/project.pbxproj | 12 ++-- .../WebCore/bindings/js/WebCoreBuiltinNames.h | 2 +- .../dom/{InvokeEvent.cpp => CommandEvent.cpp} | 26 ++++---- .../dom/{InvokeEvent.h => CommandEvent.h} | 24 ++++---- .../dom/{InvokeEvent.idl => CommandEvent.idl} | 10 +-- ...viceOrientationAndMotionAccessController.h | 1 + Source/WebCore/dom/Document.cpp | 2 +- Source/WebCore/dom/Element.cpp | 2 +- Source/WebCore/dom/Element.h | 7 +-- Source/WebCore/dom/Event.h | 2 +- Source/WebCore/dom/EventInterfaces.in | 2 +- Source/WebCore/dom/EventNames.json | 2 +- Source/WebCore/html/HTMLAttributeNames.in | 4 +- Source/WebCore/html/HTMLButtonElement.cpp | 10 ++- Source/WebCore/html/HTMLDialogElement.cpp | 14 ++--- Source/WebCore/html/HTMLDialogElement.h | 4 +- Source/WebCore/html/HTMLElement.cpp | 14 ++--- Source/WebCore/html/HTMLElement.h | 4 +- .../WebCore/html/HTMLFormControlElement.cpp | 50 +++++++-------- Source/WebCore/html/HTMLFormControlElement.h | 6 +- Source/WebCore/html/HTMLInputElement.cpp | 4 +- Source/WebCore/html/InvokerElement.idl | 4 +- Source/WebCore/page/FragmentDirective.h | 1 + 40 files changed, 271 insertions(+), 241 deletions(-) create mode 100644 LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative-expected.txt rename Source/WebCore/dom/{InvokeEvent.cpp => CommandEvent.cpp} (71%) rename Source/WebCore/dom/{InvokeEvent.h => CommandEvent.h} (73%) rename Source/WebCore/dom/{InvokeEvent.idl => CommandEvent.idl} (86%) diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/idlharness.tentative-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/idlharness.tentative-expected.txt index 844a2444262fc..a8432b0ce04f8 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/idlharness.tentative-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/idlharness.tentative-expected.txt @@ -5,16 +5,16 @@ PASS Element includes ParentNode: member names are unique PASS Element includes NonDocumentTypeChildNode: member names are unique PASS Element includes ChildNode: member names are unique PASS Element includes Slottable: member names are unique -FAIL CommandEvent interface: existence and properties of interface object assert_own_property: self does not have own property "CommandEvent" expected property "CommandEvent" missing -FAIL CommandEvent interface object length assert_own_property: self does not have own property "CommandEvent" expected property "CommandEvent" missing -FAIL CommandEvent interface object name assert_own_property: self does not have own property "CommandEvent" expected property "CommandEvent" missing -FAIL CommandEvent interface: existence and properties of interface prototype object assert_own_property: self does not have own property "CommandEvent" expected property "CommandEvent" missing -FAIL CommandEvent interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "CommandEvent" expected property "CommandEvent" missing -FAIL CommandEvent interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "CommandEvent" expected property "CommandEvent" missing -FAIL CommandEvent interface: attribute invoker assert_own_property: self does not have own property "CommandEvent" expected property "CommandEvent" missing -FAIL CommandEvent interface: attribute command assert_own_property: self does not have own property "CommandEvent" expected property "CommandEvent" missing -FAIL CommandEvent must be primary interface of new CommandEvent("invoke") assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: CommandEvent" -FAIL Stringification of new CommandEvent("invoke") assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: CommandEvent" -FAIL CommandEvent interface: new CommandEvent("invoke") must inherit property "invoker" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: CommandEvent" -FAIL CommandEvent interface: new CommandEvent("invoke") must inherit property "command" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: CommandEvent" +PASS CommandEvent interface: existence and properties of interface object +PASS CommandEvent interface object length +PASS CommandEvent interface object name +PASS CommandEvent interface: existence and properties of interface prototype object +PASS CommandEvent interface: existence and properties of interface prototype object's "constructor" property +PASS CommandEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS CommandEvent interface: attribute invoker +PASS CommandEvent interface: attribute command +PASS CommandEvent must be primary interface of new CommandEvent("invoke") +PASS Stringification of new CommandEvent("invoke") +PASS CommandEvent interface: new CommandEvent("invoke") must inherit property "invoker" with the proper type +PASS CommandEvent interface: new CommandEvent("invoke") must inherit property "command" with the proper type diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invokeelement-interface.tentative-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invokeelement-interface.tentative-expected.txt index bfa70d7464b90..9676c6ae0d83f 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invokeelement-interface.tentative-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invokeelement-interface.tentative-expected.txt @@ -1,16 +1,14 @@ -FAIL commandForElement reflects invokee HTML element assert_equals: expected (object) Element node
but got (undefined) undefined -FAIL commandForElement reflects set value assert_equals: expected "" but got "invokee" -FAIL commandForElement reflects set value across shadow root into light dom assert_equals: expected "" but got "invokee" -FAIL commandForElement does not reflect set value inside shadowroot assert_equals: expected null but got Element node
-FAIL commandForElement throws error on assignment of non Element assert_throws_js: commandForElement attribute must be an instance of Element function "function () { - invoker.commandForElement = {}; - }" did not throw -FAIL command reflects '' when attribute empty, setAttribute version assert_equals: expected (string) "" but got (undefined) undefined -FAIL command reflects same casing assert_equals: expected "fooBarBaz" but got "" +PASS commandForElement reflects invokee HTML element +PASS commandForElement reflects set value +PASS commandForElement reflects set value across shadow root into light dom +PASS commandForElement does not reflect set value inside shadowroot +PASS commandForElement throws error on assignment of non Element +PASS command reflects '' when attribute empty, setAttribute version +PASS command reflects same casing PASS command reflects '' when attribute empty, IDL version -FAIL command reflects tostring value assert_equals: expected "1,2,3" but got "" -FAIL command reflects '' when attribute set to [] assert_equals: expected (string) "" but got (object) [] -FAIL command reflects tostring value 2 assert_equals: expected (string) "[object Object]" but got (object) object "[object Object]" +PASS command reflects tostring value +PASS command reflects '' when attribute set to [] +PASS command reflects tostring value 2 diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invokeevent-dispatch-shadow.tentative-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invokeevent-dispatch-shadow.tentative-expected.txt index 15197d8f2946c..a45667c252f98 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invokeevent-dispatch-shadow.tentative-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invokeevent-dispatch-shadow.tentative-expected.txt @@ -1,5 +1,5 @@ -FAIL CommandEvent propagates across shadow boundaries retargeting invoker Can't find variable: CommandEvent -FAIL cross shadow CommandEvent retargets invoker to host element Can't find variable: CommandEvent +PASS CommandEvent propagates across shadow boundaries retargeting invoker +PASS cross shadow CommandEvent retargets invoker to host element diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invokeevent-interface.tentative-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invokeevent-interface.tentative-expected.txt index 96a21fa61356a..7626f23ab9577 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invokeevent-interface.tentative-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invokeevent-interface.tentative-expected.txt @@ -1,42 +1,25 @@ -FAIL command is a readonly defaulting to '' Can't find variable: CommandEvent -FAIL invoker is readonly defaulting to null Can't find variable: CommandEvent -FAIL command reflects initialized attribute Can't find variable: CommandEvent -FAIL command set to undefined Can't find variable: CommandEvent -FAIL command set to null Can't find variable: CommandEvent -FAIL command set to false Can't find variable: CommandEvent -FAIL command explicitly set to empty string Can't find variable: CommandEvent -FAIL command set to true Can't find variable: CommandEvent -FAIL command set to a number Can't find variable: CommandEvent -FAIL command set to [] Can't find variable: CommandEvent -FAIL command set to [1, 2, 3] Can't find variable: CommandEvent -FAIL command set to an object Can't find variable: CommandEvent -FAIL command set to an object with a toString function Can't find variable: CommandEvent -FAIL CommandEventInit properties set value Can't find variable: CommandEvent -FAIL CommandEventInit properties set value 2 Can't find variable: CommandEvent -FAIL CommandEventInit properties set value 3 Can't find variable: CommandEvent -FAIL invoker set to undefined Can't find variable: CommandEvent -FAIL invoker set to null Can't find variable: CommandEvent -FAIL invoker set to false assert_throws_js: invoker is not an object function "function () { - new CommandEvent("test", { invoker: false }); - }" threw object "ReferenceError: Can't find variable: CommandEvent" ("ReferenceError") expected instance of function "function TypeError() { - [native code] -}" ("TypeError") -FAIL invoker set to true assert_throws_js: invoker is not an object function "function () { - const event = new CommandEvent("test", { invoker: true }); - }" threw object "ReferenceError: Can't find variable: CommandEvent" ("ReferenceError") expected instance of function "function TypeError() { - [native code] -}" ("TypeError") -FAIL invoker set to {} assert_throws_js: invoker is not an object function "function () { - const event = new CommandEvent("test", { invoker: {} }); - }" threw object "ReferenceError: Can't find variable: CommandEvent" ("ReferenceError") expected instance of function "function TypeError() { - [native code] -}" ("TypeError") -FAIL invoker set to non-Element EventTarget assert_throws_js: invoker is not an Element function "function () { - const eventInit = { command: "closed", invoker: new XMLHttpRequest() }; - const event = new CommandEvent("toggle", eventInit); - }" threw object "ReferenceError: Can't find variable: CommandEvent" ("ReferenceError") expected instance of function "function TypeError() { - [native code] -}" ("TypeError") +PASS command is a readonly defaulting to '' +PASS invoker is readonly defaulting to null +PASS command reflects initialized attribute +PASS command set to undefined +PASS command set to null +PASS command set to false +PASS command explicitly set to empty string +PASS command set to true +PASS command set to a number +PASS command set to [] +PASS command set to [1, 2, 3] +PASS command set to an object +PASS command set to an object with a toString function +PASS CommandEventInit properties set value +PASS CommandEventInit properties set value 2 +PASS CommandEventInit properties set value 3 +PASS invoker set to undefined +PASS invoker set to null +PASS invoker set to false +PASS invoker set to true +PASS invoker set to {} +PASS invoker set to non-Element EventTarget diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-button-event-dispatch.tentative-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-button-event-dispatch.tentative-expected.txt index ee08f96a626c1..bd38cf92e3eaf 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-button-event-dispatch.tentative-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-button-event-dispatch.tentative-expected.txt @@ -1,22 +1,22 @@ -FAIL event dispatches on click promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent" -FAIL setting custom command property to -foo (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent" -FAIL setting custom command attribute to -foo (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent" -FAIL setting custom command property to foo- (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent" -FAIL setting custom command attribute to foo- (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent" -FAIL setting custom command property to cAsE-cArRiEs (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent" -FAIL setting custom command attribute to cAsE-cArRiEs (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent" -FAIL setting custom command property to - (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent" -FAIL setting custom command attribute to - (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent" -FAIL setting custom command property to -a- (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent" -FAIL setting custom command attribute to -a- (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent" -FAIL setting custom command property to a-b (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent" -FAIL setting custom command attribute to a-b (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent" -FAIL setting custom command property to --- (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent" -FAIL setting custom command attribute to --- (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent" -FAIL setting custom command property to show-picker (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent" -FAIL setting custom command attribute to show-picker (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent" +PASS event dispatches on click +PASS setting custom command property to -foo (must include dash) sets event command +PASS setting custom command attribute to -foo (must include dash) sets event command +PASS setting custom command property to foo- (must include dash) sets event command +PASS setting custom command attribute to foo- (must include dash) sets event command +PASS setting custom command property to cAsE-cArRiEs (must include dash) sets event command +PASS setting custom command attribute to cAsE-cArRiEs (must include dash) sets event command +PASS setting custom command property to - (must include dash) sets event command +PASS setting custom command attribute to - (must include dash) sets event command +PASS setting custom command property to -a- (must include dash) sets event command +PASS setting custom command attribute to -a- (must include dash) sets event command +PASS setting custom command property to a-b (must include dash) sets event command +PASS setting custom command attribute to a-b (must include dash) sets event command +PASS setting custom command property to --- (must include dash) sets event command +PASS setting custom command attribute to --- (must include dash) sets event command +PASS setting custom command property to show-picker (must include dash) sets event command +PASS setting custom command attribute to show-picker (must include dash) sets event command PASS setting custom command property to foo (no dash) did not dispatch an event PASS setting custom command attribute to foo (no dash) did not dispatch an event PASS setting custom command property to foobar (no dash) did not dispatch an event @@ -30,6 +30,6 @@ PASS setting custom command attribute to hidedocument (no dash) did not dispatch PASS event does not dispatch if click:preventDefault is called PASS event does not dispatch if invoker is disabled PASS event does not dispatch if invoker is form associated without `type` -FAIL event dispatches if invoker is form associated with `type=button` assert_true: event was not called expected true got false -FAIL event dispatches if invokee is non-HTML Element assert_equals: expected (object) Element node but got (undefined) undefined +PASS event dispatches if invoker is form associated with `type=button` +PASS event dispatches if invokee is non-HTML Element diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative-expected.txt index 6d949a182d4ff..4acdeea11beba 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative-expected.txt @@ -1,40 +1,40 @@ -FAIL invoking (with command property as showmodal) closed dialog opens as modal assert_true: invokee.open expected true got false +PASS invoking (with command property as showmodal) closed dialog opens as modal PASS invoking (with command property as showmodal) closed dialog with preventDefault is noop -FAIL invoking (with command property as showmodal) while changing command still opens as modal assert_true: invokee.open expected true got false -FAIL invoking (with command attribute as showmodal) closed dialog opens as modal assert_true: invokee.open expected true got false +PASS invoking (with command property as showmodal) while changing command still opens as modal +PASS invoking (with command attribute as showmodal) closed dialog opens as modal PASS invoking (with command attribute as showmodal) closed dialog with preventDefault is noop -FAIL invoking (with command attribute as showmodal) while changing command still opens as modal assert_true: invokee.open expected true got false -FAIL invoking (with command property as sHoWmOdAl) closed dialog opens as modal assert_true: invokee.open expected true got false +PASS invoking (with command attribute as showmodal) while changing command still opens as modal +PASS invoking (with command property as sHoWmOdAl) closed dialog opens as modal PASS invoking (with command property as sHoWmOdAl) closed dialog with preventDefault is noop -FAIL invoking (with command property as sHoWmOdAl) while changing command still opens as modal assert_true: invokee.open expected true got false -FAIL invoking (with command attribute as sHoWmOdAl) closed dialog opens as modal assert_true: invokee.open expected true got false +PASS invoking (with command property as sHoWmOdAl) while changing command still opens as modal +PASS invoking (with command attribute as sHoWmOdAl) closed dialog opens as modal PASS invoking (with command attribute as sHoWmOdAl) closed dialog with preventDefault is noop -FAIL invoking (with command attribute as sHoWmOdAl) while changing command still opens as modal assert_true: invokee.open expected true got false -FAIL invoking to close (with command property as close) open dialog closes assert_false: invokee.open expected false got true +PASS invoking (with command attribute as sHoWmOdAl) while changing command still opens as modal +PASS invoking to close (with command property as close) open dialog closes PASS invoking to close (with command property as close) open dialog with preventDefault is no-op PASS invoking to close (with command property as close) open modal dialog with preventDefault is no-op -FAIL invoking to close (with command property as close) open dialog while changing command still closes assert_false: invokee.open expected false got true -FAIL invoking to close (with command property as close) open modal dialog while changing command still closes assert_false: invokee.open expected false got true -FAIL invoking to close (with command attribute as close) open dialog closes assert_false: invokee.open expected false got true +PASS invoking to close (with command property as close) open dialog while changing command still closes +PASS invoking to close (with command property as close) open modal dialog while changing command still closes +PASS invoking to close (with command attribute as close) open dialog closes PASS invoking to close (with command attribute as close) open dialog with preventDefault is no-op PASS invoking to close (with command attribute as close) open modal dialog with preventDefault is no-op -FAIL invoking to close (with command attribute as close) open dialog while changing command still closes assert_false: invokee.open expected false got true -FAIL invoking to close (with command attribute as close) open modal dialog while changing command still closes assert_false: invokee.open expected false got true -FAIL invoking to close (with command property as cLoSe) open dialog closes assert_false: invokee.open expected false got true +PASS invoking to close (with command attribute as close) open dialog while changing command still closes +PASS invoking to close (with command attribute as close) open modal dialog while changing command still closes +PASS invoking to close (with command property as cLoSe) open dialog closes PASS invoking to close (with command property as cLoSe) open dialog with preventDefault is no-op PASS invoking to close (with command property as cLoSe) open modal dialog with preventDefault is no-op -FAIL invoking to close (with command property as cLoSe) open dialog while changing command still closes assert_false: invokee.open expected false got true -FAIL invoking to close (with command property as cLoSe) open modal dialog while changing command still closes assert_false: invokee.open expected false got true -FAIL invoking to close (with command attribute as cLoSe) open dialog closes assert_false: invokee.open expected false got true +PASS invoking to close (with command property as cLoSe) open dialog while changing command still closes +PASS invoking to close (with command property as cLoSe) open modal dialog while changing command still closes +PASS invoking to close (with command attribute as cLoSe) open dialog closes PASS invoking to close (with command attribute as cLoSe) open dialog with preventDefault is no-op PASS invoking to close (with command attribute as cLoSe) open modal dialog with preventDefault is no-op -FAIL invoking to close (with command attribute as cLoSe) open dialog while changing command still closes assert_false: invokee.open expected false got true -FAIL invoking to close (with command attribute as cLoSe) open modal dialog while changing command still closes assert_false: invokee.open expected false got true +PASS invoking to close (with command attribute as cLoSe) open dialog while changing command still closes +PASS invoking to close (with command attribute as cLoSe) open modal dialog while changing command still closes PASS invoking (as showmodal) open dialog is noop PASS invoking (as showmodal) open modal, while changing command still a no-op -FAIL invoking (as showmodal) closed popover dialog opens as modal assert_true: invokee.open expected true got false +PASS invoking (as showmodal) closed popover dialog opens as modal PASS invoking (as close) already closed dialog is noop PASS invoking (as showmodal) dialog as open popover=manual is noop PASS invoking (as showmodal) dialog as open popover=auto is noop diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-popover-behavior.tentative-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-popover-behavior.tentative-expected.txt index ef5835570073f..d6131a9cb8957 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-popover-behavior.tentative-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-popover-behavior.tentative-expected.txt @@ -1,30 +1,30 @@ -FAIL changing command attribute inside invokeevent doesn't impact the invocation assert_true: expected true got false -FAIL invoking (as togglepopover) closed popover opens assert_true: expected true got false +PASS changing command attribute inside invokeevent doesn't impact the invocation +PASS invoking (as togglepopover) closed popover opens PASS invoking (as togglepopover) closed popover with preventDefault does not open -FAIL invoking (as showpopover) closed popover opens assert_true: expected true got false +PASS invoking (as showpopover) closed popover opens PASS invoking (as showpopover) closed popover with preventDefault does not open -FAIL invoking (as tOgGlEpOpOvEr) closed popover opens assert_true: expected true got false +PASS invoking (as tOgGlEpOpOvEr) closed popover opens PASS invoking (as tOgGlEpOpOvEr) closed popover with preventDefault does not open -FAIL invoking (as sHoWpOpOvEr) closed popover opens assert_true: expected true got false +PASS invoking (as sHoWpOpOvEr) closed popover opens PASS invoking (as sHoWpOpOvEr) closed popover with preventDefault does not open PASS invoking (as togglepopover) open popover closes -FAIL invoking (as togglepopover) open popover with preventDefault does not close assert_true: expected true got false -FAIL invoking (as togglepopover) from within open popover closes assert_false: expected false got true +PASS invoking (as togglepopover) open popover with preventDefault does not close +PASS invoking (as togglepopover) from within open popover closes PASS invoking (as togglepopover) from within open popover with preventDefault does not close PASS invoking (as hidepopover) open popover closes -FAIL invoking (as hidepopover) open popover with preventDefault does not close assert_true: expected true got false -FAIL invoking (as hidepopover) from within open popover closes assert_false: expected false got true +PASS invoking (as hidepopover) open popover with preventDefault does not close +PASS invoking (as hidepopover) from within open popover closes PASS invoking (as hidepopover) from within open popover with preventDefault does not close PASS invoking (as tOgGlEpOpOvEr) open popover closes -FAIL invoking (as tOgGlEpOpOvEr) open popover with preventDefault does not close assert_true: expected true got false -FAIL invoking (as tOgGlEpOpOvEr) from within open popover closes assert_false: expected false got true +PASS invoking (as tOgGlEpOpOvEr) open popover with preventDefault does not close +PASS invoking (as tOgGlEpOpOvEr) from within open popover closes PASS invoking (as tOgGlEpOpOvEr) from within open popover with preventDefault does not close PASS invoking (as hIdEpOpOvEr) open popover closes -FAIL invoking (as hIdEpOpOvEr) open popover with preventDefault does not close assert_true: expected true got false -FAIL invoking (as hIdEpOpOvEr) from within open popover closes assert_false: expected false got true +PASS invoking (as hIdEpOpOvEr) open popover with preventDefault does not close +PASS invoking (as hIdEpOpOvEr) from within open popover closes PASS invoking (as hIdEpOpOvEr) from within open popover with preventDefault does not close -FAIL invoking (as showpopover) open popover is noop assert_true: expected true got false +PASS invoking (as showpopover) open popover is noop PASS invoking (as hidepopover) closed popover is noop diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-popover-invalid-behavior.tentative-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-popover-invalid-behavior.tentative-expected.txt index 310dd53686b33..5260f02108964 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-popover-invalid-behavior.tentative-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-popover-invalid-behavior.tentative-expected.txt @@ -1,17 +1,17 @@ PASS invoking (as null) on popover does nothing -FAIL invoking (as null) on open popover does nothing assert_true: expected true got false +PASS invoking (as null) on open popover does nothing PASS invoking (as ) on popover does nothing -FAIL invoking (as ) on open popover does nothing assert_true: expected true got false +PASS invoking (as ) on open popover does nothing PASS invoking (as foo-bar) on popover does nothing -FAIL invoking (as foo-bar) on open popover does nothing assert_true: expected true got false +PASS invoking (as foo-bar) on open popover does nothing PASS invoking (as showmodal) on popover does nothing -FAIL invoking (as showmodal) on open popover does nothing assert_true: expected true got false +PASS invoking (as showmodal) on open popover does nothing PASS invoking (as showpicker) on popover does nothing -FAIL invoking (as showpicker) on open popover does nothing assert_true: expected true got false +PASS invoking (as showpicker) on open popover does nothing PASS invoking (as open) on popover does nothing -FAIL invoking (as open) on open popover does nothing assert_true: expected true got false +PASS invoking (as open) on open popover does nothing PASS invoking (as close) on popover does nothing -FAIL invoking (as close) on open popover does nothing assert_true: expected true got false +PASS invoking (as close) on open popover does nothing diff --git a/LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative-expected.txt b/LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative-expected.txt new file mode 100644 index 0000000000000..6d949a182d4ff --- /dev/null +++ b/LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative-expected.txt @@ -0,0 +1,49 @@ + + +FAIL invoking (with command property as showmodal) closed dialog opens as modal assert_true: invokee.open expected true got false +PASS invoking (with command property as showmodal) closed dialog with preventDefault is noop +FAIL invoking (with command property as showmodal) while changing command still opens as modal assert_true: invokee.open expected true got false +FAIL invoking (with command attribute as showmodal) closed dialog opens as modal assert_true: invokee.open expected true got false +PASS invoking (with command attribute as showmodal) closed dialog with preventDefault is noop +FAIL invoking (with command attribute as showmodal) while changing command still opens as modal assert_true: invokee.open expected true got false +FAIL invoking (with command property as sHoWmOdAl) closed dialog opens as modal assert_true: invokee.open expected true got false +PASS invoking (with command property as sHoWmOdAl) closed dialog with preventDefault is noop +FAIL invoking (with command property as sHoWmOdAl) while changing command still opens as modal assert_true: invokee.open expected true got false +FAIL invoking (with command attribute as sHoWmOdAl) closed dialog opens as modal assert_true: invokee.open expected true got false +PASS invoking (with command attribute as sHoWmOdAl) closed dialog with preventDefault is noop +FAIL invoking (with command attribute as sHoWmOdAl) while changing command still opens as modal assert_true: invokee.open expected true got false +FAIL invoking to close (with command property as close) open dialog closes assert_false: invokee.open expected false got true +PASS invoking to close (with command property as close) open dialog with preventDefault is no-op +PASS invoking to close (with command property as close) open modal dialog with preventDefault is no-op +FAIL invoking to close (with command property as close) open dialog while changing command still closes assert_false: invokee.open expected false got true +FAIL invoking to close (with command property as close) open modal dialog while changing command still closes assert_false: invokee.open expected false got true +FAIL invoking to close (with command attribute as close) open dialog closes assert_false: invokee.open expected false got true +PASS invoking to close (with command attribute as close) open dialog with preventDefault is no-op +PASS invoking to close (with command attribute as close) open modal dialog with preventDefault is no-op +FAIL invoking to close (with command attribute as close) open dialog while changing command still closes assert_false: invokee.open expected false got true +FAIL invoking to close (with command attribute as close) open modal dialog while changing command still closes assert_false: invokee.open expected false got true +FAIL invoking to close (with command property as cLoSe) open dialog closes assert_false: invokee.open expected false got true +PASS invoking to close (with command property as cLoSe) open dialog with preventDefault is no-op +PASS invoking to close (with command property as cLoSe) open modal dialog with preventDefault is no-op +FAIL invoking to close (with command property as cLoSe) open dialog while changing command still closes assert_false: invokee.open expected false got true +FAIL invoking to close (with command property as cLoSe) open modal dialog while changing command still closes assert_false: invokee.open expected false got true +FAIL invoking to close (with command attribute as cLoSe) open dialog closes assert_false: invokee.open expected false got true +PASS invoking to close (with command attribute as cLoSe) open dialog with preventDefault is no-op +PASS invoking to close (with command attribute as cLoSe) open modal dialog with preventDefault is no-op +FAIL invoking to close (with command attribute as cLoSe) open dialog while changing command still closes assert_false: invokee.open expected false got true +FAIL invoking to close (with command attribute as cLoSe) open modal dialog while changing command still closes assert_false: invokee.open expected false got true +PASS invoking (as showmodal) open dialog is noop +PASS invoking (as showmodal) open modal, while changing command still a no-op +FAIL invoking (as showmodal) closed popover dialog opens as modal assert_true: invokee.open expected true got false +PASS invoking (as close) already closed dialog is noop +PASS invoking (as showmodal) dialog as open popover=manual is noop +PASS invoking (as showmodal) dialog as open popover=auto is noop +PASS invoking (as close) dialog as open popover=manual is noop +PASS invoking (as close) dialog as open popover=auto is noop +PASS invoking (as showmodal) dialog that is removed is noop +PASS invoking (as showmodal) dialog from a detached invoker +PASS invoking (as showmodal) detached dialog from a detached invoker +PASS invoking (as close) dialog that is removed is noop +PASS invoking (as close) dialog from a detached invoker +PASS invoking (as close) detached dialog from a detached invoker + diff --git a/Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml b/Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml index cb6e4ca4c7ee0..c797cab8b8092 100644 --- a/Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml +++ b/Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml @@ -3419,8 +3419,8 @@ InvokerAttributesEnabled: type: bool status: testable category: html - humanReadableName: "HTML invoketarget & invokeaction attributes" - humanReadableDescription: "Enable HTML invoketarget & invokeaction attribute support" + humanReadableName: "HTML command & commandfor attributes" + humanReadableDescription: "Enable HTML command & commandfor attribute support" defaultValue: WebKitLegacy: default: false diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index 96d9e85c1fa31..b449f5e21a641 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -1027,6 +1027,7 @@ set(WebCore_NON_SVG_IDL_FILES dom/CheckVisibilityOptions.idl dom/ChildNode.idl dom/ClipboardEvent.idl + dom/CommandEvent.idl dom/Comment.idl dom/CompositionEvent.idl dom/ContentVisibilityAutoStateChangeEvent.idl @@ -1103,7 +1104,6 @@ set(WebCore_NON_SVG_IDL_FILES dom/IdleRequestOptions.idl dom/InnerHTML.idl dom/InputEvent.idl - dom/InvokeEvent.idl dom/KeyboardEvent.idl dom/MessageChannel.idl dom/MessageEvent.idl diff --git a/Source/WebCore/DerivedSources-input.xcfilelist b/Source/WebCore/DerivedSources-input.xcfilelist index bc1ea39121f61..75705517d83f4 100644 --- a/Source/WebCore/DerivedSources-input.xcfilelist +++ b/Source/WebCore/DerivedSources-input.xcfilelist @@ -1333,6 +1333,7 @@ $(PROJECT_DIR)/dom/CharacterData.idl $(PROJECT_DIR)/dom/CheckVisibilityOptions.idl $(PROJECT_DIR)/dom/ChildNode.idl $(PROJECT_DIR)/dom/ClipboardEvent.idl +$(PROJECT_DIR)/dom/CommandEvent.idl $(PROJECT_DIR)/dom/Comment.idl $(PROJECT_DIR)/dom/CompositionEvent.idl $(PROJECT_DIR)/dom/ContentVisibilityAutoStateChangeEvent.idl @@ -1414,7 +1415,6 @@ $(PROJECT_DIR)/dom/IdleRequestCallback.idl $(PROJECT_DIR)/dom/IdleRequestOptions.idl $(PROJECT_DIR)/dom/InnerHTML.idl $(PROJECT_DIR)/dom/InputEvent.idl -$(PROJECT_DIR)/dom/InvokeEvent.idl $(PROJECT_DIR)/dom/KeyboardEvent.idl $(PROJECT_DIR)/dom/MessageChannel.idl $(PROJECT_DIR)/dom/MessageEvent.idl diff --git a/Source/WebCore/DerivedSources-output.xcfilelist b/Source/WebCore/DerivedSources-output.xcfilelist index 9a1436d49b96b..ab3d131eceed7 100644 --- a/Source/WebCore/DerivedSources-output.xcfilelist +++ b/Source/WebCore/DerivedSources-output.xcfilelist @@ -593,6 +593,8 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCloseEvent.cpp $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCloseEvent.h $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSColorGamut.cpp $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSColorGamut.h +$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCommandEvent.cpp +$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCommandEvent.h $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCommandLineAPIHost.cpp $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCommandLineAPIHost.h $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSComment.cpp @@ -1717,8 +1719,6 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSIntersectionObserverCallback.cpp $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSIntersectionObserverCallback.h $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSIntersectionObserverEntry.cpp $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSIntersectionObserverEntry.h -$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInvokeEvent.cpp -$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInvokeEvent.h $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInvokerElement.cpp $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInvokerElement.h $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSIsLoggedIn.cpp diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make index f4f3d8c3111fb..971215c6146e1 100644 --- a/Source/WebCore/DerivedSources.make +++ b/Source/WebCore/DerivedSources.make @@ -1033,7 +1033,9 @@ JS_BINDING_IDLS := \ $(WebCore)/dom/CheckVisibilityOptions.idl \ $(WebCore)/dom/ChildNode.idl \ $(WebCore)/dom/ClipboardEvent.idl \ + $(WebCore)/dom/CommandEvent.idl \ $(WebCore)/dom/Comment.idl \ + $(WebCore)/dom/CommandEvent.idl \ $(WebCore)/dom/CompositionEvent.idl \ $(WebCore)/dom/ContentVisibilityAutoStateChangeEvent.idl \ $(WebCore)/dom/CreateHTMLCallback.idl \ @@ -1109,7 +1111,6 @@ JS_BINDING_IDLS := \ $(WebCore)/dom/IdleRequestOptions.idl \ $(WebCore)/dom/InnerHTML.idl \ $(WebCore)/dom/InputEvent.idl \ - $(WebCore)/dom/InvokeEvent.idl \ $(WebCore)/dom/KeyboardEvent.idl \ $(WebCore)/dom/MessageChannel.idl \ $(WebCore)/dom/MessageEvent.idl \ diff --git a/Source/WebCore/Headers.cmake b/Source/WebCore/Headers.cmake index 83b95fb915d06..1f8657db050cc 100644 --- a/Source/WebCore/Headers.cmake +++ b/Source/WebCore/Headers.cmake @@ -933,6 +933,7 @@ set(WebCore_PRIVATE_FRAMEWORK_HEADERS dom/CheckVisibilityOptions.h dom/CollectionIndexCache.h dom/CollectionIndexCacheInlines.h + dom/CommandEvent.h dom/Comment.h dom/ContainerNode.h dom/ContextDestructionObserver.h @@ -1001,7 +1002,6 @@ set(WebCore_PRIVATE_FRAMEWORK_HEADERS dom/GetHTMLOptions.h dom/ImageOverlay.h dom/InlineStyleSheetOwner.h - dom/InvokeEvent.h dom/KeyboardEvent.h dom/LiveNodeList.h dom/LiveNodeListInlines.h diff --git a/Source/WebCore/SmartPointerExpectations/UncountedLocalVarsCheckerExpectations b/Source/WebCore/SmartPointerExpectations/UncountedLocalVarsCheckerExpectations index 5500a3e274b12..52fd996ef3779 100644 --- a/Source/WebCore/SmartPointerExpectations/UncountedLocalVarsCheckerExpectations +++ b/Source/WebCore/SmartPointerExpectations/UncountedLocalVarsCheckerExpectations @@ -739,6 +739,7 @@ dom/ActiveDOMObject.cpp dom/BroadcastChannel.cpp dom/CollectionIndexCache.cpp dom/CollectionIndexCacheInlines.h +dom/CommandEvent.cpp dom/ComposedTreeAncestorIterator.h dom/ComposedTreeIterator.cpp dom/ComposedTreeIterator.h @@ -766,7 +767,6 @@ dom/FragmentDirectiveRangeFinder.cpp dom/FullscreenManager.cpp dom/ImageOverlay.cpp dom/InlineStyleSheetOwner.cpp -dom/InvokeEvent.cpp dom/KeyboardEvent.cpp dom/MessageEvent.cpp dom/MessagePort.cpp diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt index cae20040f706d..2568775261e89 100644 --- a/Source/WebCore/Sources.txt +++ b/Source/WebCore/Sources.txt @@ -1100,6 +1100,7 @@ dom/ChildNodeList.cpp dom/ClassCollection.cpp dom/ClipboardEvent.cpp dom/CollectionIndexCache.cpp +dom/CommandEvent.cpp dom/Comment.cpp dom/ComposedTreeIterator.cpp dom/CompositionEvent.cpp @@ -1175,7 +1176,6 @@ dom/ImageOverlay.cpp dom/InlineClassicScript.cpp dom/InlineStyleSheetOwner.cpp dom/InputEvent.cpp -dom/InvokeEvent.cpp dom/InternalObserver.cpp dom/InternalObserverFromScript.cpp dom/KeyboardEvent.cpp @@ -3438,6 +3438,7 @@ JSClipboardEvent.cpp JSClipboardItem.cpp JSCloseEvent.cpp JSColorGamut.cpp +JSCommandEvent.cpp JSCommandLineAPIHost.cpp JSComment.cpp JSCompositeOperation.cpp @@ -3924,7 +3925,6 @@ JSIntersectionObserver.cpp JSIntersectionObserverCallback.cpp JSIntersectionObserverEntry.cpp JSIterationCompositeOperation.cpp -JSInvokeEvent.cpp JSIsLoggedIn.cpp JSJsonWebKey.cpp JSKeyboardEvent.cpp diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index 8a4bef606165b..64c9a55db2601 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -10879,11 +10879,11 @@ 49B53D412B1AA58A0056A172 /* RenderTreeUpdaterViewTransition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeUpdaterViewTransition.cpp; sourceTree = ""; }; 49BB8233299A53ED009143CB /* PopoverData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PopoverData.h; sourceTree = ""; }; 49C66C4B299C294B00073276 /* ToggleEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ToggleEvent.cpp; sourceTree = ""; }; - 49C66C4B299C294B00073279 /* InvokeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InvokeEvent.cpp; sourceTree = ""; }; + 49C66C4B299C294B00073279 /* CommandEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CommandEvent.cpp; sourceTree = ""; }; 49C66C4C299C294B00073276 /* ToggleEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ToggleEvent.idl; sourceTree = ""; }; - 49C66C4C299C294B00073279 /* InvokeEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = InvokeEvent.idl; sourceTree = ""; }; + 49C66C4C299C294B00073279 /* CommandEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CommandEvent.idl; sourceTree = ""; }; 49C66C4D299C294C00073276 /* ToggleEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ToggleEvent.h; sourceTree = ""; }; - 49C66C4D299C294C00073279 /* InvokeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InvokeEvent.h; sourceTree = ""; }; + 49C66C4D299C294C00073279 /* CommandEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommandEvent.h; sourceTree = ""; }; 49C7B9801042D2D30009D447 /* JSWebGLBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLBuffer.cpp; sourceTree = ""; }; 49C7B9811042D2D30009D447 /* JSWebGLBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLBuffer.h; sourceTree = ""; }; 49C7B9841042D2D30009D447 /* JSWebGLFramebuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLFramebuffer.cpp; sourceTree = ""; }; @@ -36720,6 +36720,9 @@ 9BD8A95918BEFC7600987E9A /* CollectionIndexCache.cpp */, E425A49918292B840020CFCF /* CollectionIndexCache.h */, CD814C3A2996D870005A780A /* CollectionIndexCacheInlines.h */, + 49C66C4B299C294B00073279 /* CommandEvent.cpp */, + 49C66C4D299C294C00073279 /* CommandEvent.h */, + 49C66C4C299C294B00073279 /* CommandEvent.idl */, 6550B697099DF0270090D781 /* Comment.cpp */, 6550B698099DF0270090D781 /* Comment.h */, 85089CC70A98C22600A275AA /* Comment.idl */, @@ -37007,9 +37010,6 @@ FFEFAB2D183BCC6F00514554 /* InternalObserver.h */, FFEFAB2D183BCC6F00514557 /* InternalObserverFromScript.cpp */, FFEFAB2D183BCC6F00514556 /* InternalObserverFromScript.h */, - 49C66C4B299C294B00073279 /* InvokeEvent.cpp */, - 49C66C4D299C294C00073279 /* InvokeEvent.h */, - 49C66C4C299C294B00073279 /* InvokeEvent.idl */, FFEFAB2D183BCC6F00514553 /* JSSubscriberCustom.cpp */, 85031B2D0A44EFC700F992E0 /* KeyboardEvent.cpp */, 85031B2E0A44EFC700F992E0 /* KeyboardEvent.h */, diff --git a/Source/WebCore/bindings/js/WebCoreBuiltinNames.h b/Source/WebCore/bindings/js/WebCoreBuiltinNames.h index bec74918c24d1..73f191045499c 100644 --- a/Source/WebCore/bindings/js/WebCoreBuiltinNames.h +++ b/Source/WebCore/bindings/js/WebCoreBuiltinNames.h @@ -168,6 +168,7 @@ namespace WebCore { macro(CSSUnitValue) \ macro(CSSUnparsedValue) \ macro(CSSVariableReferenceValue) \ + macro(CommandEvent) \ macro(CookieChangeEvent) \ macro(CookieStore) \ macro(CookieStoreManager) \ @@ -280,7 +281,6 @@ namespace WebCore { macro(InputEvent) \ macro(IntersectionObserver) \ macro(IntersectionObserverEntry) \ - macro(InvokeEvent) \ macro(KeyframeEffect) \ macro(Lock) \ macro(LockManager) \ diff --git a/Source/WebCore/dom/InvokeEvent.cpp b/Source/WebCore/dom/CommandEvent.cpp similarity index 71% rename from Source/WebCore/dom/InvokeEvent.cpp rename to Source/WebCore/dom/CommandEvent.cpp index 4fb0d83f3b0a8..ad9ec4a5edebc 100644 --- a/Source/WebCore/dom/InvokeEvent.cpp +++ b/Source/WebCore/dom/CommandEvent.cpp @@ -24,7 +24,7 @@ */ #include "config.h" -#include "InvokeEvent.h" +#include "CommandEvent.h" #include "Element.h" @@ -32,36 +32,36 @@ namespace WebCore { -WTF_MAKE_ISO_ALLOCATED_IMPL(InvokeEvent); +WTF_MAKE_ISO_ALLOCATED_IMPL(CommandEvent); -InvokeEvent::InvokeEvent() - : Event(EventInterfaceType::InvokeEvent) +CommandEvent::CommandEvent() + : Event(EventInterfaceType::CommandEvent) { } -InvokeEvent::InvokeEvent(const AtomString& type, const InvokeEvent::Init& initializer, IsTrusted isTrusted) - : Event(EventInterfaceType::InvokeEvent, type, initializer, isTrusted) +CommandEvent::CommandEvent(const AtomString& type, const CommandEvent::Init& initializer, IsTrusted isTrusted) + : Event(EventInterfaceType::CommandEvent, type, initializer, isTrusted) , m_invoker(initializer.invoker) - , m_action(initializer.action) + , m_command(initializer.command) { } -Ref InvokeEvent::create(const AtomString& eventType, const InvokeEvent::Init& init, IsTrusted isTrusted) +Ref CommandEvent::create(const AtomString& eventType, const CommandEvent::Init& init, IsTrusted isTrusted) { - return adoptRef(*new InvokeEvent(eventType, init, isTrusted)); + return adoptRef(*new CommandEvent(eventType, init, isTrusted)); } -Ref InvokeEvent::createForBindings() +Ref CommandEvent::createForBindings() { - return adoptRef(*new InvokeEvent); + return adoptRef(*new CommandEvent); } -bool InvokeEvent::isInvokeEvent() const +bool CommandEvent::isCommandEvent() const { return true; } -RefPtr InvokeEvent::invoker() const +RefPtr CommandEvent::invoker() const { auto* invoker = m_invoker.get(); if (!invoker) diff --git a/Source/WebCore/dom/InvokeEvent.h b/Source/WebCore/dom/CommandEvent.h similarity index 73% rename from Source/WebCore/dom/InvokeEvent.h rename to Source/WebCore/dom/CommandEvent.h index 2da8feba5727d..9f7c64b8c5f00 100644 --- a/Source/WebCore/dom/InvokeEvent.h +++ b/Source/WebCore/dom/CommandEvent.h @@ -34,34 +34,34 @@ namespace WebCore { class Element; class HTMLElement; -class InvokeEvent final : public Event { - WTF_MAKE_ISO_ALLOCATED(InvokeEvent); +class CommandEvent final : public Event { + WTF_MAKE_ISO_ALLOCATED(CommandEvent); public: struct Init : EventInit { RefPtr invoker; - String action; + String command; }; - static Ref create(const AtomString& type, const Init&, IsTrusted = IsTrusted::No); - static Ref createForBindings(); + static Ref create(const AtomString& type, const Init&, IsTrusted = IsTrusted::No); + static Ref createForBindings(); RefPtr invoker() const; - String action() const { return m_action; } + String command() const { return m_command; } private: - InvokeEvent(); - InvokeEvent(const AtomString& type, const Init&, IsTrusted = IsTrusted::No); + CommandEvent(); + CommandEvent(const AtomString& type, const Init&, IsTrusted = IsTrusted::No); - bool isInvokeEvent() const final; + bool isCommandEvent() const final; - void setInvoker(RefPtr&& invoker) { m_invoker = WTFMove(invoker); } + void setCommandr(RefPtr&& invoker) { m_invoker = WTFMove(invoker); } RefPtr m_invoker; - String m_action; + String m_command; }; } // namespace WebCore -SPECIALIZE_TYPE_TRAITS_EVENT(InvokeEvent) +SPECIALIZE_TYPE_TRAITS_EVENT(CommandEvent) diff --git a/Source/WebCore/dom/InvokeEvent.idl b/Source/WebCore/dom/CommandEvent.idl similarity index 86% rename from Source/WebCore/dom/InvokeEvent.idl rename to Source/WebCore/dom/CommandEvent.idl index dd960629400b7..d88303b548e9c 100644 --- a/Source/WebCore/dom/InvokeEvent.idl +++ b/Source/WebCore/dom/CommandEvent.idl @@ -26,14 +26,14 @@ [ EnabledBySetting=InvokerAttributesEnabled, Exposed=Window -] interface InvokeEvent : Event { - constructor([AtomString] DOMString type, optional InvokeEventInit eventInitDict); +] interface CommandEvent : Event { + constructor([AtomString] DOMString type, optional CommandEventInit eventInitDict); readonly attribute Element? invoker; - readonly attribute DOMString action; + readonly attribute DOMString command; }; -dictionary InvokeEventInit : EventInit { +dictionary CommandEventInit : EventInit { Element? invoker = null; - DOMString action = ""; + DOMString command = ""; }; diff --git a/Source/WebCore/dom/DeviceOrientationAndMotionAccessController.h b/Source/WebCore/dom/DeviceOrientationAndMotionAccessController.h index 65c301fd300f4..c3242724f5ea9 100644 --- a/Source/WebCore/dom/DeviceOrientationAndMotionAccessController.h +++ b/Source/WebCore/dom/DeviceOrientationAndMotionAccessController.h @@ -28,6 +28,7 @@ #if ENABLE(DEVICE_ORIENTATION) #include "DeviceOrientationOrMotionPermissionState.h" +#include "EventTarget.h" #include "ExceptionOr.h" #include "SecurityOriginData.h" #include diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index 55d478f00ef61..746963e0c3edb 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -9897,7 +9897,7 @@ void Document::handlePopoverLightDismiss(const PointerEvent& event, Node& target if (!invokerPopover) { if (RefPtr button = dynamicDowncast(*htmlElement)) { - if (RefPtr popover = dynamicDowncast(button->invokeTargetElement()); popover && isShowingAutoPopover(*popover)) + if (RefPtr popover = dynamicDowncast(button->commandForElement()); popover && isShowingAutoPopover(*popover)) invokerPopover = WTFMove(popover); else if (RefPtr popover = button->popoverTargetElement(); popover && isShowingAutoPopover(*popover)) invokerPopover = WTFMove(popover); diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp index 334d8e83443bc..e2a4733fb9df9 100644 --- a/Source/WebCore/dom/Element.cpp +++ b/Source/WebCore/dom/Element.cpp @@ -2143,7 +2143,7 @@ bool Element::isElementReflectionAttribute(const Settings& settings, const Quali { return name == HTMLNames::aria_activedescendantAttr || (settings.popoverAttributeEnabled() && name == HTMLNames::popovertargetAttr) - || (settings.invokerAttributesEnabled() && name == HTMLNames::invoketargetAttr); + || (settings.invokerAttributesEnabled() && name == HTMLNames::commandforAttr); } bool Element::isElementsArrayReflectionAttribute(const QualifiedName& name) diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h index 032166488713c..cab2d1aea706a 100644 --- a/Source/WebCore/dom/Element.h +++ b/Source/WebCore/dom/Element.h @@ -109,10 +109,9 @@ enum class ShadowRootSerializable : bool { No, Yes }; enum class VisibilityAdjustment : uint8_t; // https://github.com/whatwg/html/pull/9841 -enum class InvokeAction: uint8_t { +enum class CommandType: uint8_t { Invalid, - Auto, Custom, TogglePopover, @@ -655,8 +654,8 @@ class Element : public ContainerNode { void clearPopoverData(); bool isPopoverShowing() const; - virtual bool isValidInvokeAction(const InvokeAction action) { return action == InvokeAction::Auto; } - virtual bool handleInvokeInternal(const HTMLFormControlElement&, const InvokeAction&) { return false; } + virtual bool isValidCommandType(const CommandType) { return false; } + virtual bool handleCommandInternal(const HTMLFormControlElement&, const CommandType&) { return false; } ExceptionOr setPointerCapture(int32_t); ExceptionOr releasePointerCapture(int32_t); diff --git a/Source/WebCore/dom/Event.h b/Source/WebCore/dom/Event.h index c6b36211fcab5..adfa95dc2fd1f 100644 --- a/Source/WebCore/dom/Event.h +++ b/Source/WebCore/dom/Event.h @@ -107,11 +107,11 @@ class Event : public ScriptWrappable, public RefCounted { virtual bool isBeforeTextInsertedEvent() const { return false; } virtual bool isBeforeUnloadEvent() const { return false; } virtual bool isClipboardEvent() const { return false; } + virtual bool isCommandEvent() const { return false; } virtual bool isCompositionEvent() const { return false; } virtual bool isErrorEvent() const { return false; } virtual bool isFocusEvent() const { return false; } virtual bool isInputEvent() const { return false; } - virtual bool isInvokeEvent() const { return false; } virtual bool isKeyboardEvent() const { return false; } virtual bool isMouseEvent() const { return false; } virtual bool isPointerEvent() const { return false; } diff --git a/Source/WebCore/dom/EventInterfaces.in b/Source/WebCore/dom/EventInterfaces.in index 0b4bcfcc6e972..87480276ea25a 100644 --- a/Source/WebCore/dom/EventInterfaces.in +++ b/Source/WebCore/dom/EventInterfaces.in @@ -13,6 +13,7 @@ BeforeUnloadEvent BufferedChangeEvent conditional=MEDIA_SOURCE ClipboardEvent CloseEvent +CommandEvent CompositionEvent CookieChangeEvent CSSAnimationEvent @@ -29,7 +30,6 @@ FormDataEvent HashChangeEvent InputEvent InputEvents interfaceName=InputEvent -InvokeEvent KeyboardEvent KeyboardEvents interfaceName=KeyboardEvent MediaQueryListEvent diff --git a/Source/WebCore/dom/EventNames.json b/Source/WebCore/dom/EventNames.json index 3b1097e954f08..e99ae035ecf5c 100644 --- a/Source/WebCore/dom/EventNames.json +++ b/Source/WebCore/dom/EventNames.json @@ -53,6 +53,7 @@ "click": { "categories": ["MouseClickRelated"], "defaultEventHandler": true }, "close": { }, "closing": { }, + "command": { }, "complete": { }, "compositionend": { }, "compositionstart": { }, @@ -130,7 +131,6 @@ "inputsourceschange": { }, "install": { }, "invalid": { }, - "invoke": { }, "keydown": { "defaultEventHandler": true }, "keypress": { "defaultEventHandler": true }, "keystatuseschange": { }, diff --git a/Source/WebCore/html/HTMLAttributeNames.in b/Source/WebCore/html/HTMLAttributeNames.in index 8762d547d2bf2..61240668950f6 100644 --- a/Source/WebCore/html/HTMLAttributeNames.in +++ b/Source/WebCore/html/HTMLAttributeNames.in @@ -104,6 +104,8 @@ codetype color cols colspan +command +commandfor compact composite content @@ -163,8 +165,6 @@ inert inputmode integrity interactive -invokeaction -invoketarget is ismap keytype diff --git a/Source/WebCore/html/HTMLButtonElement.cpp b/Source/WebCore/html/HTMLButtonElement.cpp index 5c3831606794a..3f4463d1168b9 100644 --- a/Source/WebCore/html/HTMLButtonElement.cpp +++ b/Source/WebCore/html/HTMLButtonElement.cpp @@ -140,7 +140,13 @@ void HTMLButtonElement::defaultEventHandler(Event& event) if (event.type() == eventNames.DOMActivateEvent && !isDisabledFormControl()) { RefPtr protectedForm(form()); - if (protectedForm) { + if (commandForElement()) { + if (m_type != BUTTON && form()) + return; + + handleCommand(); + + } else if (protectedForm) { // Update layout before processing form actions in case the style changes // the Form or button relationships. protectedDocument()->updateLayoutIgnorePendingStylesheets(); @@ -155,8 +161,6 @@ void HTMLButtonElement::defaultEventHandler(Event& event) if (m_type == SUBMIT || m_type == RESET) event.setDefaultHandled(); - } else if (invokeTargetElement()) { - handleInvokeAction(); } else handlePopoverTargetAction(); } diff --git a/Source/WebCore/html/HTMLDialogElement.cpp b/Source/WebCore/html/HTMLDialogElement.cpp index ba39b08d06603..c151093057e3e 100644 --- a/Source/WebCore/html/HTMLDialogElement.cpp +++ b/Source/WebCore/html/HTMLDialogElement.cpp @@ -140,28 +140,26 @@ void HTMLDialogElement::close(const String& result) queueTaskToDispatchEvent(TaskSource::UserInteraction, Event::create(eventNames().closeEvent, Event::CanBubble::No, Event::IsCancelable::No)); } -bool HTMLDialogElement::isValidInvokeAction(const InvokeAction action) +bool HTMLDialogElement::isValidCommandType(const CommandType command) { - return HTMLElement::isValidInvokeAction(action) || action == InvokeAction::ShowModal || action == InvokeAction::Close; + return HTMLElement::isValidCommandType(command) || command == CommandType::ShowModal || command == CommandType::Close; } -bool HTMLDialogElement::handleInvokeInternal(const HTMLFormControlElement& invoker, const InvokeAction& action) +bool HTMLDialogElement::handleCommandInternal(const HTMLFormControlElement& invoker, const CommandType& command) { - if (HTMLElement::handleInvokeInternal(invoker, action)) + if (HTMLElement::handleCommandInternal(invoker, command)) return true; if (isPopoverShowing()) return false; if (isOpen()) { - auto shouldClose = action == InvokeAction::Auto || action == InvokeAction::Close; - if (shouldClose) { + if (command == CommandType::Close) { close(nullString()); return true; } } else { - auto shouldOpen = action == InvokeAction::Auto || action == InvokeAction::ShowModal; - if (shouldOpen) { + if (command == CommandType::ShowModal) { showModal(); return true; } diff --git a/Source/WebCore/html/HTMLDialogElement.h b/Source/WebCore/html/HTMLDialogElement.h index 3756ba6ea043c..41e2de2572f87 100644 --- a/Source/WebCore/html/HTMLDialogElement.h +++ b/Source/WebCore/html/HTMLDialogElement.h @@ -49,8 +49,8 @@ class HTMLDialogElement final : public HTMLElement { void runFocusingSteps(); - bool isValidInvokeAction(const InvokeAction) final; - bool handleInvokeInternal(const HTMLFormControlElement& invoker, const InvokeAction&) final; + bool isValidCommandType(const CommandType) final; + bool handleCommandInternal(const HTMLFormControlElement& invoker, const CommandType&) final; private: HTMLDialogElement(const QualifiedName&, Document&); diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp index 90bb1115e6221..7310d5531d1b0 100644 --- a/Source/WebCore/html/HTMLElement.cpp +++ b/Source/WebCore/html/HTMLElement.cpp @@ -1529,28 +1529,24 @@ void HTMLElement::popoverAttributeChanged(const AtomString& value) ensurePopoverData().setPopoverState(newPopoverState); } -bool HTMLElement::isValidInvokeAction(const InvokeAction action) +bool HTMLElement::isValidCommandType(const CommandType command) { - return Element::isValidInvokeAction(action) || action == InvokeAction::TogglePopover || action == InvokeAction::ShowPopover || action == InvokeAction::HidePopover; + return Element::isValidCommandType(command) || command == CommandType::TogglePopover || command == CommandType::ShowPopover || command == CommandType::HidePopover; } -bool HTMLElement::handleInvokeInternal(const HTMLFormControlElement& invoker, const InvokeAction& action) +bool HTMLElement::handleCommandInternal(const HTMLFormControlElement& invoker, const CommandType& command) { if (popoverState() == PopoverState::None) return false; if (isPopoverShowing()) { - bool shouldHide = action == InvokeAction::Auto - || action == InvokeAction::TogglePopover - || action == InvokeAction::HidePopover; + bool shouldHide = command == CommandType::TogglePopover || command == CommandType::HidePopover; if (shouldHide) { hidePopover(); return true; } } else { - bool shouldShow = action == InvokeAction::Auto - || action == InvokeAction::TogglePopover - || action == InvokeAction::ShowPopover; + bool shouldShow = command == CommandType::TogglePopover || command == CommandType::ShowPopover; if (shouldShow) { showPopover(&invoker); return true; diff --git a/Source/WebCore/html/HTMLElement.h b/Source/WebCore/html/HTMLElement.h index ce2f1bcc3aa67..66689c3ab1942 100644 --- a/Source/WebCore/html/HTMLElement.h +++ b/Source/WebCore/html/HTMLElement.h @@ -160,8 +160,8 @@ class HTMLElement : public StyledElement { void setPopover(const AtomString& value) { setAttributeWithoutSynchronization(HTMLNames::popoverAttr, value); }; void popoverAttributeChanged(const AtomString& value); - bool isValidInvokeAction(const InvokeAction) override; - bool handleInvokeInternal(const HTMLFormControlElement& invoker, const InvokeAction&) override; + bool isValidCommandType(const CommandType) override; + bool handleCommandInternal(const HTMLFormControlElement& invoker, const CommandType&) override; #if PLATFORM(IOS_FAMILY) static SelectionRenderingBehavior selectionRenderingBehavior(const Node*); diff --git a/Source/WebCore/html/HTMLFormControlElement.cpp b/Source/WebCore/html/HTMLFormControlElement.cpp index e36471d78fa4d..1a282f43a027b 100644 --- a/Source/WebCore/html/HTMLFormControlElement.cpp +++ b/Source/WebCore/html/HTMLFormControlElement.cpp @@ -27,6 +27,7 @@ #include "AXObjectCache.h" #include "Autofill.h" +#include "CommandEvent.h" #include "Document.h" #include "DocumentInlines.h" #include "ElementInlines.h" @@ -37,7 +38,6 @@ #include "HTMLButtonElement.h" #include "HTMLFormElement.h" #include "HTMLInputElement.h" -#include "InvokeEvent.h" #include "LocalFrame.h" #include "LocalFrameView.h" #include "PopoverData.h" @@ -410,7 +410,7 @@ void HTMLFormControlElement::handlePopoverTargetAction() const target->showPopover(this); } -RefPtr HTMLFormControlElement::invokeTargetElement() const +RefPtr HTMLFormControlElement::commandForElement() const { auto canInvoke = [](const HTMLFormControlElement& element) -> bool { if (!element.document().settings().invokerAttributesEnabled()) @@ -423,7 +423,7 @@ RefPtr HTMLFormControlElement::invokeTargetElement() const if (!canInvoke(*this)) return nullptr; - return getElementAttribute(invoketargetAttr); + return getElementAttribute(commandforAttr); } constexpr ASCIILiteral togglePopoverLiteral = "togglepopover"_s; @@ -431,61 +431,61 @@ constexpr ASCIILiteral showPopoverLiteral = "showpopover"_s; constexpr ASCIILiteral hidePopoverLiteral = "hidepopover"_s; constexpr ASCIILiteral showModalLiteral = "showmodal"_s; constexpr ASCIILiteral closeLiteral = "close"_s; -InvokeAction HTMLFormControlElement::invokeAction() const +CommandType HTMLFormControlElement::commandType() const { - auto action = attributeWithoutSynchronization(HTMLNames::invokeactionAttr); + auto action = attributeWithoutSynchronization(HTMLNames::commandAttr); if (action.isNull() || action.isEmpty()) - return InvokeAction::Auto; + return CommandType::Invalid; if (equalLettersIgnoringASCIICase(action, togglePopoverLiteral)) - return InvokeAction::TogglePopover; + return CommandType::TogglePopover; if (equalLettersIgnoringASCIICase(action, showPopoverLiteral)) - return InvokeAction::ShowPopover; + return CommandType::ShowPopover; if (equalLettersIgnoringASCIICase(action, hidePopoverLiteral)) - return InvokeAction::HidePopover; + return CommandType::HidePopover; if (equalLettersIgnoringASCIICase(action, showModalLiteral)) - return InvokeAction::ShowModal; + return CommandType::ShowModal; if (equalLettersIgnoringASCIICase(action, closeLiteral)) - return InvokeAction::Close; + return CommandType::Close; if (action.contains('-')) - return InvokeAction::Custom; + return CommandType::Custom; - return InvokeAction::Invalid; + return CommandType::Invalid; } -void HTMLFormControlElement::handleInvokeAction() +void HTMLFormControlElement::handleCommand() { - RefPtr invokee = invokeTargetElement(); + RefPtr invokee = commandForElement(); if (!invokee) return; - auto actionRaw = attributeWithoutSynchronization(HTMLNames::invokeactionAttr); - auto action = invokeAction(); + auto commandRaw = attributeWithoutSynchronization(HTMLNames::commandAttr); + auto command = commandType(); - if (action == InvokeAction::Invalid) + if (command == CommandType::Invalid) return; - if (action != InvokeAction::Custom && !invokee->isValidInvokeAction(action)) + if (command != CommandType::Custom && !invokee->isValidCommandType(command)) return; - InvokeEvent::Init init; + CommandEvent::Init init; init.bubbles = false; init.cancelable = true; init.composed = true; init.invoker = this; - init.action = actionRaw.isNull() ? emptyAtom() : actionRaw; + init.command = commandRaw.isNull() ? emptyAtom() : commandRaw; - Ref event = InvokeEvent::create(eventNames().invokeEvent, init, - InvokeEvent::IsTrusted::Yes); + Ref event = CommandEvent::create(eventNames().commandEvent, init, + CommandEvent::IsTrusted::Yes); invokee->dispatchEvent(event); - if (!event->defaultPrevented() && action != InvokeAction::Custom) - invokee->handleInvokeInternal(*this, action); + if (!event->defaultPrevented() && command != CommandType::Custom) + invokee->handleCommandInternal(*this, command); } // FIXME: We should remove the quirk once is fixed. diff --git a/Source/WebCore/html/HTMLFormControlElement.h b/Source/WebCore/html/HTMLFormControlElement.h index 9c19dede019c8..546db6d7a2823 100644 --- a/Source/WebCore/html/HTMLFormControlElement.h +++ b/Source/WebCore/html/HTMLFormControlElement.h @@ -102,7 +102,7 @@ class HTMLFormControlElement : public HTMLElement, public ValidatedFormListedEle const AtomString& popoverTargetAction() const; void setPopoverTargetAction(const AtomString& value); - RefPtr invokeTargetElement() const; + RefPtr commandForElement() const; bool isKeyboardFocusable(KeyboardEvent*) const override; @@ -131,8 +131,8 @@ class HTMLFormControlElement : public HTMLElement, public ValidatedFormListedEle void handlePopoverTargetAction() const; - InvokeAction invokeAction() const; - void handleInvokeAction(); + CommandType commandType() const; + void handleCommand(); private: void refFormAssociatedElement() const final { ref(); } diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp index 944ecb8444ebd..c13f35a43ed3a 100644 --- a/Source/WebCore/html/HTMLInputElement.cpp +++ b/Source/WebCore/html/HTMLInputElement.cpp @@ -1342,8 +1342,8 @@ void HTMLInputElement::defaultEventHandler(Event& event) // must dispatch a DOMActivate event - a click event will not do the job. if (event.type() == eventNames().DOMActivateEvent) { m_inputType->handleDOMActivateEvent(event); - if (invokeTargetElement()) - handleInvokeAction(); + if (commandForElement()) + handleCommand(); else handlePopoverTargetAction(); if (event.defaultHandled()) diff --git a/Source/WebCore/html/InvokerElement.idl b/Source/WebCore/html/InvokerElement.idl index 9271c6529ed0b..c89d2fea2214f 100644 --- a/Source/WebCore/html/InvokerElement.idl +++ b/Source/WebCore/html/InvokerElement.idl @@ -25,6 +25,6 @@ [EnabledBySetting=InvokerAttributesEnabled] interface mixin InvokerElement { - [CEReactions=NotNeeded, Reflect=invoketarget] attribute Element? invokeTargetElement; - [CEReactions=NotNeeded, Reflect=invokeaction] attribute DOMString invokeAction; + [CEReactions=NotNeeded, Reflect=commandfor] attribute Element? commandForElement; + [CEReactions=NotNeeded, Reflect=command] attribute DOMString command; }; diff --git a/Source/WebCore/page/FragmentDirective.h b/Source/WebCore/page/FragmentDirective.h index 2c4ee21430188..e1c87d6e39163 100644 --- a/Source/WebCore/page/FragmentDirective.h +++ b/Source/WebCore/page/FragmentDirective.h @@ -25,6 +25,7 @@ #pragma once +#include #include namespace WebCore {