Title: [285389] trunk
Revision
285389
Author
[email protected]
Date
2021-11-06 21:07:44 -0700 (Sat, 06 Nov 2021)

Log Message

AX: WebKit1 PluginViewBase objects with an associated widget()->platformWidget() should be considered attachments
https://bugs.webkit.org/show_bug.cgi?id=232759

Patch by Tyler Wilcock <[email protected]> on 2021-11-06
Reviewed by Chris Fleizach.

Source/WebCore:

In https://bugs.webkit.org/show_bug.cgi?id=229556 (AX: Make PDFs
loaded via <embed> accessible), we changed AccessibilityRenderObject::isAttachment
to return false if the underlying object represented a PluginViewBase
under the assumption that if a PluginViewBase existed, the object must
be a WebKit2 plugin. That assumption is wrong, because in certain
scenarios an object can be a WebKit1 PluginViewBase (e.g. attachments
inserted by WebKit1 webviews).

This patch changes isAttachment to only return false if the
PluginViewBase doesn't also have an associated platformWidget, which
should be present in WebKit1 only.

This patch also fixes a bug in the Mac -[WebAccessibilityObjectWrapper
subrole]. For objects with a role of group and no children, we
returned a subrole of AXEmptyGroup. However, we didn't check for the
presence of renderWidgetChildren that a group may have.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::isAttachment const):
Consider PluginViewBase objects with an associated platformWidget to
be attachments.
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper subrole]):
Don't return AXEmptyGroup subrole for objects with
renderWidgetChildren.

LayoutTests:

This patch changes the Mac WebAccessibilityObjectWrapper to not return
an AXEmptyGroup subrole for objects with renderWidgetChildren.

* accessibility/mac/basic-embed-pdf-accessibility-expected.txt:
* accessibility/mac/basic-embed-pdf-accessibility.html:
Add expectation that the embed container doesn't have an AXEmptyGroup
subrole.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (285388 => 285389)


--- trunk/LayoutTests/ChangeLog	2021-11-07 00:34:08 UTC (rev 285388)
+++ trunk/LayoutTests/ChangeLog	2021-11-07 04:07:44 UTC (rev 285389)
@@ -1,3 +1,18 @@
+2021-11-06  Tyler Wilcock  <[email protected]>
+
+        AX: WebKit1 PluginViewBase objects with an associated widget()->platformWidget() should be considered attachments
+        https://bugs.webkit.org/show_bug.cgi?id=232759
+
+        Reviewed by Chris Fleizach.
+
+        This patch changes the Mac WebAccessibilityObjectWrapper to not return
+        an AXEmptyGroup subrole for objects with renderWidgetChildren.
+
+        * accessibility/mac/basic-embed-pdf-accessibility-expected.txt:
+        * accessibility/mac/basic-embed-pdf-accessibility.html:
+        Add expectation that the embed container doesn't have an AXEmptyGroup
+        subrole.
+
 2021-11-06  David Kilzer  <[email protected]>
 
         Remove empty directories from from svn.webkit.org repository as of r285357

Modified: trunk/LayoutTests/accessibility/mac/basic-embed-pdf-accessibility-expected.txt (285388 => 285389)


--- trunk/LayoutTests/accessibility/mac/basic-embed-pdf-accessibility-expected.txt	2021-11-07 00:34:08 UTC (rev 285388)
+++ trunk/LayoutTests/accessibility/mac/basic-embed-pdf-accessibility-expected.txt	2021-11-07 04:07:44 UTC (rev 285389)
@@ -5,6 +5,7 @@
 
 PASS pdfEmbedElement.domIdentifier is 'pdfEmbed'
 PASS pdfEmbedElement.role is 'AXRole: AXGroup'
+PASS pdfEmbedElement.subrole is 'AXSubrole: '
 PASS pdfEmbedElement.childrenCount is 1
 PASS pdfAxObject.stringAttributeValue('AXSubrole') is 'AXPDFPluginSubrole'
 PASS pdfAxObject.childrenCount is 1

Modified: trunk/LayoutTests/accessibility/mac/basic-embed-pdf-accessibility.html (285388 => 285389)


