summaryrefslogtreecommitdiffstats
path: root/src/gui/accessible
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-04-24 17:38:38 +0300
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2023-07-07 22:08:43 +0000
commit86ea40b47896878939d266e91e1728474c8d6228 (patch)
treedf966faf95a5514f2de96417e6e276d5ed4034e7 /src/gui/accessible
parent644bd3367c342bc55f2cd612af7c0df7b3ddc12a (diff)
a11y atspi: Implement TableCell methods Get{Column,Row}HeaderCells
The AT-SPI TableCell interface's GetColumnHeaderCells and GetRowHeaderCells methods were not documented in the XML specification until recently, but are actively used, e.g. also by the Orca screen reader since commit https://gitlab.gnome.org/GNOME/orca/-/commit/ac2c4470ff4401b53b6de48e12ea5a0a6347897c ("Prefer table cell interface for getting row and column headers"). 5145d3899d338fbb82a2d314c58eb60a4a5205f8 only implemented the TableCell methods that were contained in the XML spec by then. Handle these two methods as well, and add an explicit warning for the case an unknown method is called. Related at-spi2-core commit adding the two missing methods to the AT-SPI TableCell XML spec: https://gitlab.gnome.org/GNOME/at-spi2-core/-/commit/963e99197376368e613be865e470b3af5a7a28a6 ("TableCell.xml: Add Get{Column,Row}HeaderCells methods") Fixes: QTBUG-113110 Change-Id: Ic218cdd021bbc347907762035730e6ae7d387300 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui/accessible')
-rw-r--r--src/gui/accessible/linux/atspiadaptor.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/gui/accessible/linux/atspiadaptor.cpp b/src/gui/accessible/linux/atspiadaptor.cpp
index 4965cecdd2..88fa529000 100644
--- a/src/gui/accessible/linux/atspiadaptor.cpp
+++ b/src/gui/accessible/linux/atspiadaptor.cpp
@@ -469,6 +469,14 @@ QString AtSpiAdaptor::introspect(const QString &path) const
" <arg direction=\"out\" name=\"row_extents\" type=\"i\" />\n"
" <arg direction=\"out\" name=\"col_extents\" type=\"i\" />\n"
" </method>\n"
+ " <method name=\"GetColumnHeaderCells\">\n"
+ " <arg direction=\"out\" type=\"a(so)\"/>\n"
+ " <annotation value=\"QSpiObjectReferenceArray\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"GetRowHeaderCells\">\n"
+ " <arg direction=\"out\" type=\"a(so)\"/>\n"
+ " <annotation value=\"QSpiObjectReferenceArray\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
" </interface>\n"
);
@@ -2770,7 +2778,17 @@ bool AtSpiAdaptor::tableCellInterface(QAccessibleInterface *interface, const QSt
return false;
}
- if (function == "GetColumnSpan"_L1) {
+ if (function == "GetColumnHeaderCells"_L1) {
+ QSpiObjectReferenceArray headerCells;
+ const auto headerCellInterfaces = cellInterface->columnHeaderCells();
+ headerCells.reserve(headerCellInterfaces.size());
+ for (QAccessibleInterface *cell : headerCellInterfaces) {
+ const QString childPath = pathForInterface(cell);
+ const QSpiObjectReference ref(connection, QDBusObjectPath(childPath));
+ headerCells << ref;
+ }
+ connection.send(message.createReply(QVariant::fromValue(headerCells)));
+ } else if (function == "GetColumnSpan"_L1) {
connection.send(message.createReply(QVariant::fromValue(QDBusVariant(
QVariant::fromValue(cellInterface->columnExtent())))));
} else if (function == "GetPosition"_L1) {
@@ -2778,6 +2796,16 @@ bool AtSpiAdaptor::tableCellInterface(QAccessibleInterface *interface, const QSt
const int column = cellInterface->columnIndex();
connection.send(message.createReply(QVariant::fromValue(QDBusVariant(
QVariant::fromValue(QPoint(row, column))))));
+ } else if (function == "GetRowHeaderCells"_L1) {
+ QSpiObjectReferenceArray headerCells;
+ const auto headerCellInterfaces = cellInterface->rowHeaderCells();
+ headerCells.reserve(headerCellInterfaces.size());
+ for (QAccessibleInterface *cell : headerCellInterfaces) {
+ const QString childPath = pathForInterface(cell);
+ const QSpiObjectReference ref(connection, QDBusObjectPath(childPath));
+ headerCells << ref;
+ }
+ connection.send(message.createReply(QVariant::fromValue(headerCells)));
} else if (function == "GetRowSpan"_L1) {
connection.send(message.createReply(QVariant::fromValue(QDBusVariant(
QVariant::fromValue(cellInterface->rowExtent())))));
@@ -2791,6 +2819,9 @@ bool AtSpiAdaptor::tableCellInterface(QAccessibleInterface *interface, const QSt
if (table && table->tableInterface())
ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(table)));
connection.send(message.createReply(QVariant::fromValue(QDBusVariant(QVariant::fromValue(ref)))));
+ } else {
+ qCWarning(lcAccessibilityAtspi) << "AtSpiAdaptor::tableCellInterface does not implement" << function << message.path();
+ return false;
}
return true;