diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-02-22 11:58:08 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-02-22 15:20:36 +0100 |
commit | e268efd612d12ae9a459d6b9d0cb23220f025163 (patch) | |
tree | 2e8ef2ff5e0a6668ee0c6f2462a56024fb4dabe2 /svx/uiconfig/ui/stylespreview.ui | |
parent | 56e5c2c35d8febb17decaae1d526d3c98ae08f09 (diff) |
gtk4 a11y: Implement new GtkAccessibleTextInterface
Implement most of the methods of the
`GtkAccessibleInterface` newly added to Gtk 4 in
Gtk commit [1]
commit 0ca8d74842837b1ad5dc42c1fcff8b1270e5750b
Author: Matthias Clasen <mclasen@redhat.com>
Date: Tue Feb 20 12:18:27 2024 -0500
a11y: Add GtkAccessibleText interface
The AccessibleText interface is meant to be implemented by widgets and
other accessible objects that expose selectable, navigatable, or rich
text to assistive technologies.
This kind of text is not covered by the plain accessible name and
description, as it contains things like a caret, or text attributes.
This commit adds a stub GtkAccessibleText with its basic virtual
functions; the interface will be implemented by widgets like GtkLabel,
GtkInscription, GtkText, and GtkTextView. A further commit will ensure
that the AT-SPI implementation will convert from GTK to AT-SPI through a
generic (internal API); and, finally, we'll remove the widget type
checks in the AT-SPI implementation of GtkATContext, and only check for
GtkAccessibleText.
Fixes: #5912
and follow-up commits. The `css::accessibility::XAccessibleText`
interface provides the required functionality.
With a Writer paragraph consisting of the text
"Hello world. And another sentence."
and the word "world" selected, using some of the AT-SPI Text
interface methods via Accerciser's IPython console behaves as expected
now when the paragraph's a11y object is selected in Accerciser's
treeview:
In [9]: text = acc.queryText()
In [10]: text.get_caretOffset()
Out[10]: 11
In [11]: text.getText(0, -1)
Out[11]: 'Hello world. And another sentence.'
In [12]: text.getText(2,5)
Out[12]: 'llo'
In [13]: text.getStringAtOffset(10, pyatspi.TEXT_GRANULARITY_CHAR)
Out[13]: ('d', 10, 11)
In [14]: text.getStringAtOffset(10, pyatspi.TEXT_GRANULARITY_WORD)
Out[14]: ('world', 6, 11)
In [15]: text.getStringAtOffset(10, pyatspi.TEXT_GRANULARITY_SENTENCE)
Out[15]: ('Hello world. ', 0, 13)
In [16]: text.getStringAtOffset(10, pyatspi.TEXT_GRANULARITY_PARAGRAPH)
Out[16]: ('Hello world. And another sentence.', 0, 34)
In [17]: text.getNSelections()
Out[17]: 1
In [18]: text.getSelection(0)
Out[18]: (6, 11)
Actual handling of text attributes is left for later (s. TODO comment
in the newly added `lo_accessible_text_get_attributes`).
[1] https://gitlab.gnome.org/GNOME/gtk/-/commit/0ca8d74842837b1ad5dc42c1fcff8b1270e5750b
Change-Id: Icad236cd87285d9a336883e67b191f633e9e4413
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163733
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'svx/uiconfig/ui/stylespreview.ui')
0 files changed, 0 insertions, 0 deletions