Changeset 262073 in webkit


Ignore:
Timestamp:
May 22, 2020 2:03:59 PM (4 years ago)
Author:
Andres Gonzalez
Message:

Updates to the isolated tree must happen before posting notifications to clients.
https://bugs.webkit.org/show_bug.cgi?id=212266

Reviewed by Chris Fleizach.

Multiple tests.

In AXObjectCache::notificationPostTimerFired we were updating the
isolated tree after the notifications were posted to the platform
clients. This caused that in some cases when the client requested info
as the result of those notifications, the isolated tree was out-of-date.
In this patch updateIsolatedTree is called before notifying platform clients.

  • accessibility/AXObjectCache.cpp:

(WebCore::AXObjectCache::notificationPostTimerFired):
(WebCore::AXObjectCache::postNotification):
(WebCore::AXObjectCache::postTextStateChangeNotification):
(WebCore::AXObjectCache::updateIsolatedTree):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r262070 r262073  
     12020-05-22  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Updates to the isolated tree must happen before posting notifications to clients.
     4        https://bugs.webkit.org/show_bug.cgi?id=212266
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Multiple tests.
     9
     10        In AXObjectCache::notificationPostTimerFired we were updating the
     11        isolated tree after the notifications were posted to the platform
     12        clients. This caused that in some cases when the client requested info
     13        as the result of those notifications, the isolated tree was out-of-date.
     14        In this patch updateIsolatedTree is called before notifying platform clients.
     15
     16        * accessibility/AXObjectCache.cpp:
     17        (WebCore::AXObjectCache::notificationPostTimerFired):
     18        (WebCore::AXObjectCache::postNotification):
     19        (WebCore::AXObjectCache::postTextStateChangeNotification):
     20        (WebCore::AXObjectCache::updateIsolatedTree):
     21
    1222020-05-22  Sam Weinig  <weinig@apple.com>
    223
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r261832 r262073  
    10141014void AXObjectCache::notificationPostTimerFired()
    10151015{
     1016    AXTRACE("AXObjectCache::notificationPostTimerFired");
    10161017    // During LayoutTests, accessibility may be disabled between the time the notifications are queued and the timer fires.
    10171018    // Thus check here and return if accessibility is disabled.
     
    10291030    auto notifications = WTFMove(m_notificationsToPost);
    10301031
     1032    // Filter out the notifications that are not going to be posted to platform clients.
     1033    Vector<std::pair<RefPtr<AXCoreObject>, AXNotification>> notificationsToPost;
     1034    notificationsToPost.reserveCapacity(notifications.size());
    10311035    for (const auto& note : notifications) {
    1032         AXCoreObject* obj = note.first.get();
    1033         if (!obj->objectID())
     1036        ASSERT(note.first);
     1037        if (!note.first->objectID() || !note.first->axObjectCache())
    10341038            continue;
    10351039
    1036         if (!obj->axObjectCache())
    1037             continue;
    1038        
    10391040#ifndef NDEBUG
    10401041        // Make sure none of the render views are in the process of being layed out.
    10411042        // Notifications should only be sent after the renderer has finished
    1042         if (is<AccessibilityRenderObject>(*obj)) {
    1043             if (auto* renderer = downcast<AccessibilityRenderObject>(*obj).renderer())
     1043        if (is<AccessibilityRenderObject>(*note.first)) {
     1044            if (auto* renderer = downcast<AccessibilityRenderObject>(*note.first).renderer())
    10441045                ASSERT(!renderer->view().frameView().layoutContext().layoutState());
    10451046        }
    10461047#endif
    10471048
    1048         AXNotification notification = note.second;
    1049        
    10501049        // Ensure that this menu really is a menu. We do this check here so that we don't have to create
    10511050        // the axChildren when the menu is marked as opening.
    1052         if (notification == AXMenuOpened) {
    1053             obj->updateChildrenIfNecessary();
    1054             if (obj->roleValue() != AccessibilityRole::Menu)
     1051        if (note.second == AXMenuOpened) {
     1052            note.first->updateChildrenIfNecessary();
     1053            if (note.first->roleValue() != AccessibilityRole::Menu)
    10551054                continue;
    10561055        }
    1057        
    1058         if (notification == AXChildrenChanged && obj->parentObjectIfExists() && obj->lastKnownIsIgnoredValue() != obj->accessibilityIsIgnored())
    1059             childrenChanged(obj->parentObject());
    1060 
    1061         postPlatformNotification(obj, notification);
     1056
     1057        if (note.second == AXChildrenChanged && note.first->parentObjectIfExists()
     1058            && note.first->lastKnownIsIgnoredValue() != note.first->accessibilityIsIgnored())
     1059            childrenChanged(note.first->parentObject());
     1060
     1061        notificationsToPost.append(note);
    10621062    }
    10631063
    10641064#if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
    1065     updateIsolatedTree(notifications);
     1065    updateIsolatedTree(notificationsToPost);
    10661066#endif
     1067
     1068    for (const auto& note : notificationsToPost)
     1069        postPlatformNotification(note.first.get(), note.second);
    10671070}
    10681071
     
    13881391void AXObjectCache::postTextStateChangeNotification(AccessibilityObject* object, const AXTextStateChangeIntent& intent, const VisibleSelection& selection)
    13891392{
     1393    AXTRACE("AXObjectCache::postTextStateChangeNotification");
    13901394    stopCachingComputedObjectAttributes();
    13911395
     
    14221426void AXObjectCache::postTextStateChangeNotification(Node* node, AXTextEditType type, const String& text, const VisiblePosition& position)
    14231427{
     1428    AXTRACE("AXObjectCache::postTextStateChangeNotification");
    14241429    if (!node || type == AXTextEditTypeUnknown)
    14251430        return;
     
    31393144    AXLOG(*this);
    31403145
    3141     if (!m_pageID)
     3146    if (!m_pageID || object.objectID() == InvalidAXID)
    31423147        return;
    31433148
     
    31493154    case AXCheckedStateChanged:
    31503155    case AXSelectedTextChanged:
    3151     case AXValueChanged: {
    3152         if (object.objectID() != InvalidAXID)
    3153             tree->updateNode(object);
     3156    case AXValueChanged:
     3157        tree->updateNode(object);
    31543158        break;
    3155     }
     3159    case AXChildrenChanged:
     3160        tree->updateChildren(object);
     3161        break;
    31563162    default:
    31573163        break;
Note: See TracChangeset for help on using the changeset viewer.