summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2022-08-18 11:12:29 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-08-19 13:15:53 +0000
commitdb0db36ddc0235c6e202192e7973e2c0109aa45b (patch)
treedba2b050f412db9fe59ef8ec29ef13f6378b7fec /src
parent48fd29fa4748d31bae03bfbca797c1d6dfe98321 (diff)
a11y atspi: Send correct D-Bus reply for GetAttributeValue
Only return a string for the attribute value (an empty string if the attribute is not set). The previous implementation was based on the incorrect signature in the XML spec for the AT-SPI Text interface from before the AT-SPI commit that removed the extra out params [1]: commit 8786849ce6e9914383aa766ff9ce7e00f5b2178d Author: Patryk Kaczmarek <patryk.k@samsung.com> Date: Mon Sep 28 14:23:15 2015 +0200 Fixed atspi_text_ functions * atspi_text_get_text_attribute_value Fixed dbus signature in _atspi_dbus_call function and add missing argument for string. * atspi_text_get_default_attributes Receiving return value by reference from hash table https://bugzilla.gnome.org/show_bug.cgi?id=755731 [1] https://gitlab.gnome.org/GNOME/at-spi2-core/-/commit/8786849ce6e9914383aa766ff9ce7e00f5b2178d Fixes: QTBUG-105752 Change-Id: I66d3c484ecc4b469684635723242c915e4365e6a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit e6599bfa6134cfd3097c9cb8ec45801ae810f3df) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/gui/accessible/linux/atspiadaptor.cpp14
-rw-r--r--src/gui/accessible/linux/atspiadaptor_p.h2
2 files changed, 4 insertions, 12 deletions
diff --git a/src/gui/accessible/linux/atspiadaptor.cpp b/src/gui/accessible/linux/atspiadaptor.cpp
index c90732d0a9..9661e517fa 100644
--- a/src/gui/accessible/linux/atspiadaptor.cpp
+++ b/src/gui/accessible/linux/atspiadaptor.cpp
@@ -451,9 +451,6 @@ QString AtSpiAdaptor::introspect(const QString &path) const
" <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"attributeName\"/>\n"
" <arg direction=\"out\" type=\"s\"/>\n"
- " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n"
- " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n"
- " <arg direction=\"out\" type=\"b\" name=\"defined\"/>\n"
" </method>\n"
" <method name=\"GetAttributes\">\n"
" <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
@@ -1761,7 +1758,7 @@ bool AtSpiAdaptor::textInterface(QAccessibleInterface *interface, const QString
} else if (function == "GetAttributeValue"_L1) {
int offset = message.arguments().at(0).toInt();
QString attributeName = message.arguments().at(1).toString();
- connection.send(message.createReply(getAttributeValue(interface, offset, attributeName)));
+ connection.send(message.createReply(QVariant(getAttributeValue(interface, offset, attributeName))));
} else if (function == "GetAttributes"_L1) {
int offset = message.arguments().at(0).toInt();
connection.send(message.createReply(getAttributes(interface, offset, true)));
@@ -2027,9 +2024,8 @@ QVariantList AtSpiAdaptor::getAttributes(QAccessibleInterface *interface, int of
return list;
}
-QVariantList AtSpiAdaptor::getAttributeValue(QAccessibleInterface *interface, int offset, const QString &attributeName) const
+QString AtSpiAdaptor::getAttributeValue(QAccessibleInterface *interface, int offset, const QString &attributeName) const
{
- QString mapped;
QString joined;
QSpiAttributeSet map;
int startOffset;
@@ -2044,11 +2040,7 @@ QVariantList AtSpiAdaptor::getAttributeValue(QAccessibleInterface *interface, in
if (!attribute.isNull())
map[attribute.name] = attribute.value;
}
- mapped = map[attributeName];
- const bool defined = !mapped.isEmpty();
- QVariantList list;
- list << mapped << startOffset << endOffset << defined;
- return list;
+ return map[attributeName];
}
QList<QVariant> AtSpiAdaptor::getCharacterExtents(QAccessibleInterface *interface, int offset, uint coordType) const
diff --git a/src/gui/accessible/linux/atspiadaptor_p.h b/src/gui/accessible/linux/atspiadaptor_p.h
index 3d785e4c25..aaabc8c2f1 100644
--- a/src/gui/accessible/linux/atspiadaptor_p.h
+++ b/src/gui/accessible/linux/atspiadaptor_p.h
@@ -101,7 +101,7 @@ private:
// text helper functions
QVariantList getAttributes(QAccessibleInterface *, int offset, bool includeDefaults) const;
- QVariantList getAttributeValue(QAccessibleInterface *, int offset, const QString &attributeName) const;
+ QString getAttributeValue(QAccessibleInterface *, int offset, const QString &attributeName) const;
QList<QVariant> getCharacterExtents(QAccessibleInterface *, int offset, uint coordType) const;
QList<QVariant> getRangeExtents(QAccessibleInterface *, int startOffset, int endOffset, uint coordType) const;
QAccessible::TextBoundaryType qAccessibleBoundaryType(int atspiTextBoundaryType) const;