From 45121669f52496a23cc539383c718a972feb351f Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 22 Aug 2022 09:38:24 +0200 Subject: [PATCH] a11y atspi: Handle AT-SPI Text's ScrollSubstringTo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This implements handling for the ScrollSubstringTo method from the AT-SPI Text interface by calling QAccessibleTextInterface::scrollToSubstring with the given text offsets. While the AT-SPI method has an additional parameter for the scroll type that specifies where on screen to place the given substring (s. doc at [1]), there is no equivalent in QAccessibleTextInterface::scrollToSubstring, so ignore that parameter. [1] https://lazka.github.io/pgi-docs/Atspi-2.0/classes/Text.html#Atspi.Text.scroll_substring_to Fixes: QTBUG-105854 Change-Id: I390e1316c5c55cb646a299499a5f87c9c6945a44 Reviewed-by: Tor Arne Vestbø --- src/gui/accessible/linux/atspiadaptor.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gui/accessible/linux/atspiadaptor.cpp b/src/gui/accessible/linux/atspiadaptor.cpp index 5fe0d54fe25..2ff64fd1b76 100644 --- a/src/gui/accessible/linux/atspiadaptor.cpp +++ b/src/gui/accessible/linux/atspiadaptor.cpp @@ -557,6 +557,12 @@ QString AtSpiAdaptor::introspect(const QString &path) const " \n" " \n" " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" " \n" ); @@ -1868,6 +1874,13 @@ bool AtSpiAdaptor::textInterface(QAccessibleInterface *interface, const QString int offset = message.arguments().at(0).toInt(); interface->textInterface()->setCursorPosition(offset); sendReply(connection, message, true); + } else if (function == "ScrollSubstringTo"_L1) { + int startOffset = message.arguments().at(0).toInt(); + int endOffset = message.arguments().at(1).toInt(); + // ignore third parameter (scroll type), since QAccessibleTextInterface::scrollToSubstring doesn't have that + qCInfo(lcAccessibilityAtspi) << "AtSpiAdaptor::ScrollSubstringTo doesn'take take scroll type into account."; + interface->textInterface()->scrollToSubstring(startOffset, endOffset); + sendReply(connection, message, true); } else if (function == "SetSelection"_L1) { int selectionNum = message.arguments().at(0).toInt(); int startOffset = message.arguments().at(1).toInt();