[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.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@243928 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/accessibility/AccessibilityObject.h b/Source/WebCore/accessibility/AccessibilityObject.h
index 003a049..cd96968 100644
--- a/Source/WebCore/accessibility/AccessibilityObject.h
+++ b/Source/WebCore/accessibility/AccessibilityObject.h
@@ -47,6 +47,10 @@
#include <wtf/RetainPtr.h>
#endif
+#if PLATFORM(GTK)
+#include <wtf/glib/GRefPtr.h>
+#endif
+
#if PLATFORM(COCOA)
typedef struct _NSRange NSRange;
@@ -934,20 +938,12 @@
bool isAXHidden() const;
bool isDOMHidden() const;
bool isHidden() const { return isAXHidden() || isDOMHidden(); }
-
+
#if HAVE(ACCESSIBILITY)
-#if PLATFORM(GTK)
- AccessibilityObjectWrapper* wrapper() const override;
- void setWrapper(AccessibilityObjectWrapper*);
-#else
AccessibilityObjectWrapper* wrapper() const override { return m_wrapper.get(); }
- void setWrapper(AccessibilityObjectWrapper* wrapper)
- {
- m_wrapper = wrapper;
- }
+ void setWrapper(AccessibilityObjectWrapper* wrapper) { m_wrapper = wrapper; }
#endif
-#endif
-
+
#if PLATFORM(COCOA)
void overrideAttachmentParent(AccessibilityObject* parent);
#else
@@ -1050,7 +1046,7 @@
#elif PLATFORM(WIN)
COMPtr<AccessibilityObjectWrapper> m_wrapper;
#elif PLATFORM(GTK)
- AtkObject* m_wrapper { nullptr };
+ GRefPtr<WebKitAccessible> m_wrapper;
#elif PLATFORM(WPE)
RefPtr<AccessibilityObjectWrapper> m_wrapper;
#endif
diff --git a/Source/WebCore/accessibility/AccessibilityObjectInterface.h b/Source/WebCore/accessibility/AccessibilityObjectInterface.h
index 35bf520..71fa8f0 100644
--- a/Source/WebCore/accessibility/AccessibilityObjectInterface.h
+++ b/Source/WebCore/accessibility/AccessibilityObjectInterface.h
@@ -37,8 +37,8 @@
OBJC_CLASS WebAccessibilityObjectWrapper;
typedef WebAccessibilityObjectWrapper AccessibilityObjectWrapper;
#elif PLATFORM(GTK)
-typedef struct _AtkObject AtkObject;
-typedef struct _AtkObject AccessibilityObjectWrapper;
+typedef struct _WebKitAccessible WebKitAccessible;
+typedef struct _WebKitAccessible AccessibilityObjectWrapper;
#elif PLATFORM(WPE)
class AccessibilityObjectWrapper : public RefCounted<AccessibilityObjectWrapper> { };
#else
diff --git a/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp b/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp
index 3ac0228..bb183d1 100644
--- a/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp
+++ b/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp
@@ -38,7 +38,7 @@
void AXObjectCache::detachWrapper(AccessibilityObject* obj, AccessibilityDetachmentType detachmentType)
{
- AtkObject* wrapper = obj->wrapper();
+ auto* wrapper = obj->wrapper();
ASSERT(wrapper);
// If an object is being detached NOT because of the AXObjectCache being destroyed,
@@ -66,9 +66,8 @@
void AXObjectCache::attachWrapper(AccessibilityObject* obj)
{
- AtkObject* atkObj = ATK_OBJECT(webkitAccessibleNew(obj));
- obj->setWrapper(atkObj);
- g_object_unref(atkObj);
+ GRefPtr<WebKitAccessible> wrapper = adoptGRef(webkitAccessibleNew(obj));
+ obj->setWrapper(wrapper.get());
// If an object is being attached and we are not in the middle of a layout update, then
// we should report ATs by emitting the children-changed::add signal from the parent.
@@ -94,12 +93,12 @@
return;
// Look for the right object to emit the signal from.
- AtkObject* atkParent = coreParent->wrapper();
+ auto* atkParent = coreParent->wrapper();
if (!atkParent)
return;
size_t index = coreParent->children(false).find(obj);
- g_signal_emit_by_name(atkParent, "children-changed::add", index != notFound ? index : -1, atkObj);
+ g_signal_emit_by_name(atkParent, "children-changed::add", index != notFound ? index : -1, wrapper.get());
}
static AccessibilityObject* getListObject(AccessibilityObject* object)
@@ -168,24 +167,24 @@
if (oldListObject.get() != listObject)
oldFocusedObject.get() = nullptr;
- AtkObject* axItem = item ? item->wrapper() : nullptr;
- AtkObject* axOldFocusedObject = oldFocusedObject.get() ? oldFocusedObject.get()->wrapper() : nullptr;
+ WebKitAccessible* axItem = item ? item->wrapper() : nullptr;
+ WebKitAccessible* axOldFocusedObject = oldFocusedObject.get() ? oldFocusedObject.get()->wrapper() : nullptr;
// Old focused object just lost focus, so emit the events.
if (axOldFocusedObject && axItem != axOldFocusedObject) {
g_signal_emit_by_name(axOldFocusedObject, "focus-event", false);
- atk_object_notify_state_change(axOldFocusedObject, ATK_STATE_FOCUSED, false);
+ atk_object_notify_state_change(ATK_OBJECT(axOldFocusedObject), ATK_STATE_FOCUSED, false);
}
// Emit needed events for the currently (un)selected item.
if (axItem) {
bool isSelected = item->isSelected();
- atk_object_notify_state_change(axItem, ATK_STATE_SELECTED, isSelected);
+ atk_object_notify_state_change(ATK_OBJECT(axItem), ATK_STATE_SELECTED, isSelected);
// When the selection changes in a collapsed widget such as a combo box
// whose child menu is not showing, that collapsed widget retains focus.
if (!object->isCollapsed()) {
g_signal_emit_by_name(axItem, "focus-event", isSelected);
- atk_object_notify_state_change(axItem, ATK_STATE_FOCUSED, isSelected);
+ atk_object_notify_state_change(ATK_OBJECT(axItem), ATK_STATE_FOCUSED, isSelected);
}
}
@@ -196,7 +195,7 @@
void AXObjectCache::postPlatformNotification(AccessibilityObject* coreObject, AXNotification notification)
{
- AtkObject* axObject = coreObject->wrapper();
+ auto* axObject = ATK_OBJECT(coreObject->wrapper());
if (!axObject)
return;
@@ -231,7 +230,7 @@
atk_value_get_current_value(ATK_VALUE(axObject), &propertyValues.new_value);
#endif
- g_signal_emit_by_name(ATK_OBJECT(axObject), "property-change::accessible-value", &propertyValues, NULL);
+ g_signal_emit_by_name(axObject, "property-change::accessible-value", &propertyValues, NULL);
}
break;
@@ -299,7 +298,7 @@
if (!parentObject)
return;
- AtkObject* wrapper = parentObject->wrapper();
+ auto* wrapper = parentObject->wrapper();
if (!wrapper || !ATK_IS_TEXT(wrapper))
return;
@@ -349,7 +348,7 @@
if (!object)
return;
- AtkObject* axObject = object->wrapper();
+ auto* axObject = ATK_OBJECT(object->wrapper());
if (!axObject || !ATK_IS_DOCUMENT(axObject))
return;
@@ -376,13 +375,15 @@
{
RefPtr<AccessibilityObject> oldObject = getOrCreate(oldFocusedNode);
if (oldObject) {
- g_signal_emit_by_name(oldObject->wrapper(), "focus-event", false);
- atk_object_notify_state_change(oldObject->wrapper(), ATK_STATE_FOCUSED, false);
+ auto* axObject = oldObject->wrapper();
+ g_signal_emit_by_name(axObject, "focus-event", false);
+ atk_object_notify_state_change(ATK_OBJECT(axObject), ATK_STATE_FOCUSED, false);
}
RefPtr<AccessibilityObject> newObject = getOrCreate(newFocusedNode);
if (newObject) {
- g_signal_emit_by_name(newObject->wrapper(), "focus-event", true);
- atk_object_notify_state_change(newObject->wrapper(), ATK_STATE_FOCUSED, true);
+ auto* axObject = newObject->wrapper();
+ g_signal_emit_by_name(axObject, "focus-event", true);
+ atk_object_notify_state_change(ATK_OBJECT(axObject), ATK_STATE_FOCUSED, true);
}
}
diff --git a/Source/WebCore/accessibility/atk/AccessibilityObjectAtk.cpp b/Source/WebCore/accessibility/atk/AccessibilityObjectAtk.cpp
index 5933a19..42b8ec2 100644
--- a/Source/WebCore/accessibility/atk/AccessibilityObjectAtk.cpp
+++ b/Source/WebCore/accessibility/atk/AccessibilityObjectAtk.cpp
@@ -156,25 +156,6 @@
return AccessibilityObjectInclusion::DefaultBehavior;
}
-AccessibilityObjectWrapper* AccessibilityObject::wrapper() const
-{
- return m_wrapper;
-}
-
-void AccessibilityObject::setWrapper(AccessibilityObjectWrapper* wrapper)
-{
- if (wrapper == m_wrapper)
- return;
-
- if (m_wrapper)
- g_object_unref(m_wrapper);
-
- m_wrapper = wrapper;
-
- if (m_wrapper)
- g_object_ref(m_wrapper);
-}
-
bool AccessibilityObject::allowsTextRanges() const
{
// Check type for the AccessibilityObject.
diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceComponent.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceComponent.cpp
index f6b754a..6984726 100644
--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceComponent.cpp
+++ b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceComponent.cpp
@@ -81,7 +81,7 @@
if (!target)
return 0;
g_object_ref(target->wrapper());
- return target->wrapper();
+ return ATK_OBJECT(target->wrapper());
}
static void webkitAccessibleComponentGetExtents(AtkComponent* component, gint* x, gint* y, gint* width, gint* height, AtkCoordType coordType)
diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp
index db60218..f12e3df 100644
--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp
+++ b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp
@@ -49,7 +49,7 @@
for (const auto& child : children) {
AccessibilityObject* coreChild = child.get();
if (!coreChild->accessibilityIsIgnored()) {
- AtkObject* axObject = coreChild->wrapper();
+ auto* axObject = coreChild->wrapper();
if (!axObject || !ATK_IS_HYPERLINK_IMPL(axObject))
continue;
@@ -74,7 +74,7 @@
for (const auto& child : children) {
AccessibilityObject* coreChild = child.get();
if (!coreChild->accessibilityIsIgnored()) {
- AtkObject* axObject = coreChild->wrapper();
+ auto* axObject = coreChild->wrapper();
if (axObject && ATK_IS_HYPERLINK_IMPL(axObject))
linksFound++;
}
diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.cpp
index ec7f8ca..5bfd925 100644
--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.cpp
+++ b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.cpp
@@ -158,9 +158,9 @@
AccessibilityObject* option = optionFromSelection(selection, index);
if (option) {
- AtkObject* child = option->wrapper();
+ auto* child = option->wrapper();
g_object_ref(child);
- return child;
+ return ATK_OBJECT(child);
}
return nullptr;
diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp
index d07d08a..2da34c9 100644
--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp
+++ b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp
@@ -96,7 +96,7 @@
if (!axCell)
return 0;
- AtkObject* cell = axCell->wrapper();
+ auto* cell = axCell->wrapper();
if (!cell)
return 0;
@@ -215,7 +215,7 @@
std::pair<unsigned, unsigned> columnRange;
downcast<AccessibilityTableCell>(*columnHeader).columnIndexRange(columnRange);
if (columnRange.first <= static_cast<unsigned>(column) && static_cast<unsigned>(column) < columnRange.first + columnRange.second)
- return columnHeader->wrapper();
+ return ATK_OBJECT(columnHeader->wrapper());
}
}
return nullptr;
@@ -235,7 +235,7 @@
std::pair<unsigned, unsigned> rowRange;
downcast<AccessibilityTableCell>(*rowHeader).rowIndexRange(rowRange);
if (rowRange.first <= static_cast<unsigned>(row) && static_cast<unsigned>(row) < rowRange.first + rowRange.second)
- return rowHeader->wrapper();
+ return ATK_OBJECT(rowHeader->wrapper());
}
}
return nullptr;
@@ -252,7 +252,7 @@
if (is<HTMLTableElement>(node)) {
auto caption = downcast<HTMLTableElement>(*node).caption();
if (caption)
- return AccessibilityObject::firstAccessibleObjectFromNode(caption->renderer()->element())->wrapper();
+ return ATK_OBJECT(AccessibilityObject::firstAccessibleObjectFromNode(caption->renderer()->element())->wrapper());
}
}
return nullptr;
diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp
index 9d84822..623e3e1 100644
--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp
+++ b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp
@@ -34,7 +34,7 @@
{
GPtrArray* array = g_ptr_array_new();
for (const auto& child : children) {
- if (AtkObject* atkObject = child->wrapper())
+ if (auto* atkObject = child->wrapper())
g_ptr_array_add(array, atkObject);
}
return array;
@@ -149,7 +149,7 @@
if (!axObject || !axObject->isTableCell())
return nullptr;
- AtkObject* table = atk_object_get_parent(axObject->wrapper());
+ auto* table = atk_object_get_parent(ATK_OBJECT(axObject->wrapper()));
if (!table || !ATK_IS_TABLE(table))
return nullptr;
diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp
index da402da..94453dc 100644
--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp
+++ b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp
@@ -231,7 +231,7 @@
// For those objects implementing the AtkText interface we use the
// well known API to always get the text in a consistent way
- AtkObject* atkObj = ATK_OBJECT(object->wrapper());
+ auto* atkObj = ATK_OBJECT(object->wrapper());
if (ATK_IS_TEXT(atkObj)) {
GUniquePtr<gchar> text(webkitAccessibleTextGetText(ATK_TEXT(atkObj), 0, -1));
return g_utf8_strlen(text.get(), -1);
diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
index ed2943e..a1480a6 100644
--- a/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
+++ b/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
@@ -181,87 +181,87 @@
removeAtkRelationByType(relationSet, ATK_RELATION_LABEL_FOR);
if (coreObject->isControl()) {
if (AccessibilityObject* label = coreObject->correspondingLabelForControlElement())
- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, label->wrapper());
+ atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, ATK_OBJECT(label->wrapper()));
} else if (coreObject->isFieldset()) {
if (AccessibilityObject* label = coreObject->titleUIElement())
- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, label->wrapper());
+ atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, ATK_OBJECT(label->wrapper()));
} else if (coreObject->roleValue() == AccessibilityRole::Legend) {
if (RenderBlock* renderFieldset = ancestorsOfType<RenderBlock>(*coreObject->renderer()).first()) {
if (renderFieldset->isFieldset()) {
AccessibilityObject* fieldset = coreObject->axObjectCache()->getOrCreate(renderFieldset);
- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABEL_FOR, fieldset->wrapper());
+ atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABEL_FOR, ATK_OBJECT(fieldset->wrapper()));
}
}
} else if (AccessibilityObject* control = coreObject->correspondingControlForLabelElement()) {
- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABEL_FOR, control->wrapper());
+ atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABEL_FOR, ATK_OBJECT(control->wrapper()));
} else {
AccessibilityObject::AccessibilityChildrenVector ariaLabelledByElements;
coreObject->ariaLabelledByElements(ariaLabelledByElements);
for (const auto& accessibilityObject : ariaLabelledByElements)
- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, accessibilityObject->wrapper());
+ atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, ATK_OBJECT(accessibilityObject->wrapper()));
}
// Elements referenced by aria-labelledby should have the label-for relation as per the ARIA AAM spec.
AccessibilityObject::AccessibilityChildrenVector labels;
coreObject->ariaLabelledByReferencingElements(labels);
for (const auto& accessibilityObject : labels)
- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABEL_FOR, accessibilityObject->wrapper());
+ atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABEL_FOR, ATK_OBJECT(accessibilityObject->wrapper()));
// Elements with aria-flowto should have the flows-to relation as per the ARIA AAM spec.
removeAtkRelationByType(relationSet, ATK_RELATION_FLOWS_TO);
AccessibilityObject::AccessibilityChildrenVector ariaFlowToElements;
coreObject->ariaFlowToElements(ariaFlowToElements);
for (const auto& accessibilityObject : ariaFlowToElements)
- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_FLOWS_TO, accessibilityObject->wrapper());
+ atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_FLOWS_TO, ATK_OBJECT(accessibilityObject->wrapper()));
// Elements referenced by aria-flowto should have the flows-from relation as per the ARIA AAM spec.
removeAtkRelationByType(relationSet, ATK_RELATION_FLOWS_FROM);
AccessibilityObject::AccessibilityChildrenVector flowFrom;
coreObject->ariaFlowToReferencingElements(flowFrom);
for (const auto& accessibilityObject : flowFrom)
- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_FLOWS_FROM, accessibilityObject->wrapper());
+ atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_FLOWS_FROM, ATK_OBJECT(accessibilityObject->wrapper()));
// Elements with aria-describedby should have the described-by relation as per the ARIA AAM spec.
removeAtkRelationByType(relationSet, ATK_RELATION_DESCRIBED_BY);
AccessibilityObject::AccessibilityChildrenVector ariaDescribedByElements;
coreObject->ariaDescribedByElements(ariaDescribedByElements);
for (const auto& accessibilityObject : ariaDescribedByElements)
- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DESCRIBED_BY, accessibilityObject->wrapper());
+ atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DESCRIBED_BY, ATK_OBJECT(accessibilityObject->wrapper()));
// Elements referenced by aria-describedby should have the description-for relation as per the ARIA AAM spec.
removeAtkRelationByType(relationSet, ATK_RELATION_DESCRIPTION_FOR);
AccessibilityObject::AccessibilityChildrenVector describers;
coreObject->ariaDescribedByReferencingElements(describers);
for (const auto& accessibilityObject : describers)
- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DESCRIPTION_FOR, accessibilityObject->wrapper());
+ atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DESCRIPTION_FOR, ATK_OBJECT(accessibilityObject->wrapper()));
// Elements with aria-controls should have the controller-for relation as per the ARIA AAM spec.
removeAtkRelationByType(relationSet, ATK_RELATION_CONTROLLER_FOR);
AccessibilityObject::AccessibilityChildrenVector ariaControls;
coreObject->ariaControlsElements(ariaControls);
for (const auto& accessibilityObject : ariaControls)
- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_CONTROLLER_FOR, accessibilityObject->wrapper());
+ atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_CONTROLLER_FOR, ATK_OBJECT(accessibilityObject->wrapper()));
// Elements referenced by aria-controls should have the controlled-by relation as per the ARIA AAM spec.
removeAtkRelationByType(relationSet, ATK_RELATION_CONTROLLED_BY);
AccessibilityObject::AccessibilityChildrenVector controllers;
coreObject->ariaControlsReferencingElements(controllers);
for (const auto& accessibilityObject : controllers)
- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_CONTROLLED_BY, accessibilityObject->wrapper());
+ atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_CONTROLLED_BY, ATK_OBJECT(accessibilityObject->wrapper()));
// Elements with aria-owns should have the node-parent-of relation as per the ARIA AAM spec.
removeAtkRelationByType(relationSet, ATK_RELATION_NODE_PARENT_OF);
AccessibilityObject::AccessibilityChildrenVector ariaOwns;
coreObject->ariaOwnsElements(ariaOwns);
for (const auto& accessibilityObject : ariaOwns)
- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_NODE_PARENT_OF, accessibilityObject->wrapper());
+ atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_NODE_PARENT_OF, ATK_OBJECT(accessibilityObject->wrapper()));
// Elements referenced by aria-owns should have the node-child-of relation as per the ARIA AAM spec.
removeAtkRelationByType(relationSet, ATK_RELATION_NODE_CHILD_OF);
AccessibilityObject::AccessibilityChildrenVector owners;
coreObject->ariaOwnsReferencingElements(owners);
for (const auto& accessibilityObject : owners)
- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_NODE_CHILD_OF, accessibilityObject->wrapper());
+ atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_NODE_CHILD_OF, ATK_OBJECT(accessibilityObject->wrapper()));
#if ATK_CHECK_VERSION(2, 25, 2)
// Elements with aria-details should have the details relation as per the ARIA AAM spec.
@@ -269,28 +269,28 @@
AccessibilityObject::AccessibilityChildrenVector ariaDetails;
coreObject->ariaDetailsElements(ariaDetails);
for (const auto& accessibilityObject : ariaDetails)
- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DETAILS, accessibilityObject->wrapper());
+ atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DETAILS, ATK_OBJECT(accessibilityObject->wrapper()));
// Elements referenced by aria-details should have the details-for relation as per the ARIA AAM spec.
removeAtkRelationByType(relationSet, ATK_RELATION_DETAILS_FOR);
AccessibilityObject::AccessibilityChildrenVector details;
coreObject->ariaDetailsReferencingElements(details);
for (const auto& accessibilityObject : details)
- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DETAILS_FOR, accessibilityObject->wrapper());
+ atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DETAILS_FOR, ATK_OBJECT(accessibilityObject->wrapper()));
// Elements with aria-errormessage should have the error-message relation as per the ARIA AAM spec.
removeAtkRelationByType(relationSet, ATK_RELATION_ERROR_MESSAGE);
AccessibilityObject::AccessibilityChildrenVector ariaErrorMessage;
coreObject->ariaErrorMessageElements(ariaErrorMessage);
for (const auto& accessibilityObject : ariaErrorMessage)
- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_ERROR_MESSAGE, accessibilityObject->wrapper());
+ atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_ERROR_MESSAGE, ATK_OBJECT(accessibilityObject->wrapper()));
// Elements referenced by aria-errormessage should have the error-for relation as per the ARIA AAM spec.
removeAtkRelationByType(relationSet, ATK_RELATION_ERROR_FOR);
AccessibilityObject::AccessibilityChildrenVector errors;
coreObject->ariaErrorMessageReferencingElements(errors);
for (const auto& accessibilityObject : errors)
- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_ERROR_FOR, accessibilityObject->wrapper());
+ atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_ERROR_FOR, ATK_OBJECT(accessibilityObject->wrapper()));
#endif
}
@@ -324,10 +324,7 @@
return 0;
}
- if (!coreParent)
- return 0;
-
- return coreParent->wrapper();
+ return coreParent ? ATK_OBJECT(coreParent->wrapper()) : nullptr;
}
static AtkObject* webkitAccessibleGetParent(AtkObject* object)
@@ -350,10 +347,7 @@
if (!coreParent && isRootObject(coreObject))
return atkParentOfRootObject(object);
- if (!coreParent)
- return 0;
-
- return coreParent->wrapper();
+ return coreParent ? ATK_OBJECT(coreParent->wrapper()) : nullptr;
}
static gint webkitAccessibleGetNChildren(AtkObject* object)
@@ -385,7 +379,7 @@
if (!coreChild)
return 0;
- AtkObject* child = coreChild->wrapper();
+ auto* child = ATK_OBJECT(coreChild->wrapper());
atk_object_set_parent(child, object);
g_object_ref(child);
@@ -914,8 +908,8 @@
return false;
// Check text objects and paragraphs only.
- AtkObject* axObject = coreObject->wrapper();
- AtkRole role = axObject ? atk_object_get_role(axObject) : ATK_ROLE_INVALID;
+ auto* axObject = coreObject->wrapper();
+ AtkRole role = axObject ? atk_object_get_role(ATK_OBJECT(axObject)) : ATK_ROLE_INVALID;
if (role != ATK_ROLE_TEXT && role != ATK_ROLE_PARAGRAPH)
return false;