⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 244107 in webkit


Ignore:
Timestamp:
Apr 10, 2019, 1:01:01 AM (7 years ago)
Author:
Carlos Garcia Campos
Message:

[ATK] Defer the emision of AtkObject::children-changed signal after layout is done
https://bugs.webkit.org/show_bug.cgi?id=187948

Reviewed by Michael Catanzaro.

Source/WebCore:

The signal AtkObject::children-changed is emitted from AXObjectCache::attachWrapper() and
AXObjectCache::detachWrapper(). Both can be called in the middle of a layout, so we need to defer the emission
of the signal after the layout is done, to avoid other atk entry points from being called at that point, since
most of them update the backing store at the beginning.

Fixes: accessibility/children-changed-sends-notification.html

  • accessibility/AXObjectCache.cpp:

(WebCore::AXObjectCache::performDeferredCacheUpdate): Call platformPerformDeferredCacheUpdate().

  • accessibility/AXObjectCache.h:
  • accessibility/atk/AXObjectCacheAtk.cpp:

(WebCore::wrapperParent): Helper to get the AtkObject parent of a given WebKitAccessible.
(WebCore::AXObjectCache::detachWrapper): Add wrapper to m_deferredDetachedWrapperList.
(WebCore::AXObjectCache::attachWrapper): Add object to m_deferredAttachedWrapperObjectList.
(WebCore::AXObjectCache::platformPerformDeferredCacheUpdate): Emit AtkObject::children-changed::add for objects
in m_deferredAttachedWrapperObjectList and AtkObject::children-changed::remove for wrappers in m_deferredDetachedWrapperList.

  • accessibility/ios/AXObjectCacheIOS.mm:

(WebCore::AXObjectCache::platformPerformDeferredCacheUpdate):

  • accessibility/mac/AXObjectCacheMac.mm:

(WebCore::AXObjectCache::platformPerformDeferredCacheUpdate):

  • accessibility/win/AXObjectCacheWin.cpp:

(WebCore::AXObjectCache::platformPerformDeferredCacheUpdate):

  • accessibility/wpe/AXObjectCacheWPE.cpp:

(WebCore::AXObjectCache::platformPerformDeferredCacheUpdate):

LayoutTests:

