Bug 260370 - AX: Relations updates thrash between dirty and clean when multiple deferred id attribute changes are processed
Summary: AX: Relations updates thrash between dirty and clean when multiple deferred i...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tyler Wilcock
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-08-17 16:10 PDT by Tyler Wilcock
Modified: 2023-08-23 09:08 PDT (History)
10 users (show)

See Also:


Attachments
Patch (3.70 KB, patch)
2023-08-17 16:29 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff
Patch (2.95 KB, patch)
2023-08-18 15:13 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff
Patch (2.96 KB, patch)
2023-08-21 09:05 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff
Patch (3.00 KB, patch)
2023-08-21 22:53 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tyler Wilcock 2023-08-17 16:10:40 PDT
...
Comment 1 Radar WebKit Bug Importer 2023-08-17 16:10:51 PDT
<rdar://problem/114052085>
Comment 2 Tyler Wilcock 2023-08-17 16:29:47 PDT
Created attachment 467317 [details]
Patch
Comment 3 Andres Gonzalez 2023-08-18 07:42:32 PDT
(In reply to Tyler Wilcock from comment #2)
> Created attachment 467317 [details]
> Patch

AX: Relations updates thrash between dirty and clean when
 multiple deferred id attribute changes are processed
 https://bugs.webkit.org/show_bug.cgi?id=260370 rdar://problem/114052085

Reviewed by NOBODY (OOPS!).

In AXObjectCache::handleAttributeChange, any change to the `id`
attribute causes AXObjectCache::m_relationsNeedUpdate to become true.

This is problematic when `m_deferredAttributeChange` contains multiple
`id` attribute changes, as we thrash between dirtying m_relationsNeedUpdate,
immediately clearing it as a result of a random `parentObject` call, and
then re-dirtying it.

AG: why paretObject is dirtying the flag?

With this patch, we introduce a mechanism to suppress relations updates
within a defined scope to avoid needlessly re-computing it over and
over.

AG: If the problem is caused by multiple id changes being queued, we can just set a local flag in the method that processes the queue to signal that the relations were already updated. But it sounds like the real cause is the dirtying of the flag when it shouldn't be.
Comment 4 Tyler Wilcock 2023-08-18 15:13:47 PDT
Created attachment 467334 [details]
Patch
Comment 5 Andres Gonzalez 2023-08-21 07:04:09 PDT
(In reply to Tyler Wilcock from comment #4)
> Created attachment 467334 [details]
> Patch

"""
This is problematic when `m_deferredAttributeChange` contains multiple
`id` attribute changes, as we thrash between setting m_relationsNeedUpdate to true,
immediately resetting it to false as a result of a random `parentObject` call, and
then re-dirtying it with the next id attribute change.
"""

Is it worth clarifying why parentObject() is called? The "random" term here is inaccurate. The re-calculation of the relations occur because parentObject() now calls ownerParentObject(), which forces the relations to be computed. I think parentObject() is called in this context because of accessibilityIsIgnored().
Comment 6 Tyler Wilcock 2023-08-21 09:05:49 PDT
Created attachment 467367 [details]
Patch
Comment 7 Tyler Wilcock 2023-08-21 22:53:10 PDT
Created attachment 467381 [details]
Patch
Comment 8 EWS 2023-08-22 12:08:05 PDT
Found 1 new test failure: media/video-remove-insert-repaints.html
Comment 9 Tyler Wilcock 2023-08-22 12:11:09 PDT
I really don't think that's related to this patch. Going to try cq+ again.
Comment 10 EWS 2023-08-22 14:54:43 PDT
Found 1 new test failure: media/video-remove-insert-repaints.html
Comment 11 EWS 2023-08-23 09:08:19 PDT
Committed 267190@main (f8ef167b97d5): <https://commits.webkit.org/267190@main>

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