summaryrefslogtreecommitdiff
path: root/sc/source/ui/Accessibility
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-09-26 10:30:27 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2023-09-26 12:05:59 +0200
commitc2d6ae1781ad4be5f9acefecce7e1504df02cf8f (patch)
treeb80c280541dedad3d74c026808724a16151b59d3 /sc/source/ui/Accessibility
parentd724b51c7da391c9afe5e47476d432aecf1c4c67 (diff)
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.weghorn@posteo.de>
Diffstat (limited to 'sc/source/ui/Accessibility')
-rw-r--r--sc/source/ui/Accessibility/AccessibleCell.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx
index 855bdf957546..27ac67611585 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);