[Webkit-unassigned] [Bug 229556] AX: Make PDFs loaded via <embed> accessible
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Sep 10 06:18:41 PDT 2021
https://bugs.webkit.org/show_bug.cgi?id=229556
--- Comment #15 from Andres Gonzalez <andresg_22 at apple.com> ---
(In reply to Tyler Wilcock from comment #13)
> Created attachment 437808 [details]
> Patch
--- a/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
+++ a/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
@@ -2944,6 +2948,25 @@ ALLOW_DEPRECATED_IMPLEMENTATIONS_END
if (axObject) {
if (axObject->isAttachment() && [axObject->wrapper() attachmentView])
return [axObject->wrapper() attachmentView];
+ auto* widget = axObject->widget();
+ if (is<PluginViewBase>(widget)) {
+ id hitTestResult = widget->accessibilityHitTest(IntPoint(point));
+ BOOL accessibilityIsIgnored = YES;
+ BOOL isAccessibilityElement = NO;
+
+ ALLOW_DEPRECATED_DECLARATIONS_BEGIN
+ if ([hitTestResult respondsToSelector:@selector(accessibilityIsIgnored)])
+ accessibilityIsIgnored = [hitTestResult accessibilityIsIgnored];
+ ALLOW_DEPRECATED_DECLARATIONS_END
+
+ if ([hitTestResult respondsToSelector:@selector(isAccessibilityElement)])
+ isAccessibilityElement = [hitTestResult isAccessibilityElement];
+
+ // Check if either selector exposes the element, because some classes
+ // have conflicting implementations (such as PDFLayerController which returns YES in both cases).
+ if (!accessibilityIsIgnored || isAccessibilityElement)
+ return hitTestResult;
+ }
return NSAccessibilityUnignoredAncestor(axObject->wrapper());
}
return NSAccessibilityUnignoredAncestor(self);
I would suggest getting rid of the bools and changing this logic to:
if (![hitTestResult respondsToSelector:@selector(isAccessibilityElement)]
|| ![hitTestResult isAccessibilityElement])
return NSAccessibilityUnignoredAncestor(axObject->wrapper());
// isAccessibilityElement is a required selector for all platform accessible objects.
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
if ([hitTestResult respondsToSelector:@selector(accessibilityIsIgnored)])
&& [hitTestResult accessibilityIsIgnored];
return NSAccessibilityUnignoredAncestor(axObject->wrapper());
ALLOW_DEPRECATED_DECLARATIONS_END
// accessibilityIsIgnored is optional, implemented by web objects, but not necessarily by plugins.
return hitTestResult;
@@ -3694,6 +3717,16 @@ enum class TextUnit {
});
}
+static BOOL isPluginMatchingCriteria(AXCoreObject* axObject, const AccessibilitySearchCriteria& criteria)
What is the purpose of this function? Searches can start at any object, plug-in or not, and the results should include all matching objects plug-in or not.
@@ -3797,6 +3830,10 @@ ALLOW_DEPRECATED_IMPLEMENTATIONS_END
if ([attribute isEqualToString:NSAccessibilityUIElementCountForSearchPredicateParameterizedAttribute]) {
AccessibilitySearchCriteria criteria = accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute(dictionary);
+ if (isPluginMatchingCriteria(backingObject, criteria)) {
+ auto* widgetChildren = [self renderWidgetChildren];
+ return @(std::min([widgetChildren count], NSUInteger(criteria.resultsLimit)));
+ }
There is no matching performed here, we don't want to return all the children of the starting object.
@@ -3804,6 +3841,13 @@ ALLOW_DEPRECATED_IMPLEMENTATIONS_END
if ([attribute isEqualToString:NSAccessibilityUIElementsForSearchPredicateParameterizedAttribute]) {
AccessibilitySearchCriteria criteria = accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute(dictionary);
+ // If our object is a plugin, it won't have non-widget children to search through.
+ // If the criteria allows, search through `renderWidgetChildren` instead.
+ if (isPluginMatchingCriteria(backingObject, criteria)) {
+ auto* widgetChildren = [self renderWidgetChildren];
+ NSUInteger matchingChildrenCount = std::min([widgetChildren count], NSUInteger(criteria.resultsLimit));
+ return [widgetChildren subarrayWithRange:NSMakeRange(0, matchingChildrenCount)];
+ }
Same here, there is no matching done, we don't want to return just the children of the start object.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210910/957de9a0/attachment-0001.htm>
More information about the webkit-unassigned
mailing list