a11y atspi: Unescape commas in color text attribute

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 <jan-arve.saether@qt.io>
bb10
Michael Weghorn 2023-10-11 17:45:39 +02:00
parent 4c60a11d8f
commit f035766b16
1 changed files with 1 additions and 1 deletions

View File

@ -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)