Bug 232759

Summary: AX: WebKit1 PluginViewBase objects with an associated widget()->platformWidget() should be considered attachments
Product: WebKit Reporter: Tyler Wilcock <tyler_w>
Component: AccessibilityAssignee: Tyler Wilcock <tyler_w>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, andresg_22, apinheiro, cfleizach, dmazzoni, ews-watchlist, jcraig, jdiggs, samuel_white, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Tyler Wilcock 2021-11-05 10:13:07 PDT
This is a regression from https://bugs.webkit.org/show_bug.cgi?id=229556 (AX: Make PDFs loaded via <embed> accessible).
Comment 1 Radar WebKit Bug Importer 2021-11-05 10:13:34 PDT
<rdar://problem/85075555>
Comment 2 Tyler Wilcock 2021-11-05 11:34:39 PDT
Created attachment 443420 [details]
Patch
Comment 3 chris fleizach 2021-11-05 11:55:46 PDT
Comment on attachment 443420 [details]
Patch

Is it possible to have a test for this
Comment 4 Andres Gonzalez 2021-11-05 13:42:47 PDT
(In reply to Tyler Wilcock from comment #2)
> Created attachment 443420 [details]
> Patch

--- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
+++ a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

+    bool hasPlatformWidget = widget() && widget()->platformWidget();
+    if (is<PluginViewBase>(widget()) && !hasPlatformWidget) {

you can write this in just one line like:

    if (is<PluginViewBase>(widget()) && !widget()->platformWidget()) {
Comment 5 Tyler Wilcock 2021-11-05 15:27:55 PDT
Created attachment 443443 [details]
Patch
Comment 6 Tyler Wilcock 2021-11-05 15:29:04 PDT
(In reply to chris fleizach from comment #3)
> Comment on attachment 443420 [details]
> Patch
> 
> Is it possible to have a test for this
I haven't found a way to create a WK1 platformWidget-based object in a layout test. Do you know of a way?

I tried un-skipping the test added by the bug that caused the regression in WK1:

https://github.com/WebKit/WebKit/blob/f1f395b977bd8befab5023c5eda2cbde26aa9741/LayoutTests/accessibility/mac/basic-embed-pdf-accessibility.html#L14

But it still times out, so it wasn't this attachment bug causing the WK1 failure (which may mean <embed>s don’t use platformWidget’s in WK1).

I manually tested the WK1 WebView linked against a build of WebKit with this patch and confirmed the issue is fixed. I also manually tested both WK2 <embed> and <object> PDFs and confirmed they are still accessible (and the layout test for the WK2 path still passes).

I added a test for the renderWidgetChildren + AXEmptyGroup change.
Comment 7 EWS 2021-11-06 21:07:51 PDT
Committed r285389 (243946@main): <https://commits.webkit.org/243946@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 443443 [details].