vcl/source/window/accessibility.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 65e09958920057b3a15d38dcb2e26e752f42179c
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Wed May 8 21:07:06 2024 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Thu May 9 15:37:11 2024 +0200

    lok: don't try to search for legacy label from/to
    
    Searching for legacy label from/to can take quite some time in
    complex hierarchies (wallclock timed to 100ms) and this quickly
    can add up. In case of accessibility checker sidebar with many
    entries it could add up to 10s or more (depending on the amount of
    accessibility issues found in the document).
    
    The legacy label from/to is not used when we load from .ui file so
    it is not relevant for online currently. It is only relevant for ui
    found in extensions or starbasic ui.
    
    Also avoid making a copy of the vector of mnemonic label for no
    particular reason.
    
    Change-Id: I72002e6440a06f6e8548b7bddb46c3ab283ea283
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167347
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    (cherry picked from commit 1353ae001ed83c1f20b81df1708f694427c587a4)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167315
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/vcl/source/window/accessibility.cxx 
b/vcl/source/window/accessibility.cxx
index e48d5d22dd5e..2f3160a05b40 100644
--- a/vcl/source/window/accessibility.cxx
+++ b/vcl/source/window/accessibility.cxx
@@ -23,6 +23,7 @@
 #include <vcl/menu.hxx>
 #include <vcl/mnemonic.hxx>
 #include <vcl/wrkwin.hxx>
+#include <comphelper/lok.hxx>
 
 #include <window.h>
 #include <brdwin.hxx>
@@ -563,7 +564,8 @@ vcl::Window* Window::GetAccessibleRelationLabelFor() const
     if (pWindow)
         return pWindow;
 
-    if (!isContainerWindow(this) && !isContainerWindow(GetParent()))
+    // Avoid searching when using LOKit (jsdialog) - it can slow down dumping 
to json when we have a huge hierarchy
+    if (!comphelper::LibreOfficeKit::isActive() && !isContainerWindow(this) && 
!isContainerWindow(GetParent()))
         return getLegacyNonLayoutAccessibleRelationLabelFor();
 
     return nullptr;
@@ -574,7 +576,7 @@ vcl::Window* Window::GetAccessibleRelationLabeledBy() const
     if (mpWindowImpl->mpAccessibleInfos && 
mpWindowImpl->mpAccessibleInfos->pLabeledByWindow)
         return mpWindowImpl->mpAccessibleInfos->pLabeledByWindow;
 
-    std::vector<VclPtr<FixedText> > aMnemonicLabels(list_mnemonic_labels());
+    auto const& aMnemonicLabels = list_mnemonic_labels();
     if (!aMnemonicLabels.empty())
     {
         //if we have multiple labels, then prefer the first that is visible
@@ -586,7 +588,8 @@ vcl::Window* Window::GetAccessibleRelationLabeledBy() const
         return aMnemonicLabels[0];
     }
 
-    if (!isContainerWindow(this) && !isContainerWindow(GetParent()))
+    // Avoid searching when using LOKit (jsdialog) - it can slow down dumping 
to json when we have a huge hierarchy
+    if (!comphelper::LibreOfficeKit::isActive() && !isContainerWindow(this) && 
!isContainerWindow(GetParent()))
         return getLegacyNonLayoutAccessibleRelationLabeledBy();
 
     return nullptr;

Reply via email to