diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2025-04-11 09:00:50 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2025-04-11 10:40:35 +0200 |
commit | 2594caeda1d63c77ee7e448c0d5c51e9a1ffb3b4 (patch) | |
tree | 6a4a56dafa296728e51584fcd4756ae8ad0037b9 | |
parent | 1a37558fb2f68f92a464b3c7c0e6fa8e21c6282e (diff) |
svx a11y: Slightly rearrange AccessibleShape::getAccessibleIndexInParent
Return early and drop local var `nIndex`.
Drop comment about this being "simple but slow",
as simply returning the index if set is fast,
and the rest of the comment would thus not refer
to the implementation here, but in the base class.
Change-Id: Id855a8abd9f6de98d4fda59dc10d65228cb610eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184002
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r-- | svx/source/accessibility/AccessibleShape.cxx | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx index 33f4c1111b56..4b8a33c481ad 100644 --- a/svx/source/accessibility/AccessibleShape.cxx +++ b/svx/source/accessibility/AccessibleShape.cxx @@ -972,16 +972,14 @@ void AccessibleShape::disposing() AccessibleContextBase::disposing(); } -sal_Int64 SAL_CALL - AccessibleShape::getAccessibleIndexInParent() +sal_Int64 SAL_CALL AccessibleShape::getAccessibleIndexInParent() { ensureAlive(); - // Use a simple but slow solution for now. Optimize later. - sal_Int64 nIndex = m_nIndexInParent; - if ( -1 == nIndex ) - nIndex = AccessibleContextBase::getAccessibleIndexInParent(); - return nIndex; + if (m_nIndexInParent != -1) + return m_nIndexInParent; + + return AccessibleContextBase::getAccessibleIndexInParent(); } |