Remove expectations of accessibility/children-changed-sends-notification.html that passes now.

  • platform/gtk/TestExpectations:
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r244105 r244107  
     12019-04-10  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [ATK] Defer the emision of AtkObject::children-changed signal after layout is done
     4        https://bugs.webkit.org/show_bug.cgi?id=187948
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Remove expectations of accessibility/children-changed-sends-notification.html that passes now.
     9
     10        * platform/gtk/TestExpectations:
     11
    1122019-04-10  Carlos Garcia Campos  <cgarcia@igalia.com>
    213
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r244105 r244107  
    32133213
    32143214webkit.org/b/161583 accessibility/auto-fill-types.html [ Failure ]
    3215 webkit.org/b/161584 accessibility/children-changed-sends-notification.html [ Failure Crash ]
    32163215
    32173216webkit.org/b/161587 css3/font-feature-settings-rendering.html [ ImageOnlyFailure ]
  • trunk/Source/WebCore/ChangeLog

    r244105 r244107  
     12019-04-10  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [ATK] Defer the emision of AtkObject::children-changed signal after layout is done
     4        https://bugs.webkit.org/show_bug.cgi?id=187948
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        The signal AtkObject::children-changed is emitted from AXObjectCache::attachWrapper() and
     9        AXObjectCache::detachWrapper(). Both can be called in the middle of a layout, so we need to defer the emission
     10        of the signal after the layout is done, to avoid other atk entry points from being called at that point, since
     11        most of them update the backing store at the beginning.
     12
     13        Fixes: accessibility/children-changed-sends-notification.html
     14
     15        * accessibility/AXObjectCache.cpp:
     16        (WebCore::AXObjectCache::performDeferredCacheUpdate): Call platformPerformDeferredCacheUpdate().
     17        * accessibility/AXObjectCache.h:
     18        * accessibility/atk/AXObjectCacheAtk.cpp:
     19        (WebCore::wrapperParent): Helper to get the AtkObject parent of a given WebKitAccessible.
     20        (WebCore::AXObjectCache::detachWrapper): Add wrapper to m_deferredDetachedWrapperList.
     21        (WebCore::AXObjectCache::attachWrapper): Add object to m_deferredAttachedWrapperObjectList.
     22        (WebCore::AXObjectCache::platformPerformDeferredCacheUpdate): Emit AtkObject::children-changed::add for objects
     23        in m_deferredAttachedWrapperObjectList and AtkObject::children-changed::remove for wrappers in m_deferredDetachedWrapperList.
     24        * accessibility/ios/AXObjectCacheIOS.mm:
     25        (WebCore::AXObjectCache::platformPerformDeferredCacheUpdate):
     26        * accessibility/mac/AXObjectCacheMac.mm:
     27        (WebCore::AXObjectCache::platformPerformDeferredCacheUpdate):
     28        * accessibility/win/AXObjectCacheWin.cpp:
     29        (WebCore::AXObjectCache::platformPerformDeferredCacheUpdate):
     30        * accessibility/wpe/AXObjectCacheWPE.cpp:
     31        (WebCore::AXObjectCache::platformPerformDeferredCacheUpdate):
     32
    1332019-04-10  Carlos Garcia Campos  <cgarcia@igalia.com>
    234
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r243163 r244107  
    29202920        handleFocusedUIElementChanged(deferredFocusedChangeContext.first, deferredFocusedChangeContext.second);
    29212921    m_deferredFocusedNodeChange.clear();
     2922
     2923    platformPerformDeferredCacheUpdate();
    29222924}
    29232925   
  • trunk/Source/WebCore/accessibility/AXObjectCache.h

    r241321 r244107  
    4040#include <wtf/ListHashSet.h>
    4141#include <wtf/RefPtr.h>
     42
     43#if PLATFORM(GTK)
     44#include <wtf/glib/GRefPtr.h>
     45#endif
    4246
    4347namespace WebCore {
     
    356360    void platformHandleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFocusedNode);
    357361
     362    void platformPerformDeferredCacheUpdate();
     363
    358364#if PLATFORM(COCOA)
    359365    void postTextStateChangePlatformNotification(AccessibilityObject*, const AXTextStateChangeIntent&, const VisibleSelection&);
     
    477483    bool m_isSynchronizingSelection { false };
    478484    bool m_performingDeferredCacheUpdate { false };
     485
     486#if PLATFORM(GTK)
     487    ListHashSet<RefPtr<AccessibilityObject>> m_deferredAttachedWrapperObjectList;
     488    ListHashSet<GRefPtr<AccessibilityObjectWrapper>> m_deferredDetachedWrapperList;
     489#endif
    479490};
    480491
  • trunk/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp

    r243970 r244107  
    3737namespace WebCore {
    3838
     39static AtkObject* wrapperParent(WebKitAccessible* wrapper)
     40{
     41    // Look for the right object to emit the signal from, but using the implementation
     42    // of atk_object_get_parent from AtkObject class (which uses a cached pointer if set)
     43    // since the accessibility hierarchy in WebCore will no longer be navigable.
     44    gpointer webkitAccessibleClass = g_type_class_peek_parent(WEBKIT_ACCESSIBLE_GET_CLASS(wrapper));
     45    gpointer atkObjectClass = g_type_class_peek_parent(webkitAccessibleClass);
     46    AtkObject* atkParent = ATK_OBJECT_CLASS(atkObjectClass)->get_parent(ATK_OBJECT(wrapper));
     47    // We don't want to emit any signal from an object outside WebKit's world.
     48    return WEBKIT_IS_ACCESSIBLE(atkParent) ? atkParent : nullptr;
     49}
     50
    3951void AXObjectCache::detachWrapper(AccessibilityObject* obj, AccessibilityDetachmentType detachmentType)
    4052{
     
    4456    // If an object is being detached NOT because of the AXObjectCache being destroyed,
    4557    // then it's being removed from the accessibility tree and we should emit a signal.
    46     if (detachmentType != AccessibilityDetachmentType::CacheDestroyed) {
    47         if (obj->document()) {
    48             // Look for the right object to emit the signal from, but using the implementation
    49             // of atk_object_get_parent from AtkObject class (which uses a cached pointer if set)
    50             // since the accessibility hierarchy in WebCore will no longer be navigable.
    51             gpointer webkitAccessibleClass = g_type_class_peek_parent(WEBKIT_ACCESSIBLE_GET_CLASS(wrapper));
    52             gpointer atkObjectClass = g_type_class_peek_parent(webkitAccessibleClass);
    53             AtkObject* atkParent = ATK_OBJECT_CLASS(atkObjectClass)->get_parent(ATK_OBJECT(wrapper));
    54 
    55             // We don't want to emit any signal from an object outside WebKit's world.
    56             if (WEBKIT_IS_ACCESSIBLE(atkParent)) {
    57                 // The accessibility hierarchy is already invalid, so the parent-children relationships
    58                 // in the AccessibilityObject tree are not there anymore, so we can't know the offset.
    59                 g_signal_emit_by_name(atkParent, "children-changed::remove", -1, wrapper);
    60             }
    61         }
    62     }
     58    if (detachmentType != AccessibilityDetachmentType::CacheDestroyed && obj->document() && wrapperParent(wrapper))
     59        m_deferredDetachedWrapperList.add(wrapper);
    6360
    6461    webkitAccessibleDetach(WEBKIT_ACCESSIBLE(wrapper));
     
    8885        return;
    8986
    90     // Don't emit the signal for objects whose parents won't be exposed directly.
    91     AccessibilityObject* coreParent = obj->parentObjectUnignored();
    92     if (!coreParent || coreParent->accessibilityIsIgnoredByDefault())
    93         return;
    94 
    95     // Look for the right object to emit the signal from.
    96     auto* atkParent = coreParent->wrapper();
    97     if (!atkParent)
    98         return;
    99 
    100     size_t index = coreParent->children(false).find(obj);
    101     g_signal_emit_by_name(atkParent, "children-changed::add", index != notFound ? index : -1, wrapper.get());
     87    m_deferredAttachedWrapperObjectList.add(obj);
     88}
     89
     90void AXObjectCache::platformPerformDeferredCacheUpdate()
     91{
     92    for (auto& coreObject : m_deferredAttachedWrapperObjectList) {
     93        auto* wrapper = coreObject->wrapper();
     94        if (!wrapper)
     95            continue;
     96
     97        // Don't emit the signal for objects whose parents won't be exposed directly.
     98        auto* coreParent = coreObject->parentObjectUnignored();
     99        if (!coreParent || coreParent->accessibilityIsIgnoredByDefault())
     100            continue;
     101
     102        // Look for the right object to emit the signal from.
     103        auto* atkParent = coreParent->wrapper();
     104        if (!atkParent)
     105            continue;
     106
     107        size_t index = coreParent->children(false).find(coreObject);
     108        g_signal_emit_by_name(atkParent, "children-changed::add", index != notFound ? index : -1, wrapper);
     109    }
     110    m_deferredAttachedWrapperObjectList.clear();
     111
     112    for (auto& wrapper : m_deferredDetachedWrapperList) {
     113        if (auto* atkParent = wrapperParent(wrapper.get())) {
     114            // The accessibility hierarchy is already invalid, so the parent-children relationships
     115            // in the AccessibilityObject tree are not there anymore, so we can't know the offset.
     116            g_signal_emit_by_name(atkParent, "children-changed::remove", -1, wrapper.get());
     117        }
     118    }
     119    m_deferredDetachedWrapperList.clear();
    102120}
    103121
  • trunk/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm

    r237266 r244107  
    136136{
    137137}
    138    
     138
     139void AXObjectCache::platformPerformDeferredCacheUpdate()
     140{
     141}
     142
    139143}
    140144
  • trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm

    r242714 r244107  
    548548}
    549549
     550void AXObjectCache::platformPerformDeferredCacheUpdate()
     551{
     552}
     553
    550554}
    551555
  • trunk/Source/WebCore/accessibility/win/AXObjectCacheWin.cpp

    r239551 r244107  
    184184}
    185185
     186void AXObjectCache::platformPerformDeferredCacheUpdate()
     187{
     188}
     189
    186190} // namespace WebCore
  • trunk/Source/WebCore/accessibility/wpe/AXObjectCacheWPE.cpp

    r237168 r244107  
    6161}
    6262
     63void AXObjectCache::platformPerformDeferredCacheUpdate()
     64{
     65    notImplemented();
     66}
     67
    6368} // namespace WebCore
    6469
Note: See TracChangeset for help on using the changeset viewer.