Skip to content
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

Implement ARIA id-ref reflection for ElementInternals #4452

Merged
merged 1 commit into from Sep 21, 2022

Conversation

rniwa
Copy link
Member

@rniwa rniwa commented Sep 18, 2022

6989a5b

Implement ARIA id-ref reflection for ElementInternals
https://bugs.webkit.org/show_bug.cgi?id=245328

Reviewed by Manuel Rego Casasnovas.

This patch adds the support for id-ref ARIA attributes to ElementInternals.

* LayoutTests/accessibility/custom-elements/controls-expected.txt: Added.
* LayoutTests/accessibility/custom-elements/controls.html: Added.
* LayoutTests/accessibility/custom-elements/describedby-expected.txt: Added.
* LayoutTests/accessibility/custom-elements/describedby.html: Added.
* LayoutTests/accessibility/custom-elements/flowto-expected.txt: Added.
* LayoutTests/accessibility/custom-elements/flowto.html: Added.
* LayoutTests/accessibility/custom-elements/menuitem-expected.txt:
* LayoutTests/accessibility/custom-elements/menuitem.html:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/form-associated/ElementInternals-accessibility-expected.txt:
* LayoutTests/platform/gtk/accessibility/custom-elements/describedby-expected.txt: Added.
* LayoutTests/platform/mac-wk1/TestExpectations:

* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:

* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::isModalElement const):
(WebCore::nodeHasRole):
(WebCore::AXObjectCache::updateRelationsIfNeeded): Add the support for defining relations via ElementInternals.

* Source/WebCore/accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::getAttribute const):
(WebCore::AccessibilityObject::elementsFromAttribute const): Ditto.

* Source/WebCore/bindings/js/JSElementInternalsCustom.cpp: Added.
(WebCore::getElementsArrayAttribute): Added.
(WebCore::JSElementInternals::ariaControlsElements const): Added.
(WebCore::JSElementInternals::ariaDescribedByElements const): Added.
(WebCore::JSElementInternals::ariaDetailsElements const): Added.
(WebCore::JSElementInternals::ariaErrorMessageElements const):
(WebCore::JSElementInternals::ariaFlowToElements const): Added.
(WebCore::JSElementInternals::ariaLabelledByElements const): Added.
(WebCore::JSElementInternals::ariaOwnsElements const): Added.

* Source/WebCore/dom/CustomElementDefaultARIA.cpp:
(WebCore::isElementVisible): Added.
(WebCore::CustomElementDefaultARIA::valueForAttribute const): Added the support for converting
WeakPtr<Element> and Vector<WeakPtr<Element>> to ID strings.
(WebCore::CustomElementDefaultARIA::elementForAttribute const): Added.
(WebCore::CustomElementDefaultARIA::setElementForAttribute): Added.
(WebCore::CustomElementDefaultARIA::elementsForAttribute const): Added.
(WebCore::CustomElementDefaultARIA::setElementsForAttribute): Added.

* Source/WebCore/dom/CustomElementDefaultARIA.h:

* Source/WebCore/dom/ElementInternals.cpp:
(WebCore::computeValueForAttribute): Extracted out of setAttributeWithoutSynchronization.
(WebCore::ElementInternals::setAttributeWithoutSynchronization):
(WebCore::ElementInternals::attributeWithoutSynchronization const):
(WebCore::ElementInternals::getElementAttribute const): Added.
(WebCore::ElementInternals::setElementAttribute): Added.
(WebCore::ElementInternals::getElementsArrayAttribute const): Added.
(WebCore::ElementInternals::setElementsArrayAttribute): Added.

* Source/WebCore/dom/ElementInternals.h:
* Source/WebCore/dom/ElementInternals.idl:

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

985cac2

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  πŸ§ͺ win
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-debug βœ… πŸ›  gtk βœ… πŸ›  wincairo
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-wk1
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2
βœ… πŸ›  watch βœ… πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  πŸ§ͺ unsafe-merge βœ… πŸ›  watch-sim βœ… πŸ§ͺ mac-wk2-stress

