Bug 234059 - Decouple AXObjectCache handleChildrenChanged and postNotification.
Summary: Decouple AXObjectCache handleChildrenChanged and postNotification.
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-12-08 18:42 PST by Andres Gonzalez
Modified: 2022-02-13 19:50 PST (History)
11 users (show)

See Also:


Attachments
Patch (6.17 KB, patch)
2021-12-08 19:05 PST, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (6.39 KB, patch)
2021-12-09 18:08 PST, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (14.72 KB, patch)
2021-12-13 17:48 PST, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (5.56 KB, patch)
2021-12-15 19:10 PST, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (8.10 KB, patch)
2022-02-09 11:30 PST, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (8.08 KB, patch)
2022-02-11 06:56 PST, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (8.09 KB, patch)
2022-02-13 13:22 PST, 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-12-08 18:42:05 PST
Decouple AXObjectCache handleChildrenChanged and postNotification.
Comment 1 Radar WebKit Bug Importer 2021-12-08 18:42:44 PST
<rdar://problem/86247404>
Comment 2 Andres Gonzalez 2021-12-08 19:05:31 PST
Created attachment 446484 [details]
Patch
Comment 3 chris fleizach 2021-12-09 11:27:08 PST
Comment on attachment 446484 [details]
Patch

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

> Source/WebCore/ChangeLog:12
> +        notification (postNotification), which causes a doble deferral of these

doble > double

> Source/WebCore/ChangeLog:16
> +        added or removed, before properties in the rsulting objects may be

rsulting > resulting

> Source/WebCore/ChangeLog:17
> +        updated. This patch fixes this problem by making handleChildrenchanged

handleChildrenchanged > handleChildrenChanged

> Source/WebCore/accessibility/AXObjectCache.cpp:995
> +            childrenChanged(parent->parentObject());

question here - if we're going up the parent chain telling things we need to update, do we need to process this subtree any further? if a parent has changed won't it recreate the entire subtree?

> Source/WebCore/accessibility/AXObjectCache.cpp:1801
> +        handleChildrenChanged(*get(element->parentNode()));

we probably want to defer this along with the modal change
or maybe deferModalChange should also implicitly handle children changed on the paren
Comment 4 Andres Gonzalez 2021-12-09 18:08:17 PST
Created attachment 446647 [details]
Patch
Comment 5 Andres Gonzalez 2021-12-09 18:14:05 PST
(In reply to chris fleizach from comment #3)
> Comment on attachment 446484 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=446484&action=review
> 
> > Source/WebCore/ChangeLog:12
> > +        notification (postNotification), which causes a doble deferral of these
> 
> doble > double

Fixed.
> 
> > Source/WebCore/ChangeLog:16
> > +        added or removed, before properties in the rsulting objects may be
> 
> rsulting > resulting

Fixed.
> 
> > Source/WebCore/ChangeLog:17
> > +        updated. This patch fixes this problem by making handleChildrenchanged
> 
> handleChildrenchanged > handleChildrenChanged

Fixed.
> 
> > Source/WebCore/accessibility/AXObjectCache.cpp:995
> > +            childrenChanged(parent->parentObject());
> 
> question here - if we're going up the parent chain telling things we need to
> update, do we need to process this subtree any further? if a parent has
> changed won't it recreate the entire subtree?

You're right. I thought we might need to go up the entire chain checking whether isIgnored had change, but it doesn't seem to be necessary, at least for the test cases we have.
> 
> > Source/WebCore/accessibility/AXObjectCache.cpp:1801
> > +        handleChildrenChanged(*get(element->parentNode()));
> 
> we probably want to defer this along with the modal change
> or maybe deferModalChange should also implicitly handle children changed on
> the paren

Done. thanks!
Comment 6 Andres Gonzalez 2021-12-13 17:48:48 PST
Created attachment 447090 [details]
Patch
Comment 7 Andres Gonzalez 2021-12-15 19:10:16 PST
Created attachment 447314 [details]
Patch
Comment 8 Andres Gonzalez 2022-02-09 11:30:06 PST
Created attachment 451417 [details]
Patch
Comment 9 Tyler Wilcock 2022-02-09 11:54:55 PST
Comment on attachment 451417 [details]
Patch

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

> Source/WebCore/accessibility/AXObjectCache.cpp:1049
> +    postPlatformNotification(&object, AXChildrenChanged);

Do we still need to post this notification since we now immediately handle this children changed event by calling AXObjectCache::childrenChanged and AXObjectCache::updateIsolatedTree?
Comment 10 Andres Gonzalez 2022-02-09 12:25:22 PST
(In reply to Tyler Wilcock from comment #9)
> Comment on attachment 451417 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=451417&action=review
> 
> > Source/WebCore/accessibility/AXObjectCache.cpp:1049
> > +    postPlatformNotification(&object, AXChildrenChanged);
> 
> Do we still need to post this notification since we now immediately handle
> this children changed event by calling AXObjectCache::childrenChanged and
> AXObjectCache::updateIsolatedTree?

The naming isn't great here, but postPlatformNotification actually just fires the platform notification, as opposed to postNotification which is the one that causes changes in the state of the live tree and consequently in the isolated tree. That's why I see this as a decoupling between the handling the notification which means updating the trees state, and once that is done, notifying clients that something changed, which is postPlatformNotification.
Comment 11 Tyler Wilcock 2022-02-09 12:28:02 PST
(In reply to Andres Gonzalez from comment #10)
> (In reply to Tyler Wilcock from comment #9)
> > Comment on attachment 451417 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=451417&action=review
> > 
> > > Source/WebCore/accessibility/AXObjectCache.cpp:1049
> > > +    postPlatformNotification(&object, AXChildrenChanged);
> > 
> > Do we still need to post this notification since we now immediately handle
> > this children changed event by calling AXObjectCache::childrenChanged and
> > AXObjectCache::updateIsolatedTree?
> 
> The naming isn't great here, but postPlatformNotification actually just
> fires the platform notification, as opposed to postNotification which is the
> one that causes changes in the state of the live tree and consequently in
> the isolated tree. That's why I see this as a decoupling between the
> handling the notification which means updating the trees state, and once
> that is done, notifying clients that something changed, which is
> postPlatformNotification.
Ahh, got it. Nice, yeah this seems like a good change.
Comment 12 chris fleizach 2022-02-10 17:16:08 PST
Comment on attachment 451417 [details]
Patch

looks good assuming tests pass now
Comment 13 Tyler Wilcock 2022-02-10 19:50:16 PST
I think somebody clicked the "Retry failed tests" button, but that won't include the latest changes from trunk that speed up the test. A new patch might have to be uploaded.
Comment 14 Andres Gonzalez 2022-02-11 06:56:23 PST
Created attachment 451687 [details]
Patch
Comment 15 Andres Gonzalez 2022-02-13 13:22:09 PST
Created attachment 451840 [details]
Patch
Comment 16 EWS 2022-02-13 19:50:11 PST
Committed r289723 (247208@main): <https://commits.webkit.org/247208@main>

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