diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2024-05-08 21:07:06 +0900 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-05-09 10:01:19 +0200 |
commit | 1353ae001ed83c1f20b81df1708f694427c587a4 (patch) | |
tree | c2a0c418b479a119d22ebbf6196a55b3c0d4df1c /vcl | |
parent | 47c917bcdbffd6423f50a3d970ed45ce06b9061e (diff) |
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.mcnamara@collabora.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/accessibility.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/vcl/source/window/accessibility.cxx b/vcl/source/window/accessibility.cxx index 295a5c3878fc..5a88bb53e1ff 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> @@ -497,7 +498,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; @@ -508,7 +510,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 @@ -520,7 +522,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; |