Changeset 243928 in webkit


Ignore:
Timestamp:
Apr 5, 2019 12:35:24 AM (5 years ago)
Author:
Carlos Garcia Campos
Message:

[ATK] Use a smart pointer for AccessibilityObject wrapper and remove GTK specific code
https://bugs.webkit.org/show_bug.cgi?id=196593
<rdar://problem/49599153>

Reviewed by Michael Catanzaro.

Source/WebCore:

We have specific code for GTK to get/set the wrapper only because we don't use smart pointers. Also use
WebKitAccessible as AccessibilityObjectWrapper instead of generic AtkObject, to enforce wrappers to be
WebKitAccessible instances. This requires a few casts to AtkObject.

  • accessibility/AccessibilityObject.h:

(WebCore::AccessibilityObject::setWrapper):

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

(WebCore::AXObjectCache::detachWrapper):
(WebCore::AXObjectCache::attachWrapper):
(WebCore::notifyChildrenSelectionChange):
(WebCore::AXObjectCache::postPlatformNotification):
(WebCore::AXObjectCache::nodeTextChangePlatformNotification):
(WebCore::AXObjectCache::frameLoadingEventPlatformNotification):
(WebCore::AXObjectCache::platformHandleFocusedUIElementChanged):

  • accessibility/atk/AccessibilityObjectAtk.cpp:
  • accessibility/atk/WebKitAccessibleInterfaceComponent.cpp:

(webkitAccessibleComponentRefAccessibleAtPoint):

  • accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp:

(webkitAccessibleHypertextGetLink):
(webkitAccessibleHypertextGetNLinks):

  • accessibility/atk/WebKitAccessibleInterfaceSelection.cpp:

(webkitAccessibleSelectionRefSelection):

  • accessibility/atk/WebKitAccessibleInterfaceTable.cpp:

(webkitAccessibleTableRefAt):
(webkitAccessibleTableGetColumnHeader):
(webkitAccessibleTableGetRowHeader):
(webkitAccessibleTableGetCaption):

  • accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp:

(convertToGPtrArray):
(webkitAccessibleTableCellGetTable):

  • accessibility/atk/WebKitAccessibleInterfaceText.cpp:

(accessibilityObjectLength):

  • accessibility/atk/WebKitAccessibleWrapperAtk.cpp:

(setAtkRelationSetFromCoreObject):
(atkParentOfRootObject):
(webkitAccessibleGetParent):
(webkitAccessibleRefChild):
(isTextWithCaret):

  • editing/atk/FrameSelectionAtk.cpp:

(WebCore::emitTextSelectionChange):
(WebCore::maybeEmitTextFocusChange):

Source/WebKit:

  • WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:

(accessibilityRootObjectWrapper): Cast wrapper() as AtkObject.

