Bug 1896047 part 5: Support CSS alt text for text content. r=eeejay
commit6782d3d9fd71fadb4267587fb4154a758b3cc040
authorJames Teh <jteh@mozilla.com>
Fri, 17 May 2024 00:24:16 +0000 (17 00:24 +0000)
committerJames Teh <jteh@mozilla.com>
Fri, 17 May 2024 00:24:16 +0000 (17 00:24 +0000)
treecec6f9c137765ae4408bbed5187913466fda7e5d
parent845cf6ca315b751acdd4da22e5b5b12fde968463
Bug 1896047 part 5: Support CSS alt text for text content. r=eeejay

CSS alt text makes most sense for an image.
However, even when the content property specifies text, you can still specify alt text!
To support this, this patch does two things:

1. Uses the alt text for the TextLeafAccessible instead of the primary text.
2. Tweaks nsTextEquivUtils to use the alt text when gathering text from a subtree.

As with the last patch, changing the CSS content replaces the pseudo-element, which in turn replaces the Accessible with a new one, so we don't need any additional code to handle updates.

Differential Revision: https://phabricator.services.mozilla.com/D210017
accessible/base/nsAccessibilityService.cpp
accessible/base/nsTextEquivUtils.cpp
accessible/tests/browser/tree/browser_css_alt.js
testing/web-platform/meta/accname/name/comp_name_from_content.html.ini