vcl/qt5/QtAccessibleWidget.cxx |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit 2523b5451507c53bb3a10350e016651db82eb1d1
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Aug 22 12:10:17 2022 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Mon Aug 22 14:42:49 2022 +0200

    qt a11y: Don't set invalid Qt relations
    
    When no matching relation type is found when when trying to match
    LO's `AccessibleRelationType` to a corresponding Qt equivalent,
    don't set an invalid value, but skip this relation.
    
    Previously, when navigating to a Writer paragraph with the qt6 VCL
    plugin and Orca enabled, this would show up on stderr:
    
        warn:vcl.qt:220606:220606:vcl/qt6/../qt5/QtAccessibleWidget.cxx:218: 
Unmatched relation: 1
        warn:vcl.qt:220606:220606:vcl/qt6/../qt5/QtAccessibleWidget.cxx:218: 
Unmatched relation: 2
        Cannot return AT-SPI relation for: QFlags()
        Cannot return AT-SPI relation for: QFlags()
    
    This addresses the warnings emitted by the Qt library (lines 3 and 4).
    The first two warnings are from LO and remain for now, as long
    as Qt does not implement an equivalent for
    `AccessibleRelationType::CONTENT_FLOWS_FROM` and
    `AccessibleRelationType::CONTENT_FLOWS_TO`.
    
    Change-Id: If2cb5394b27d23926e4d4093ba8ab477997a16ad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138671
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx
index e9106f32785a..6bef5de36473 100644
--- a/vcl/qt5/QtAccessibleWidget.cxx
+++ b/vcl/qt5/QtAccessibleWidget.cxx
@@ -242,6 +242,10 @@ void 
lcl_appendRelation(QVector<QPair<QAccessibleInterface*, QAccessible::Relati
                         AccessibleRelation aRelation)
 {
     QAccessible::Relation aQRelation = 
lcl_matchUnoRelation(aRelation.RelationType);
+    // skip in case there's no matching Qt relation
+    if (!(aQRelation & QAccessible::AllRelations))
+        return;
+
     sal_uInt32 nTargetCount = aRelation.TargetSet.getLength();
 
     for (sal_uInt32 i = 0; i < nTargetCount; i++)

Reply via email to