--- trunk/LayoutTests/accessibility/mac/basic-embed-pdf-accessibility.html	2021-11-07 00:34:08 UTC (rev 285388)
+++ trunk/LayoutTests/accessibility/mac/basic-embed-pdf-accessibility.html	2021-11-07 04:07:44 UTC (rev 285389)
@@ -51,6 +51,8 @@
 
             shouldBe("pdfEmbedElement.domIdentifier", "'pdfEmbed'");
             shouldBe("pdfEmbedElement.role", "'AXRole: AXGroup'");
+            // Verify the group that contains the PDF AX object isn't considered empty via an AXEmptyGroup subrole.
+            shouldBe("pdfEmbedElement.subrole", "'AXSubrole: '");
             shouldBe("pdfEmbedElement.childrenCount", "1");
 
             shouldBe("pdfAxObject.stringAttributeValue('AXSubrole')", "'AXPDFPluginSubrole'");

Modified: trunk/Source/WebCore/ChangeLog (285388 => 285389)


--- trunk/Source/WebCore/ChangeLog	2021-11-07 00:34:08 UTC (rev 285388)
+++ trunk/Source/WebCore/ChangeLog	2021-11-07 04:07:44 UTC (rev 285389)
@@ -1,3 +1,36 @@
+2021-11-06  Tyler Wilcock  <[email protected]>
+
+        AX: WebKit1 PluginViewBase objects with an associated widget()->platformWidget() should be considered attachments
+        https://bugs.webkit.org/show_bug.cgi?id=232759
+
+        Reviewed by Chris Fleizach.
+
+        In https://bugs.webkit.org/show_bug.cgi?id=229556 (AX: Make PDFs
+        loaded via <embed> accessible), we changed AccessibilityRenderObject::isAttachment
+        to return false if the underlying object represented a PluginViewBase
+        under the assumption that if a PluginViewBase existed, the object must
+        be a WebKit2 plugin. That assumption is wrong, because in certain
+        scenarios an object can be a WebKit1 PluginViewBase (e.g. attachments
+        inserted by WebKit1 webviews).
+
+        This patch changes isAttachment to only return false if the
+        PluginViewBase doesn't also have an associated platformWidget, which
+        should be present in WebKit1 only.
+
+        This patch also fixes a bug in the Mac -[WebAccessibilityObjectWrapper
+        subrole]. For objects with a role of group and no children, we
+        returned a subrole of AXEmptyGroup. However, we didn't check for the
+        presence of renderWidgetChildren that a group may have.
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::isAttachment const):
+        Consider PluginViewBase objects with an associated platformWidget to
+        be attachments.
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper subrole]):
+        Don't return AXEmptyGroup subrole for objects with
+        renderWidgetChildren.
+
 2021-11-06  Myles C. Maxfield  <[email protected]>
 
         Fix GTK build after r285381.

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (285388 => 285389)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2021-11-07 00:34:08 UTC (rev 285388)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2021-11-07 04:07:44 UTC (rev 285389)
@@ -534,8 +534,9 @@
     if (!renderer)
         return false;
 
-    // Although plugins are also a type of widget, we need to treat them differently than attachments.
-    if (is<PluginViewBase>(widget()))
+    // WebKit2 plugins need to be treated differently than attachments, so return false here.
+    // Only WebKit1 plugins have an associated platformWidget.
+    if (is<PluginViewBase>(widget()) && !widget()->platformWidget())
         return false;
 
     // Widgets are the replaced elements that we represent to AX as attachments

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (285388 => 285389)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2021-11-07 00:34:08 UTC (rev 285388)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2021-11-07 04:07:44 UTC (rev 285389)
@@ -1841,7 +1841,7 @@
         return @"AXMeter";
 
     // Treat any group without exposed children as empty.
-    if ([[self role] isEqual:NSAccessibilityGroupRole] && !backingObject->children().size())
+    if ([[self role] isEqual:NSAccessibilityGroupRole] && !backingObject->children().size() && ![[self renderWidgetChildren] count])
         return @"AXEmptyGroup";
 
     AccessibilityRole role = backingObject->roleValue();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to