diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2022-08-18 11:12:29 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2022-08-19 02:43:00 +0000 |
commit | e6599bfa6134cfd3097c9cb8ec45801ae810f3df (patch) | |
tree | abc6208922a63a9adc6490db7fac7c689d9728fc | |
parent | c2289ca582a1b48fdb97146636fe29b680019260 (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
Pick-to: 6.4
Change-Id: I66d3c484ecc4b469684635723242c915e4365e6a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
-rw-r--r-- | src/gui/accessible/linux/atspiadaptor.cpp | 14 | ||||
-rw-r--r-- | src/gui/accessible/linux/atspiadaptor_p.h | 2 |
2 files changed, 4 insertions, 12 deletions
diff --git a/src/gui/accessible/linux/atspiadaptor.cpp b/src/gui/accessible/linux/atspiadaptor.cpp index a2a8528731..03d54f29f4 100644 --- a/src/gui/accessible/linux/atspiadaptor.cpp +++ b/src/gui/accessible/linux/atspiadaptor.cpp @@ -476,9 +476,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" @@ -1775,7 +1772,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))); @@ -2040,9 +2037,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; @@ -2057,11 +2053,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 788d054e01..ccb392a27d 100644 --- a/src/gui/accessible/linux/atspiadaptor_p.h +++ b/src/gui/accessible/linux/atspiadaptor_p.h @@ -103,7 +103,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; |