RESOLVED FIXED Bug 221875
AX: Image should report the embedded accessibility description if available
https://bugs.webkit.org/show_bug.cgi?id=221875
Summary AX: Image should report the embedded accessibility description if available
chris fleizach
Reported 2021-02-14 00:25:47 PST
Images may contain metadata meant for screenreaders to consume to users That data should be exposed through the AX API using the API in MediaAccessibility
Attachments
patch (53.50 KB, patch)
2021-02-14 01:43 PST, chris fleizach
ews-feeder: commit-queue-
patch (53.50 KB, patch)
2021-02-15 10:53 PST, chris fleizach
no flags
Patch (54.75 KB, patch)
2021-02-15 11:08 PST, chris fleizach
no flags
Patch (55.49 KB, patch)
2021-02-15 13:32 PST, chris fleizach
ews-feeder: commit-queue-
Patch (55.50 KB, patch)
2021-02-15 13:44 PST, chris fleizach
ews-feeder: commit-queue-
Patch (55.71 KB, patch)
2021-02-15 13:59 PST, chris fleizach
ews-feeder: commit-queue-
Patch (56.67 KB, patch)
2021-02-15 15:04 PST, chris fleizach
ews-feeder: commit-queue-
Patch (56.67 KB, patch)
2021-02-15 16:37 PST, chris fleizach
ews-feeder: commit-queue-
Patch (56.74 KB, patch)
2021-02-15 17:07 PST, chris fleizach
ews-feeder: commit-queue-
Patch (57.21 KB, patch)
2021-02-15 23:43 PST, chris fleizach
no flags
Patch (56.61 KB, patch)
2021-02-16 00:54 PST, chris fleizach
ews-feeder: commit-queue-
Patch (56.77 KB, patch)
2021-02-16 10:00 PST, chris fleizach
no flags
Patch (56.83 KB, patch)
2021-02-16 13:00 PST, chris fleizach
ews-feeder: commit-queue-
Patch (56.80 KB, patch)
2021-02-16 15:53 PST, chris fleizach
no flags
Patch (56.69 KB, patch)
2021-02-17 11:52 PST, chris fleizach
no flags
Patch (56.55 KB, patch)
2021-02-17 16:28 PST, chris fleizach
no flags
Patch (57.56 KB, patch)
2021-02-18 14:17 PST, chris fleizach
no flags
Patch (57.70 KB, patch)
2021-02-18 15:53 PST, chris fleizach
no flags
Patch (57.59 KB, patch)
2021-02-19 12:28 PST, chris fleizach
no flags
Radar WebKit Bug Importer
Comment 1 2021-02-14 00:25:55 PST
chris fleizach
Comment 2 2021-02-14 01:43:26 PST
chris fleizach
Comment 3 2021-02-15 10:53:47 PST
chris fleizach
Comment 4 2021-02-15 11:08:34 PST
chris fleizach
Comment 5 2021-02-15 13:32:35 PST
chris fleizach
Comment 6 2021-02-15 13:44:22 PST
chris fleizach
Comment 7 2021-02-15 13:59:20 PST
chris fleizach
Comment 8 2021-02-15 15:04:10 PST
chris fleizach
Comment 9 2021-02-15 16:37:55 PST
chris fleizach
Comment 10 2021-02-15 17:07:58 PST
Andres Gonzalez
Comment 11 2021-02-15 18:58:46 PST
(In reply to chris fleizach from comment #10) > Created attachment 420396 [details] > Patch --- a/Source/WebCore/accessibility/AccessibilityObjectInterface.h +++ a/Source/WebCore/accessibility/AccessibilityObjectInterface.h @@ -1011,6 +1011,7 @@ public: virtual double estimatedLoadingProgress() const = 0; virtual String brailleLabel() const = 0; virtual String brailleRoleDescription() const = 0; + virtual String embeddedImageDescription() const = 0; Do we need to expose this in the AXCoreObject interface? or we are better off adding this to the current image description method. I.e., we already describe images. So this would be one more source for the image description.
chris fleizach
Comment 12 2021-02-15 23:43:01 PST
chris fleizach
Comment 13 2021-02-15 23:44:10 PST
(In reply to Andres Gonzalez from comment #11) > (In reply to chris fleizach from comment #10) > > Created attachment 420396 [details] > > Patch > > --- a/Source/WebCore/accessibility/AccessibilityObjectInterface.h > +++ a/Source/WebCore/accessibility/AccessibilityObjectInterface.h > @@ -1011,6 +1011,7 @@ public: > virtual double estimatedLoadingProgress() const = 0; > virtual String brailleLabel() const = 0; > virtual String brailleRoleDescription() const = 0; > + virtual String embeddedImageDescription() const = 0; > > Do we need to expose this in the AXCoreObject interface? or we are better > off adding this to the current image description method. > > I.e., we already describe images. So this would be one more source for the > image description. This needs to be returned through a new attribute on Mac, so I think we have a good reason to separate it out
chris fleizach
Comment 14 2021-02-16 00:54:56 PST
Andres Gonzalez
Comment 15 2021-02-16 05:09:55 PST
(In reply to chris fleizach from comment #13) > (In reply to Andres Gonzalez from comment #11) > > (In reply to chris fleizach from comment #10) > > > Created attachment 420396 [details] > > > Patch > > > > --- a/Source/WebCore/accessibility/AccessibilityObjectInterface.h > > +++ a/Source/WebCore/accessibility/AccessibilityObjectInterface.h > > @@ -1011,6 +1011,7 @@ public: > > virtual double estimatedLoadingProgress() const = 0; > > virtual String brailleLabel() const = 0; > > virtual String brailleRoleDescription() const = 0; > > + virtual String embeddedImageDescription() const = 0; > > > > Do we need to expose this in the AXCoreObject interface? or we are better > > off adding this to the current image description method. > > > > I.e., we already describe images. So this would be one more source for the > > image description. > > This needs to be returned through a new attribute on Mac, so I think we have > a good reason to separate it out I don't see why we need a separate attribute on Mac since we already have an attribute that returns an image description. I see this as another source of alt text, but coming from the image metadata instead of from the markup. But I may be missing some use case here.
Andres Gonzalez
Comment 16 2021-02-16 05:15:06 PST
--- a/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm +++ a/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm @@ -1661,6 +1661,16 @@ bool AccessibilityUIElement::isCollapsed() const return false; } +JSRetainPtr<JSStringRef> AccessibilityUIElement::embeddedImageDescription() const +{ + BEGIN_AX_OBJC_EXCEPTIONS + id value = [m_element accessibilityAttributeValue:@"AXEmbeddedImageDescription"]; Use static attributeValue instead, to do the simulated AX thread in isolated tree mode: id value = attributeValue(m_element.get(), @"AXEmbeddedImageDescription");
chris fleizach
Comment 17 2021-02-16 09:39:53 PST
(In reply to Andres Gonzalez from comment #15) > (In reply to chris fleizach from comment #13) > > (In reply to Andres Gonzalez from comment #11) > > > (In reply to chris fleizach from comment #10) > > > > > > I don't see why we need a separate attribute on Mac since we already have an > attribute that returns an image description. I see this as another source of > alt text, but coming from the image metadata instead of from the markup. But > I may be missing some use case here. I think VoiceOver wants to be able to describe and treat this differently if necessary
chris fleizach
Comment 18 2021-02-16 10:00:41 PST
chris fleizach
Comment 19 2021-02-16 13:00:45 PST
chris fleizach
Comment 20 2021-02-16 15:53:52 PST
chris fleizach
Comment 21 2021-02-17 11:52:26 PST
chris fleizach
Comment 22 2021-02-17 16:28:29 PST
Jer Noble
Comment 23 2021-02-18 11:01:13 PST
Comment on attachment 420756 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=420756&action=review r=me with nits. > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:1596 > + if (imageAttrs == nil) { if (!imageAttrs) > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:1601 > + auto tempArray = adoptNS([[NSMutableArray alloc] initWithArray:attributes]); > + [tempArray addObject:NSAccessibilityEmbeddedImageDescriptionAttribute]; > + [tempArray addObject:NSAccessibilityURLAttribute]; > + imageAttrs = tempArray.leakRef(); > + } adoptNS(...).leakRef() seems to be a no-op, so I'm not sure what it's doing here. This applies to all the other initializers in this function as well. Additionally, it's a little weird that every attribute dictionary is initialized the first time this method is called, rather than have a separate static/NeverDestroyed method for each, so the cost is only paid when at item of the specific type is passed in. But since this is the existing pattern, maybe it's not a big deal. > Source/WebCore/platform/cf/MediaAccessibilitySoftLink.h:76 > +SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, MediaAccessibility, MAImageCaptioningCopyCaptionWithSource, CFStringRef, (CGImageSourceRef imageSource, CFErrorRef * CF_RETURNS_RETAINED error), (imageSource, error)) > +#define MAImageCaptioningCopyCaptionWithSource softLink_MediaAccessibility_MAImageCaptioningCopyCaptionWithSource Should this be the _MAY_FAIL variant?
chris fleizach
Comment 24 2021-02-18 12:32:36 PST
(In reply to Jer Noble from comment #23) > Comment on attachment 420756 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=420756&action=review > > r=me with nits. > > > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:1596 > > + if (imageAttrs == nil) { > > if (!imageAttrs) > > > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:1601 > > + auto tempArray = adoptNS([[NSMutableArray alloc] initWithArray:attributes]); > > + [tempArray addObject:NSAccessibilityEmbeddedImageDescriptionAttribute]; > > + [tempArray addObject:NSAccessibilityURLAttribute]; > > + imageAttrs = tempArray.leakRef(); > > + } > > adoptNS(...).leakRef() seems to be a no-op, so I'm not sure what it's doing > here. This applies to all the other initializers in this function as well. > > Additionally, it's a little weird that every attribute dictionary is > initialized the first time this method is called, rather than have a > separate static/NeverDestroyed method for each, so the cost is only paid > when at item of the specific type is passed in. But since this is the > existing pattern, maybe it's not a big deal. > let me make a new bug to address this. the code is like 20 years old so it's probably doing everything in an out of date way now https://bugs.webkit.org/show_bug.cgi?id=222125 > > Source/WebCore/platform/cf/MediaAccessibilitySoftLink.h:76 > > +SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, MediaAccessibility, MAImageCaptioningCopyCaptionWithSource, CFStringRef, (CGImageSourceRef imageSource, CFErrorRef * CF_RETURNS_RETAINED error), (imageSource, error)) > > +#define MAImageCaptioningCopyCaptionWithSource softLink_MediaAccessibility_MAImageCaptioningCopyCaptionWithSource > > Should this be the _MAY_FAIL variant? Yea
chris fleizach
Comment 25 2021-02-18 14:17:38 PST
chris fleizach
Comment 26 2021-02-18 15:53:00 PST
chris fleizach
Comment 27 2021-02-19 12:28:51 PST
EWS
Comment 28 2021-02-20 20:15:57 PST
Committed r273214: <https://commits.webkit.org/r273214> All reviewed patches have been landed. Closing bug and clearing flags on attachment 421009 [details].
Note You need to log in before you can comment on or make changes to this bug.