diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-02-17 15:25:37 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2023-02-20 06:15:56 +0000 |
commit | e55713dffbe8d8eba18068f6c2af14c10b787220 (patch) | |
tree | 6e96d70b547de8f07126a8c4f8b5729a0f36390f /vcl/qt5 | |
parent | b845ba1900387b8ea44a27a1f7d045ca0091adf2 (diff) |
qt a11y: Invert relation type to match Qt's semantic
As Jan Arve Sæther pointed out in a review comment [1]
for a pending Qt change to add more a11y relation
types to Qt, Qt's semantic for relations is basically
the other way around (i.e. inversed) as compared
to the semantic used by AT-SPI or LO.
For example, if an a11y interface `interfaceA` is the label
for another a11y interface `interfaceB`,
interfaceA->relations()
will contain a pair
{ interfaceB, QAccessible::Labelled }
since the target `interfaceB` is labelled by `interfaceA`.
On the other hand in LO, the `XAccessibleRelationSet`
for an `XAccessibleContext` has the role that the
a11y object itself has *for* the targets, i.e.
in that case the
interfaceA->getAccessibleRelationSet()
would contain an item of type
`AccessibleRelationType::LABEL_FOR` because
`interfaceA` is a label for the relation target
`interfaceB`.
Therefore, adapt the mapping between the relation
types accordingly.
AT-SPI's semantic/handling matches the one that LO has
again, which is taken care of by the fact that
Qt maps the relation types the other way around in
it's AT-SPI bridge again. [2]
There's also a pending Qt change [3] to clarify the
Qt doc.
[1] https://codereview.qt-project.org/c/qt/qtbase/+/428174/comment/eef0cf38_e6ff7dea/
[2] https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/linux/qspi_constant_mappings.cpp?id=e8322a4cc043e1a150cc4c6b86ee2f9cf858cd24#n98
[3] https://codereview.qt-project.org/c/qt/qtbase/+/460414
Change-Id: Ic30d878afc477ad3c6a188d22f35078034f8123c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147223
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl/qt5')
-rw-r--r-- | vcl/qt5/QtAccessibleWidget.cxx | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index e2807dd6fecf..7a55bae884f5 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -220,15 +220,16 @@ sal_Int16 lcl_matchQtTextBoundaryType(QAccessible::TextBoundaryType boundaryType QAccessible::Relation lcl_matchUnoRelation(short relationType) { + // Qt semantics is the other way around switch (relationType) { - case AccessibleRelationType::CONTROLLER_FOR: - return QAccessible::Controller; case AccessibleRelationType::CONTROLLED_BY: + return QAccessible::Controller; + case AccessibleRelationType::CONTROLLER_FOR: return QAccessible::Controlled; - case AccessibleRelationType::LABEL_FOR: - return QAccessible::Label; case AccessibleRelationType::LABELED_BY: + return QAccessible::Label; + case AccessibleRelationType::LABEL_FOR: return QAccessible::Labelled; case AccessibleRelationType::INVALID: case AccessibleRelationType::CONTENT_FLOWS_FROM: @@ -245,15 +246,16 @@ QAccessible::Relation lcl_matchUnoRelation(short relationType) short lcl_matchQtRelation(QAccessible::Relation relationType) { + // Qt semantics is the other way around switch (relationType) { - case QAccessible::Controller: - return AccessibleRelationType::CONTROLLER_FOR; case QAccessible::Controlled: + return AccessibleRelationType::CONTROLLER_FOR; + case QAccessible::Controller: return AccessibleRelationType::CONTROLLED_BY; - case QAccessible::Label: - return AccessibleRelationType::LABEL_FOR; case QAccessible::Labelled: + return AccessibleRelationType::LABEL_FOR; + case QAccessible::Label: return AccessibleRelationType::LABELED_BY; default: SAL_WARN("vcl.qt", "Unmatched relation: " << relationType); |