From f035766b16b4a2a22256dfa78b962ec611cc0727 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 11 Oct 2023 17:45:39 +0200 Subject: [PATCH] a11y atspi: Unescape commas in color text attribute MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The IAccessible2 text attribute specification [1], which is the applicable specification for text attributes in Qt as well, says: > These characters need to be escaped with a backslash: > backslash, colon, comma, equals, and semicolon. To adhere to this specification the commas in the "rgb(0,0,0)" value strings need to be escaped. However, AT-SPI does not expect those to be escaped, s. for example the ATK text attribute specification for ATK_TEXT_ATTR_FG_COLOR: > The foreground color. The value is an RGB > value of the format "u,u,u" Therefore, replace any backslash-escaped comma with just a comma in the AT-SPI adaptor. The context where I ran into this is LibreOffice change [3] (where LibreOffice's qt6 VCL plugin is based on Qt, but the Windows variant has its own IAccessible2-based a11y implementation). [1] https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes#formatting [2] https://gnome.pages.gitlab.gnome.org/atk/AtkText.html#AtkTextAttribute [3] https://gerrit.libreoffice.org/c/core/+/157845 Change-Id: I0a9003ff891f1bfb180a6d16a1dff2afe4002b3e Reviewed-by: Jan Arve Sæther --- src/gui/accessible/linux/atspiadaptor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/accessible/linux/atspiadaptor.cpp b/src/gui/accessible/linux/atspiadaptor.cpp index 377010fd6d..996523ccf4 100644 --- a/src/gui/accessible/linux/atspiadaptor.cpp +++ b/src/gui/accessible/linux/atspiadaptor.cpp @@ -2160,7 +2160,7 @@ namespace QString atspiColor(const QString &ia2Color) { // "rgb(%u,%u,%u)" -> "%u,%u,%u" - return ia2Color.mid(4, ia2Color.size() - (4+1)); + return ia2Color.mid(4, ia2Color.size() - (4+1)).replace(u"\\,"_s, u","_s); } QString atspiSize(const QString &ia2Size)