Location:
trunk/Source
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r243926 r243928  
     12019-04-05  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [ATK] Use a smart pointer for AccessibilityObject wrapper and remove GTK specific code
     4        https://bugs.webkit.org/show_bug.cgi?id=196593
     5        <rdar://problem/49599153>
     6
     7        Reviewed by Michael Catanzaro.
     8
     9        We have specific code for GTK to get/set the wrapper only because we don't use smart pointers. Also use
     10        WebKitAccessible as AccessibilityObjectWrapper instead of generic AtkObject, to enforce wrappers to be
     11        WebKitAccessible instances. This requires a few casts to AtkObject.
     12
     13        * accessibility/AccessibilityObject.h:
     14        (WebCore::AccessibilityObject::setWrapper):
     15        * accessibility/AccessibilityObjectInterface.h:
     16        * accessibility/atk/AXObjectCacheAtk.cpp:
     17        (WebCore::AXObjectCache::detachWrapper):
     18        (WebCore::AXObjectCache::attachWrapper):
     19        (WebCore::notifyChildrenSelectionChange):
     20        (WebCore::AXObjectCache::postPlatformNotification):
     21        (WebCore::AXObjectCache::nodeTextChangePlatformNotification):
     22        (WebCore::AXObjectCache::frameLoadingEventPlatformNotification):
     23        (WebCore::AXObjectCache::platformHandleFocusedUIElementChanged):
     24        * accessibility/atk/AccessibilityObjectAtk.cpp:
     25        * accessibility/atk/WebKitAccessibleInterfaceComponent.cpp:
     26        (webkitAccessibleComponentRefAccessibleAtPoint):
     27        * accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp:
     28        (webkitAccessibleHypertextGetLink):
     29        (webkitAccessibleHypertextGetNLinks):
     30        * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp:
     31        (webkitAccessibleSelectionRefSelection):
     32        * accessibility/atk/WebKitAccessibleInterfaceTable.cpp:
     33        (webkitAccessibleTableRefAt):
     34        (webkitAccessibleTableGetColumnHeader):
     35        (webkitAccessibleTableGetRowHeader):
     36        (webkitAccessibleTableGetCaption):
     37        * accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp:
     38        (convertToGPtrArray):
     39        (webkitAccessibleTableCellGetTable):
     40        * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
     41        (accessibilityObjectLength):
     42        * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
     43        (setAtkRelationSetFromCoreObject):
     44        (atkParentOfRootObject):
     45        (webkitAccessibleGetParent):
     46        (webkitAccessibleRefChild):
     47        (isTextWithCaret):
     48        * editing/atk/FrameSelectionAtk.cpp:
     49        (WebCore::emitTextSelectionChange):
     50        (WebCore::maybeEmitTextFocusChange):
     51
    1522019-04-04  Simon Fraser  <simon.fraser@apple.com>
    253
  • trunk/Source/WebCore/accessibility/AccessibilityObject.h

    r243603 r243928  
    4646#if PLATFORM(COCOA)
    4747#include <wtf/RetainPtr.h>
     48#endif
     49
     50#if PLATFORM(GTK)
     51#include <wtf/glib/GRefPtr.h>
    4852#endif
    4953
     
    935939    bool isDOMHidden() const;
    936940    bool isHidden() const { return isAXHidden() || isDOMHidden(); }
    937    
     941
    938942#if HAVE(ACCESSIBILITY)
    939 #if PLATFORM(GTK)
    940     AccessibilityObjectWrapper* wrapper() const override;
    941     void setWrapper(AccessibilityObjectWrapper*);
    942 #else
    943943    AccessibilityObjectWrapper* wrapper() const override { return m_wrapper.get(); }
    944     void setWrapper(AccessibilityObjectWrapper* wrapper)
    945     {
    946         m_wrapper = wrapper;
    947     }
    948 #endif
    949 #endif
    950    
     944    void setWrapper(AccessibilityObjectWrapper* wrapper) { m_wrapper = wrapper; }
     945#endif
     946
    951947#if PLATFORM(COCOA)
    952948    void overrideAttachmentParent(AccessibilityObject* parent);
     
    10511047    COMPtr<AccessibilityObjectWrapper> m_wrapper;
    10521048#elif PLATFORM(GTK)
    1053     AtkObject* m_wrapper { nullptr };
     1049    GRefPtr<WebKitAccessible> m_wrapper;
    10541050#elif PLATFORM(WPE)
    10551051    RefPtr<AccessibilityObjectWrapper> m_wrapper;
  • trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h

    r241989 r243928  
    3838typedef WebAccessibilityObjectWrapper AccessibilityObjectWrapper;
    3939#elif PLATFORM(GTK)
    40 typedef struct _AtkObject AtkObject;
    41 typedef struct _AtkObject AccessibilityObjectWrapper;
     40typedef struct _WebKitAccessible WebKitAccessible;
     41typedef struct _WebKitAccessible AccessibilityObjectWrapper;
    4242#elif PLATFORM(WPE)
    4343class AccessibilityObjectWrapper : public RefCounted<AccessibilityObjectWrapper> { };
  • trunk/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp

    r243864 r243928  
    3939void AXObjectCache::detachWrapper(AccessibilityObject* obj, AccessibilityDetachmentType detachmentType)
    4040{
    41     AtkObject* wrapper = obj->wrapper();
     41    auto* wrapper = obj->wrapper();
    4242    ASSERT(wrapper);
    4343
     
    6767void AXObjectCache::attachWrapper(AccessibilityObject* obj)
    6868{
    69     AtkObject* atkObj = ATK_OBJECT(webkitAccessibleNew(obj));
    70     obj->setWrapper(atkObj);
    71     g_object_unref(atkObj);
     69    GRefPtr<WebKitAccessible> wrapper = adoptGRef(webkitAccessibleNew(obj));
     70    obj->setWrapper(wrapper.get());
    7271
    7372    // If an object is being attached and we are not in the middle of a layout update, then
     
    9594
    9695    // Look for the right object to emit the signal from.
    97     AtkObject* atkParent = coreParent->wrapper();
     96    auto* atkParent = coreParent->wrapper();
    9897    if (!atkParent)
    9998        return;
    10099
    101100    size_t index = coreParent->children(false).find(obj);
    102     g_signal_emit_by_name(atkParent, "children-changed::add", index != notFound ? index : -1, atkObj);
     101    g_signal_emit_by_name(atkParent, "children-changed::add", index != notFound ? index : -1, wrapper.get());
    103102}
    104103
     
    169168        oldFocusedObject.get() = nullptr;
    170169
    171     AtkObject* axItem = item ? item->wrapper() : nullptr;
    172     AtkObject* axOldFocusedObject = oldFocusedObject.get() ? oldFocusedObject.get()->wrapper() : nullptr;
     170    WebKitAccessible* axItem = item ? item->wrapper() : nullptr;
     171    WebKitAccessible* axOldFocusedObject = oldFocusedObject.get() ? oldFocusedObject.get()->wrapper() : nullptr;
    173172
    174173    // Old focused object just lost focus, so emit the events.
    175174    if (axOldFocusedObject && axItem != axOldFocusedObject) {
    176175        g_signal_emit_by_name(axOldFocusedObject, "focus-event", false);
    177         atk_object_notify_state_change(axOldFocusedObject, ATK_STATE_FOCUSED, false);
     176        atk_object_notify_state_change(ATK_OBJECT(axOldFocusedObject), ATK_STATE_FOCUSED, false);
    178177    }
    179178
     
    181180    if (axItem) {
    182181        bool isSelected = item->isSelected();
    183         atk_object_notify_state_change(axItem, ATK_STATE_SELECTED, isSelected);
     182        atk_object_notify_state_change(ATK_OBJECT(axItem), ATK_STATE_SELECTED, isSelected);
    184183        // When the selection changes in a collapsed widget such as a combo box
    185184        // whose child menu is not showing, that collapsed widget retains focus.
    186185        if (!object->isCollapsed()) {
    187186            g_signal_emit_by_name(axItem, "focus-event", isSelected);
    188             atk_object_notify_state_change(axItem, ATK_STATE_FOCUSED, isSelected);
     187            atk_object_notify_state_change(ATK_OBJECT(axItem), ATK_STATE_FOCUSED, isSelected);
    189188        }
    190189    }
     
    197196void AXObjectCache::postPlatformNotification(AccessibilityObject* coreObject, AXNotification notification)
    198197{
    199     AtkObject* axObject = coreObject->wrapper();
     198    auto* axObject = ATK_OBJECT(coreObject->wrapper());
    200199    if (!axObject)
    201200        return;
     
    232231#endif
    233232
    234             g_signal_emit_by_name(ATK_OBJECT(axObject), "property-change::accessible-value", &propertyValues, NULL);
     233            g_signal_emit_by_name(axObject, "property-change::accessible-value", &propertyValues, NULL);
    235234        }
    236235        break;
     
    300299        return;
    301300
    302     AtkObject* wrapper = parentObject->wrapper();
     301    auto* wrapper = parentObject->wrapper();
    303302    if (!wrapper || !ATK_IS_TEXT(wrapper))
    304303        return;
     
    350349        return;
    351350
    352     AtkObject* axObject = object->wrapper();
     351    auto* axObject = ATK_OBJECT(object->wrapper());
    353352    if (!axObject || !ATK_IS_DOCUMENT(axObject))
    354353        return;
     
    377376    RefPtr<AccessibilityObject> oldObject = getOrCreate(oldFocusedNode);
    378377    if (oldObject) {
    379         g_signal_emit_by_name(oldObject->wrapper(), "focus-event", false);
    380         atk_object_notify_state_change(oldObject->wrapper(), ATK_STATE_FOCUSED, false);
     378        auto* axObject = oldObject->wrapper();
     379        g_signal_emit_by_name(axObject, "focus-event", false);
     380        atk_object_notify_state_change(ATK_OBJECT(axObject), ATK_STATE_FOCUSED, false);
    381381    }
    382382    RefPtr<AccessibilityObject> newObject = getOrCreate(newFocusedNode);
    383383    if (newObject) {
    384         g_signal_emit_by_name(newObject->wrapper(), "focus-event", true);
    385         atk_object_notify_state_change(newObject->wrapper(), ATK_STATE_FOCUSED, true);
     384        auto* axObject = newObject->wrapper();
     385        g_signal_emit_by_name(axObject, "focus-event", true);
     386        atk_object_notify_state_change(ATK_OBJECT(axObject), ATK_STATE_FOCUSED, true);
    386387    }
    387388}
  • trunk/Source/WebCore/accessibility/atk/AccessibilityObjectAtk.cpp

    r225117 r243928  
    157157}
    158158
    159 AccessibilityObjectWrapper* AccessibilityObject::wrapper() const
    160 {
    161     return m_wrapper;
    162 }
    163 
    164 void AccessibilityObject::setWrapper(AccessibilityObjectWrapper* wrapper)
    165 {
    166     if (wrapper == m_wrapper)
    167         return;
    168 
    169     if (m_wrapper)
    170         g_object_unref(m_wrapper);
    171 
    172     m_wrapper = wrapper;
    173 
    174     if (m_wrapper)
    175         g_object_ref(m_wrapper);
    176 }
    177 
    178159bool AccessibilityObject::allowsTextRanges() const
    179160{
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceComponent.cpp

    r241321 r243928  
    8282        return 0;
    8383    g_object_ref(target->wrapper());
    84     return target->wrapper();
     84    return ATK_OBJECT(target->wrapper());
    8585}
    8686
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp

    r164428 r243928  
    5050        AccessibilityObject* coreChild = child.get();
    5151        if (!coreChild->accessibilityIsIgnored()) {
    52             AtkObject* axObject = coreChild->wrapper();
     52            auto* axObject = coreChild->wrapper();
    5353            if (!axObject || !ATK_IS_HYPERLINK_IMPL(axObject))
    5454                continue;
     
    7575        AccessibilityObject* coreChild = child.get();
    7676        if (!coreChild->accessibilityIsIgnored()) {
    77             AtkObject* axObject = coreChild->wrapper();
     77            auto* axObject = coreChild->wrapper();
    7878            if (axObject && ATK_IS_HYPERLINK_IMPL(axObject))
    7979                linksFound++;
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.cpp

    r208929 r243928  
    159159    AccessibilityObject* option = optionFromSelection(selection, index);
    160160    if (option) {
    161         AtkObject* child = option->wrapper();
     161        auto* child = option->wrapper();
    162162        g_object_ref(child);
    163         return child;
     163        return ATK_OBJECT(child);
    164164    }
    165165
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp

    r225030 r243928  
    9797        return 0;
    9898
    99     AtkObject* cell = axCell->wrapper();
     99    auto* cell = axCell->wrapper();
    100100    if (!cell)
    101101        return 0;
     
    216216            downcast<AccessibilityTableCell>(*columnHeader).columnIndexRange(columnRange);
    217217            if (columnRange.first <= static_cast<unsigned>(column) && static_cast<unsigned>(column) < columnRange.first + columnRange.second)
    218                 return columnHeader->wrapper();
     218                return ATK_OBJECT(columnHeader->wrapper());
    219219        }
    220220    }
     
    236236            downcast<AccessibilityTableCell>(*rowHeader).rowIndexRange(rowRange);
    237237            if (rowRange.first <= static_cast<unsigned>(row) && static_cast<unsigned>(row) < rowRange.first + rowRange.second)
    238                 return rowHeader->wrapper();
     238                return ATK_OBJECT(rowHeader->wrapper());
    239239        }
    240240    }
     
    253253            auto caption = downcast<HTMLTableElement>(*node).caption();
    254254            if (caption)
    255                 return AccessibilityObject::firstAccessibleObjectFromNode(caption->renderer()->element())->wrapper();
     255                return ATK_OBJECT(AccessibilityObject::firstAccessibleObjectFromNode(caption->renderer()->element())->wrapper());
    256256        }
    257257    }
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp

    r225030 r243928  
    3535    GPtrArray* array = g_ptr_array_new();
    3636    for (const auto& child : children) {
    37         if (AtkObject* atkObject = child->wrapper())
     37        if (auto* atkObject = child->wrapper())
    3838            g_ptr_array_add(array, atkObject);
    3939    }
     
    150150        return nullptr;
    151151
    152     AtkObject* table = atk_object_get_parent(axObject->wrapper());
     152    auto* table = atk_object_get_parent(ATK_OBJECT(axObject->wrapper()));
    153153    if (!table || !ATK_IS_TABLE(table))
    154154        return nullptr;
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp

    r239535 r243928  
    232232    // For those objects implementing the AtkText interface we use the
    233233    // well known API to always get the text in a consistent way
    234     AtkObject* atkObj = ATK_OBJECT(object->wrapper());
     234    auto* atkObj = ATK_OBJECT(object->wrapper());
    235235    if (ATK_IS_TEXT(atkObj)) {
    236236        GUniquePtr<gchar> text(webkitAccessibleTextGetText(ATK_TEXT(atkObj), 0, -1));
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp

    r243198 r243928  
    182182    if (coreObject->isControl()) {
    183183        if (AccessibilityObject* label = coreObject->correspondingLabelForControlElement())
    184             atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, label->wrapper());
     184            atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, ATK_OBJECT(label->wrapper()));
    185185    } else if (coreObject->isFieldset()) {
    186186        if (AccessibilityObject* label = coreObject->titleUIElement())
    187             atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, label->wrapper());
     187            atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, ATK_OBJECT(label->wrapper()));
    188188    } else if (coreObject->roleValue() == AccessibilityRole::Legend) {
    189189        if (RenderBlock* renderFieldset = ancestorsOfType<RenderBlock>(*coreObject->renderer()).first()) {
    190190            if (renderFieldset->isFieldset()) {
    191191                AccessibilityObject* fieldset = coreObject->axObjectCache()->getOrCreate(renderFieldset);
    192                 atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABEL_FOR, fieldset->wrapper());
     192                atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABEL_FOR, ATK_OBJECT(fieldset->wrapper()));
    193193            }
    194194        }
    195195    } else if (AccessibilityObject* control = coreObject->correspondingControlForLabelElement()) {
    196         atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABEL_FOR, control->wrapper());
     196        atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABEL_FOR, ATK_OBJECT(control->wrapper()));
    197197    } else {
    198198        AccessibilityObject::AccessibilityChildrenVector ariaLabelledByElements;
    199199        coreObject->ariaLabelledByElements(ariaLabelledByElements);
    200200        for (const auto& accessibilityObject : ariaLabelledByElements)
    201             atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, accessibilityObject->wrapper());
     201            atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, ATK_OBJECT(accessibilityObject->wrapper()));
    202202    }
    203203
     
    206206    coreObject->ariaLabelledByReferencingElements(labels);
    207207    for (const auto& accessibilityObject : labels)
    208         atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABEL_FOR, accessibilityObject->wrapper());
     208        atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABEL_FOR, ATK_OBJECT(accessibilityObject->wrapper()));
    209209
    210210    // Elements with aria-flowto should have the flows-to relation as per the ARIA AAM spec.
     
    213213    coreObject->ariaFlowToElements(ariaFlowToElements);
    214214    for (const auto& accessibilityObject : ariaFlowToElements)
    215         atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_FLOWS_TO, accessibilityObject->wrapper());
     215        atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_FLOWS_TO, ATK_OBJECT(accessibilityObject->wrapper()));
    216216
    217217    // Elements referenced by aria-flowto should have the flows-from relation as per the ARIA AAM spec.
     
    220220    coreObject->ariaFlowToReferencingElements(flowFrom);
    221221    for (const auto& accessibilityObject : flowFrom)
    222         atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_FLOWS_FROM, accessibilityObject->wrapper());
     222        atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_FLOWS_FROM, ATK_OBJECT(accessibilityObject->wrapper()));
    223223
    224224    // Elements with aria-describedby should have the described-by relation as per the ARIA AAM spec.
     
    227227    coreObject->ariaDescribedByElements(ariaDescribedByElements);
    228228    for (const auto& accessibilityObject : ariaDescribedByElements)
    229         atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DESCRIBED_BY, accessibilityObject->wrapper());
     229        atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DESCRIBED_BY, ATK_OBJECT(accessibilityObject->wrapper()));
    230230
    231231    // Elements referenced by aria-describedby should have the description-for relation as per the ARIA AAM spec.
     
    234234    coreObject->ariaDescribedByReferencingElements(describers);
    235235    for (const auto& accessibilityObject : describers)
    236         atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DESCRIPTION_FOR, accessibilityObject->wrapper());
     236        atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DESCRIPTION_FOR, ATK_OBJECT(accessibilityObject->wrapper()));
    237237
    238238    // Elements with aria-controls should have the controller-for relation as per the ARIA AAM spec.
     
    241241    coreObject->ariaControlsElements(ariaControls);
    242242    for (const auto& accessibilityObject : ariaControls)
    243         atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_CONTROLLER_FOR, accessibilityObject->wrapper());
     243        atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_CONTROLLER_FOR, ATK_OBJECT(accessibilityObject->wrapper()));
    244244
    245245    // Elements referenced by aria-controls should have the controlled-by relation as per the ARIA AAM spec.
     
    248248    coreObject->ariaControlsReferencingElements(controllers);
    249249    for (const auto& accessibilityObject : controllers)
    250         atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_CONTROLLED_BY, accessibilityObject->wrapper());
     250        atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_CONTROLLED_BY, ATK_OBJECT(accessibilityObject->wrapper()));
    251251
    252252    // Elements with aria-owns should have the node-parent-of relation as per the ARIA AAM spec.
     
    255255    coreObject->ariaOwnsElements(ariaOwns);
    256256    for (const auto& accessibilityObject : ariaOwns)
    257         atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_NODE_PARENT_OF, accessibilityObject->wrapper());
     257        atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_NODE_PARENT_OF, ATK_OBJECT(accessibilityObject->wrapper()));
    258258
    259259    // Elements referenced by aria-owns should have the node-child-of relation as per the ARIA AAM spec.
     
    262262    coreObject->ariaOwnsReferencingElements(owners);
    263263    for (const auto& accessibilityObject : owners)
    264         atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_NODE_CHILD_OF, accessibilityObject->wrapper());
     264        atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_NODE_CHILD_OF, ATK_OBJECT(accessibilityObject->wrapper()));
    265265
    266266#if ATK_CHECK_VERSION(2, 25, 2)
     
    270270    coreObject->ariaDetailsElements(ariaDetails);
    271271    for (const auto& accessibilityObject : ariaDetails)
    272         atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DETAILS, accessibilityObject->wrapper());
     272        atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DETAILS, ATK_OBJECT(accessibilityObject->wrapper()));
    273273
    274274    // Elements referenced by aria-details should have the details-for relation as per the ARIA AAM spec.
     
    277277    coreObject->ariaDetailsReferencingElements(details);
    278278    for (const auto& accessibilityObject : details)
    279         atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DETAILS_FOR, accessibilityObject->wrapper());
     279        atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DETAILS_FOR, ATK_OBJECT(accessibilityObject->wrapper()));
    280280
    281281    // Elements with aria-errormessage should have the error-message relation as per the ARIA AAM spec.
     
    284284    coreObject->ariaErrorMessageElements(ariaErrorMessage);
    285285    for (const auto& accessibilityObject : ariaErrorMessage)
    286         atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_ERROR_MESSAGE, accessibilityObject->wrapper());
     286        atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_ERROR_MESSAGE, ATK_OBJECT(accessibilityObject->wrapper()));
    287287
    288288    // Elements referenced by aria-errormessage should have the error-for relation as per the ARIA AAM spec.
     
    291291    coreObject->ariaErrorMessageReferencingElements(errors);
    292292    for (const auto& accessibilityObject : errors)
    293         atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_ERROR_FOR, accessibilityObject->wrapper());
     293        atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_ERROR_FOR, ATK_OBJECT(accessibilityObject->wrapper()));
    294294#endif
    295295}
     
    325325    }
    326326
    327     if (!coreParent)
    328         return 0;
    329 
    330     return coreParent->wrapper();
     327    return coreParent ? ATK_OBJECT(coreParent->wrapper()) : nullptr;
    331328}
    332329
     
    351348        return atkParentOfRootObject(object);
    352349
    353     if (!coreParent)
    354         return 0;
    355 
    356     return coreParent->wrapper();
     350    return coreParent ? ATK_OBJECT(coreParent->wrapper()) : nullptr;
    357351}
    358352
     
    386380        return 0;
    387381
    388     AtkObject* child = coreChild->wrapper();
     382    auto* child = ATK_OBJECT(coreChild->wrapper());
    389383    atk_object_set_parent(child, object);
    390384    g_object_ref(child);
     
    915909
    916910    // Check text objects and paragraphs only.
    917     AtkObject* axObject = coreObject->wrapper();
    918     AtkRole role = axObject ? atk_object_get_role(axObject) : ATK_ROLE_INVALID;
     911    auto* axObject = coreObject->wrapper();
     912    AtkRole role = axObject ? atk_object_get_role(ATK_OBJECT(axObject)) : ATK_ROLE_INVALID;
    919913    if (role != ATK_ROLE_TEXT && role != ATK_ROLE_PARAGRAPH)
    920914        return false;
  • trunk/Source/WebCore/editing/atk/FrameSelectionAtk.cpp

    r234808 r243928  
    3636static void emitTextSelectionChange(AccessibilityObject* object, VisibleSelection selection, int offset)
    3737{
    38     AtkObject* axObject = object->wrapper();
     38    auto* axObject = object->wrapper();
    3939    if (!axObject || !ATK_IS_TEXT(axObject))
    4040        return;
     
    6666        oldObject.get() = nullptr;
    6767
    68     AtkObject* axObject = object ? object->wrapper() : 0;
    69     AtkObject* oldAxObject = oldObject.get() ? oldObject.get()->wrapper() : nullptr;
     68    auto* axObject = object ? object->wrapper() : nullptr;
     69    auto* oldAxObject = oldObject.get() ? oldObject.get()->wrapper() : nullptr;
    7070
    7171    if (axObject != oldAxObject) {
    7272        if (oldAxObject && ATK_IS_TEXT(oldAxObject)) {
    73             g_signal_emit_by_name(oldAxObject, "focus-event", false);
    74             atk_object_notify_state_change(oldAxObject, ATK_STATE_FOCUSED, false);
     73            g_signal_emit_by_name(oldAxObject, "focus-event", FALSE);
     74            atk_object_notify_state_change(ATK_OBJECT(oldAxObject), ATK_STATE_FOCUSED, FALSE);
    7575        }
    7676        if (axObject && ATK_IS_TEXT(axObject)) {
    77             g_signal_emit_by_name(axObject, "focus-event", true);
    78             atk_object_notify_state_change(axObject, ATK_STATE_FOCUSED, true);
     77            g_signal_emit_by_name(axObject, "focus-event", TRUE);
     78            atk_object_notify_state_change(ATK_OBJECT(axObject), ATK_STATE_FOCUSED, TRUE);
    7979        }
    8080    }
  • trunk/Source/WebKit/ChangeLog

    r243927 r243928  
     12019-04-05  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [ATK] Use a smart pointer for AccessibilityObject wrapper and remove GTK specific code
     4        https://bugs.webkit.org/show_bug.cgi?id=196593
     5        <rdar://problem/49599153>
     6
     7        Reviewed by Michael Catanzaro.
     8
     9        * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
     10        (accessibilityRootObjectWrapper): Cast wrapper() as AtkObject.
     11
    1122019-04-04  Simon Fraser  <simon.fraser@apple.com>
    213
  • trunk/Source/WebKit/WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp

    r243863 r243928  
    7070        return nullptr;
    7171
    72     AtkObject* rootObject = coreRootObject->wrapper();
    73     if (!rootObject || !ATK_IS_OBJECT(rootObject))
    74         return nullptr;
    75 
    76     return rootObject;
     72    return ATK_OBJECT(coreRootObject->wrapper());
    7773}
    7874
Note: See TracChangeset for help on using the changeset viewer.