Skip to content

Add invoketarget & invokeaction attributes #18794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 2, 2023

Conversation

keithamus
Copy link
Member

@keithamus keithamus commented Oct 6, 2023

de91640

Add invoketarget & invokeaction attributes

https://bugs.webkit.org/show_bug.cgi?id=262850

Reviewed by Tim Nguyen.

This adds support for the experimental `invoketarget` and `invokeaction`
attributes, as specified in the open-ui "Invokers" explainer.

(https://open-ui.org/components/invokers.explainer/)

The `invoketarget` attribute maps to the IDL `invokeTargetElement`,
similar to `popoverTargetElement`, and the `invokeaction` is a freeform
string.

The Button behaviour checks for `invokeTargetElement` in its activation
behaviour, and dispatches an `InvokeEvent` if there is one.

This also adds some basic scaffolding for `handleInvokeInternal` which
will allow elements to provide their own invocation action algorithms.

Co-authored-by: Keith Cirkel <keithamus@users.noreply.github.com>

* 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:
* 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/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/js/WebCoreBuiltinNames.h:
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::isElementReflectionAttribute):
* Source/WebCore/dom/Event.h:
(WebCore::Event::isInvokeEvent const):
* Source/WebCore/dom/EventNames.h:
* Source/WebCore/dom/EventNames.in:
* Source/WebCore/dom/InvokeEvent.cpp: Added.
(WebCore::InvokeEvent::InvokeEvent):
(WebCore::InvokeEvent::create):
(WebCore::InvokeEvent::createForBindings):
(WebCore::InvokeEvent::eventInterface const):
(WebCore::InvokeEvent::isInvokeEvent const):
(WebCore::InvokeEvent::invoker const):
* Source/WebCore/dom/InvokeEvent.h: Added.
* Source/WebCore/dom/InvokeEvent.idl: Added.
* Source/WebCore/html/HTMLAttributeNames.in:
* Source/WebCore/html/HTMLButtonElement.cpp:
(WebCore::HTMLButtonElement::defaultEventHandler):
* Source/WebCore/html/HTMLButtonElement.idl:
* Source/WebCore/html/HTMLElement.h:
(WebCore::HTMLElement::handleInvokeInternal):
* Source/WebCore/html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::invokeTargetElement const):
(WebCore::HTMLFormControlElement::invokeAction const):
(WebCore::HTMLFormControlElement::setInvokeAction):
(WebCore::HTMLFormControlElement::handleInvokeAction):
* Source/WebCore/html/HTMLFormControlElement.h:
* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::defaultEventHandler):
* Source/WebCore/html/HTMLInputElement.idl:
* Source/WebCore/html/InvokerElement.idl: Added.

Canonical link: https://commits.webkit.org/271428@main

4547842

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 wincairo
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 🧪 jsc ✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 🧪 jsc-arm64 ✅ 🛠 tv ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 tv-sim ✅ 🛠 jsc-armv7
✅ 🛠 🧪 merge ✅ 🛠 watch ✅ 🧪 jsc-armv7-tests
✅ 🛠 watch-sim

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 7, 2023
@keithamus keithamus marked this pull request as ready for review October 7, 2023 22:09
@keithamus
Copy link
Member Author

keithamus commented Oct 7, 2023

Going to mark this as ready for review to get some feedback on direction. There's no spec yet for this feature - happy to go write that first if necessary.

/cc @lindseywild @nt1m

Copy link
Member

@nt1m nt1m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's some iOS stuff to rebaseline, but in general this looks OK.

Can you change the commit title to "Add invoketarget & invokeaction attributes"

@keithamus keithamus changed the title Add invoke attribute Add invoketarget & invokeaction attributes Nov 9, 2023
Copy link
Member

@nt1m nt1m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks generally good to me. @annevk WDYT of landing this?

@Ahmad-S792 Ahmad-S792 added DOM For bugs specific to XML/HTML DOM elements (including parsing). and removed merging-blocked Applied to prevent a change from being merged labels Nov 12, 2023
@lukewarlow lukewarlow added the safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks label Dec 2, 2023
@webkit-ews-buildbot webkit-ews-buildbot added merge-queue Applied to send a pull request to merge-queue and removed safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks labels Dec 2, 2023
@webkit-ews-buildbot
Copy link
Collaborator

Safe-Merge-Queue: Build #5022.

@lukewarlow lukewarlow added merge-queue Applied to send a pull request to merge-queue and removed merge-queue Applied to send a pull request to merge-queue labels Dec 2, 2023
https://bugs.webkit.org/show_bug.cgi?id=262850

Reviewed by Tim Nguyen.

This adds support for the experimental `invoketarget` and `invokeaction`
attributes, as specified in the open-ui "Invokers" explainer.

(https://open-ui.org/components/invokers.explainer/)

The `invoketarget` attribute maps to the IDL `invokeTargetElement`,
similar to `popoverTargetElement`, and the `invokeaction` is a freeform
string.

The Button behaviour checks for `invokeTargetElement` in its activation
behaviour, and dispatches an `InvokeEvent` if there is one.

This also adds some basic scaffolding for `handleInvokeInternal` which
will allow elements to provide their own invocation action algorithms.

Co-authored-by: Keith Cirkel <keithamus@users.noreply.github.com>

* 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:
* 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/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/js/WebCoreBuiltinNames.h:
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::isElementReflectionAttribute):
* Source/WebCore/dom/Event.h:
(WebCore::Event::isInvokeEvent const):
* Source/WebCore/dom/EventNames.h:
* Source/WebCore/dom/EventNames.in:
* Source/WebCore/dom/InvokeEvent.cpp: Added.
(WebCore::InvokeEvent::InvokeEvent):
(WebCore::InvokeEvent::create):
(WebCore::InvokeEvent::createForBindings):
(WebCore::InvokeEvent::eventInterface const):
(WebCore::InvokeEvent::isInvokeEvent const):
(WebCore::InvokeEvent::invoker const):
* Source/WebCore/dom/InvokeEvent.h: Added.
* Source/WebCore/dom/InvokeEvent.idl: Added.
* Source/WebCore/html/HTMLAttributeNames.in:
* Source/WebCore/html/HTMLButtonElement.cpp:
(WebCore::HTMLButtonElement::defaultEventHandler):
* Source/WebCore/html/HTMLButtonElement.idl:
* Source/WebCore/html/HTMLElement.h:
(WebCore::HTMLElement::handleInvokeInternal):
* Source/WebCore/html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::invokeTargetElement const):
(WebCore::HTMLFormControlElement::invokeAction const):
(WebCore::HTMLFormControlElement::setInvokeAction):
(WebCore::HTMLFormControlElement::handleInvokeAction):
* Source/WebCore/html/HTMLFormControlElement.h:
* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::defaultEventHandler):
* Source/WebCore/html/HTMLInputElement.idl:
* Source/WebCore/html/InvokerElement.idl: Added.

Canonical link: https://commits.webkit.org/271428@main
@webkit-commit-queue
Copy link
Collaborator

Committed 271428@main (de91640): https://commits.webkit.org/271428@main

Reviewed commits have been landed. Closing PR #18794 and removing active labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DOM For bugs specific to XML/HTML DOM elements (including parsing).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants