sc/source/ui/Accessibility/AccessibleCell.cxx | 9 +++++++++ 1 file changed, 9 insertions(+)
New commits: commit dc85ff37bf4265884d7d0ec5974557ead1cc5cfe Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Sep 26 10:30:27 2023 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sun Oct 8 06:39:36 2023 +0200 tdf#157299 sc a11y: Limit amount of reported cell relations For the cells referenced in formulae, the a11y `CONTROLLED_BY` relation is reported. Since formulae can reference a large amount of cells, creating the a11y objects for each of these cells can result in Calc freezing, e.g. for the tdf#157299 `SUMIF` example that was referencing a whole column (containing 1048576 cells). Prevent that by limiting the maximimum amount of cells to handle here to 1000, and just printing a warning to the log otherwise and ignore cell ranges having more cells. If there's a need to increase the limit, that should be possible within certain bounds. My test with a modified SUMIF that just uses 999 cells wasn't causing any noticeable delay and the relations were shown in Accerciser as expected. From a quick look at the Orca and NVDA source code, they currently don't seem to make use of the `CONTROLLED_BY` relation for LibreOffice at all. Change-Id: Ia74e0e88d9dbd7650832664b9c027262367b428e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157265 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> (cherry picked from commit c2d6ae1781ad4be5f9acefecce7e1504df02cf8f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157225 Reviewed-by: Patrick Luby <plub...@neooffice.org> diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx index 96020a08ef63..bb1a22117cc4 100644 --- a/sc/source/ui/Accessibility/AccessibleCell.cxx +++ b/sc/source/ui/Accessibility/AccessibleCell.cxx @@ -455,6 +455,15 @@ void ScAccessibleCell::AddRelation(const ScRange& rRange, const sal_uInt32 nCount(static_cast<sal_uInt32>(rRange.aEnd.Col() - rRange.aStart.Col() + 1) * (rRange.aEnd.Row() - rRange.aStart.Row() + 1)); + + // tdf#157299 avoid handling a large amount of cells for performance reasons + if (nCount > 1000) + { + SAL_WARN("sc", "ScAccessibleCell::AddRelation: Not setting relations " + "for cell range with more than 1000 cells for performance reasons."); + return; + } + uno::Sequence < uno::Reference < uno::XInterface > > aTargetSet( nCount ); uno::Reference < uno::XInterface >* pTargetSet = aTargetSet.getArray(); sal_uInt32 nPos(0);