• Aaron Leventhal's avatar
    Avoid stale hypertext when non-text children change · 0588cb28
    Aaron Leventhal authored
    Hypertext is updated when a node changes, or on a parent of a
    textnode that changes. There are some cases where the hypertexts
    do not match the available children.
    
    In some cases this results in returning a null hyperlink, because
    cached data in AXHyperText was stale. A DumpWithoutCrashing() was
    added to help narrow these situations down, and the situation occurs
    quite often.
    
    The problem is that when AXPlatformNodeBase::UpdateComputedHypertext()
    is called, IsLeaf() is not updated nor are the platform children.
    This occurs because although the SendPendingAccessibiityEvents()
    has sent an updated root, the change for the root is not merged
    with other changes (TreeUpdatesCanBeMerged() returns false for any
    root update, even if it has the same id as the previous root).
    This causes all updates to be processed separately. When the root is
    processed, other updates have not yet occurred and the root object
    still appears to be a leaf.
    
    Other possibilities to fix this:
    - Do not send root_id in an update unless it's actually a new root.
    This may not catch all cases of the issue, but perhaps it's a good
    thing to do anyway.
    - Allow updates to be merged, even when there is a change on the root.
    - Compute hypertext on demand and memoize, so that it's computed after
    all atomic updates are finished
    - Instead of calling OnAtomicUpdateFinished() at the end of
    AXTree::Unserialize(), return the updates back to the caller and allow
    the caller to collect the updates and process a single call to
    OnAtomicUpdateFinished();
    With any of these alternate approaches, it should be possible to
    remove the logic to ensure hypertext updates on parents in
    CollectChangedNodesAndParentsForAtomicUpdate(), because the
    renderer already sends parents nodes to the serializer
    with ChildrenChanged or TextChanged().
    
    Bug: 1157731
    Change-Id: I4e9eefa9b0f90d80daa1b7db2305ca92caaf32b7
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2587371Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
    Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#836717}
    0588cb28
move-child-hypertext-2.html 513 Bytes