From 56476947cfdc1b869b3a9bf1095c8665c35f7d4b Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Fri, 13 Oct 2023 16:07:49 +0200 Subject: [PATCH] a11y atspi: Bridge IA2 strikeout text attrs to AT-SPI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the text attributes an accessible interface reports include one of the various "text-line-through-*" IAccessible2 text attributes with a value that indicates that strikethrough is applied [1], bridge that to the AT-SPI layer via the "strikethrough" attribute with a value of "true". See also the ATK documentation [2] for the `ATK_TEXT_ATTR_STRIKETHROUGH` text attribute. This will not only be used by an upcoming change that implements reporting that for Qt's own text widgets, but is also needed for third-party applications. Change for LibreOffice that makes use of this: [3] [1] https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes [2] https://gnome.pages.gitlab.gnome.org/atk/AtkText.html#AtkTextAttribute [3] https://gerrit.libreoffice.org/c/core/+/157939 Task-number: QTBUG-118106 Change-Id: Ieb98584a3c6270d8db508d59994f9ba244e2bc64 Reviewed-by: Jan Arve Sæther --- src/gui/accessible/linux/atspiadaptor.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/accessible/linux/atspiadaptor.cpp b/src/gui/accessible/linux/atspiadaptor.cpp index 996523ccf4..6b4c80cf60 100644 --- a/src/gui/accessible/linux/atspiadaptor.cpp +++ b/src/gui/accessible/linux/atspiadaptor.cpp @@ -2222,6 +2222,13 @@ namespace // (on which it produces traceback and fails to read any following text attributes), // but that is the default value, so omit it anyway value = QString(); + } else if (((ia2Name == "text-line-through-style"_L1 || ia2Name == "text-line-through-type"_L1) && (ia2Value != "none"_L1)) + || (ia2Name == "text-line-through-text"_L1 && !ia2Value.isEmpty())) { + // if any of the above is set, set "strikethrough" to true, but don't explicitly set + // to false otherwise, since any of the others might still be set to indicate strikethrough + // and no strikethrough is assumed anyway when nothing is explicitly set + name = QStringLiteral("strikethrough"); + value = QStringLiteral("true"); } else if (ia2Name == "text-position"_L1) { name = QStringLiteral("vertical-align"); if (value != "baseline"_L1 && value != "super"_L1 && value != "sub"_L1) {