@rniwa rniwa requested a review from cdumez as a code owner September 18, 2022 01:49
@rniwa rniwa self-assigned this Sep 18, 2022
@rniwa rniwa added Accessibility For bugs related to accessibility. WebKit Nightly Build labels Sep 18, 2022
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 18, 2022
@rniwa rniwa removed the merging-blocked Applied to prevent a change from being merged label Sep 18, 2022
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 18, 2022
@rniwa rniwa removed the merging-blocked Applied to prevent a change from being merged label Sep 18, 2022
@rniwa rniwa changed the title Implement id-ref reflection for ElementInternals Implement ARIA id-ref reflection for ElementInternals Sep 18, 2022
Copy link
Member

@mrego mrego left a comment

Choose a reason for hiding this comment

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

LGTM, not sure if you also want to ask for review to someone with more experience on the accessibility code.

@rniwa rniwa added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Sep 21, 2022
https://bugs.webkit.org/show_bug.cgi?id=245328

Reviewed by Manuel Rego Casasnovas.

This patch adds the support for id-ref ARIA attributes to ElementInternals.

* LayoutTests/accessibility/custom-elements/controls-expected.txt: Added.
* LayoutTests/accessibility/custom-elements/controls.html: Added.
* LayoutTests/accessibility/custom-elements/describedby-expected.txt: Added.
* LayoutTests/accessibility/custom-elements/describedby.html: Added.
* LayoutTests/accessibility/custom-elements/flowto-expected.txt: Added.
* LayoutTests/accessibility/custom-elements/flowto.html: Added.
* LayoutTests/accessibility/custom-elements/menuitem-expected.txt:
* LayoutTests/accessibility/custom-elements/menuitem.html:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/form-associated/ElementInternals-accessibility-expected.txt:
* LayoutTests/platform/gtk/accessibility/custom-elements/describedby-expected.txt: Added.
* LayoutTests/platform/mac-wk1/TestExpectations:

* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:

* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::isModalElement const):
(WebCore::nodeHasRole):
(WebCore::AXObjectCache::updateRelationsIfNeeded): Add the support for defining relations via ElementInternals.

* Source/WebCore/accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::getAttribute const):
(WebCore::AccessibilityObject::elementsFromAttribute const): Ditto.

* Source/WebCore/bindings/js/JSElementInternalsCustom.cpp: Added.
(WebCore::getElementsArrayAttribute): Added.
(WebCore::JSElementInternals::ariaControlsElements const): Added.
(WebCore::JSElementInternals::ariaDescribedByElements const): Added.
(WebCore::JSElementInternals::ariaDetailsElements const): Added.
(WebCore::JSElementInternals::ariaErrorMessageElements const):
(WebCore::JSElementInternals::ariaFlowToElements const): Added.
(WebCore::JSElementInternals::ariaLabelledByElements const): Added.
(WebCore::JSElementInternals::ariaOwnsElements const): Added.

* Source/WebCore/dom/CustomElementDefaultARIA.cpp:
(WebCore::isElementVisible): Added.
(WebCore::CustomElementDefaultARIA::valueForAttribute const): Added the support for converting
WeakPtr<Element> and Vector<WeakPtr<Element>> to ID strings.
(WebCore::CustomElementDefaultARIA::elementForAttribute const): Added.
(WebCore::CustomElementDefaultARIA::setElementForAttribute): Added.
(WebCore::CustomElementDefaultARIA::elementsForAttribute const): Added.
(WebCore::CustomElementDefaultARIA::setElementsForAttribute): Added.

* Source/WebCore/dom/CustomElementDefaultARIA.h:

* Source/WebCore/dom/ElementInternals.cpp:
(WebCore::computeValueForAttribute): Extracted out of setAttributeWithoutSynchronization.
(WebCore::ElementInternals::setAttributeWithoutSynchronization):
(WebCore::ElementInternals::attributeWithoutSynchronization const):
(WebCore::ElementInternals::getElementAttribute const): Added.
(WebCore::ElementInternals::setElementAttribute): Added.
(WebCore::ElementInternals::getElementsArrayAttribute const): Added.
(WebCore::ElementInternals::setElementsArrayAttribute): Added.

* Source/WebCore/dom/ElementInternals.h:
* Source/WebCore/dom/ElementInternals.idl:

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

Committed 254709@main (6989a5b): https://commits.webkit.org/254709@main

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

@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Sep 21, 2022
@rniwa rniwa deleted the fix245328 branch September 21, 2022 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accessibility For bugs related to accessibility.
Projects
None yet
5 participants