Bug 231766 - Calls to AXCoreObject::widget() have to be dispatch to the main thread in isolated tree mode.
Summary: Calls to AXCoreObject::widget() have to be dispatch to the main thread in iso...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andres Gonzalez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-10-14 13:16 PDT by Andres Gonzalez
Modified: 2021-10-15 12:59 PDT (History)
10 users (show)

See Also:


Attachments
Patch (13.62 KB, patch)
2021-10-14 13:34 PDT, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (13.40 KB, patch)
2021-10-14 14:27 PDT, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (13.46 KB, patch)
2021-10-14 14:41 PDT, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (13.38 KB, patch)
2021-10-15 05:27 PDT, Andres Gonzalez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andres Gonzalez 2021-10-14 13:16:33 PDT
Calls to AXCoreObject::widget() have to be dispatch to the main thread in isolated tree mode.
Comment 1 Radar WebKit Bug Importer 2021-10-14 13:16:44 PDT
<rdar://problem/84271039>
Comment 2 Andres Gonzalez 2021-10-14 13:34:06 PDT
Created attachment 441269 [details]
Patch
Comment 3 chris fleizach 2021-10-14 14:00:02 PDT
Comment on attachment 441269 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=441269&action=review

> Source/WebCore/accessibility/AccessibilityNodeObject.cpp:804
> +

undo

> Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:1680
> +            return @[child];

should we return nil if we don't have a child here?
Comment 4 chris fleizach 2021-10-14 14:05:48 PDT
Comment on attachment 441269 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=441269&action=review

> Source/WebCore/ChangeLog:13
> +        safe and it is created on the main thread. To avoid this problem, We

We > we

> Source/WebCore/ChangeLog:14
> +        have to dispatch those calls to the main thread. Since widget() is call very often now, for every request of the children of a leaf node, added

is call > is called
Comment 5 Andres Gonzalez 2021-10-14 14:19:58 PDT
(In reply to chris fleizach from comment #3)
> Comment on attachment 441269 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=441269&action=review
> 
> > Source/WebCore/accessibility/AccessibilityNodeObject.cpp:804
> > +
> 
> undo

Done.
> 
> > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:1680
> > +            return @[child];
> 
> should we return nil if we don't have a child here?

I don't believe so because other kinds of Widgets liked ScrollViews and Scrollbars may not have an accessibilityObject but can still return not nil in 

    ALLOW_DEPRECATED_DECLARATIONS_BEGIN
    return [backingObject->platformWidget() accessibilityAttributeValue:NSAccessibilityChildrenAttribute];
    ALLOW_DEPRECATED_DECLARATIONS_END

I think accessibilityObject is only for plug-ins, right?
Comment 6 Andres Gonzalez 2021-10-14 14:22:04 PDT
(In reply to chris fleizach from comment #4)
> Comment on attachment 441269 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=441269&action=review
> 
> > Source/WebCore/ChangeLog:13
> > +        safe and it is created on the main thread. To avoid this problem, We
> 
> We > we
> 
> > Source/WebCore/ChangeLog:14
> > +        have to dispatch those calls to the main thread. Since widget() is call very often now, for every request of the children of a leaf node, added
> 
> is call > is called

Fixed both, cannot get my grammar straight today :-).
Comment 7 chris fleizach 2021-10-14 14:24:04 PDT
Comment on attachment 441269 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=441269&action=review

>>> Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:1680
>>> +            return @[child];
>> 
>> should we return nil if we don't have a child here?
> 
> I don't believe so because other kinds of Widgets liked ScrollViews and Scrollbars may not have an accessibilityObject but can still return not nil in 
> 
>     ALLOW_DEPRECATED_DECLARATIONS_BEGIN
>     return [backingObject->platformWidget() accessibilityAttributeValue:NSAccessibilityChildrenAttribute];
>     ALLOW_DEPRECATED_DECLARATIONS_END
> 
> I think accessibilityObject is only for plug-ins, right?

I was thinking  if isWidget() returns true, but we don't get a widget, does that mean a failure case that we should return from
Comment 8 Andres Gonzalez 2021-10-14 14:27:04 PDT
Created attachment 441282 [details]
Patch

Addresses Chris's comments.
Comment 9 Andres Gonzalez 2021-10-14 14:41:51 PDT
Created attachment 441288 [details]
Patch

Modified renderWidgetChildren
Comment 10 Andres Gonzalez 2021-10-14 14:46:35 PDT
(In reply to chris fleizach from comment #7)
> Comment on attachment 441269 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=441269&action=review
> 
> >>> Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:1680
> >>> +            return @[child];
> >> 
> >> should we return nil if we don't have a child here?
> > 
> > I don't believe so because other kinds of Widgets liked ScrollViews and Scrollbars may not have an accessibilityObject but can still return not nil in 
> > 
> >     ALLOW_DEPRECATED_DECLARATIONS_BEGIN
> >     return [backingObject->platformWidget() accessibilityAttributeValue:NSAccessibilityChildrenAttribute];
> >     ALLOW_DEPRECATED_DECLARATIONS_END
> > 
> > I think accessibilityObject is only for plug-ins, right?
> 
> I was thinking  if isWidget() returns true, but we don't get a widget, does
> that mean a failure case that we should return from

Re-wrote it slightly different that it may be clearer. renderWidgetChildren returns nil for everything that is not a widget. If it is a widget, then we try first the Widget's accessibilityObject, which should be not nil for plug-ins. If that is nil, then we try the platformWidget's AXChildren attribute, which may be not nil for ScrollViews and Scrollbars.
Comment 11 Andres Gonzalez 2021-10-15 05:27:49 PDT
Created attachment 441366 [details]
Patch

Removing leftover }.
Comment 12 EWS 2021-10-15 12:59:39 PDT
Committed r284266 (243074@main): <https://commits.webkit.org/243074@main>

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