svtools/source/control/accessibletabbarpagelist.cxx |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

New commits:
commit f382c1a267a93539f3c169530780889336d20b25
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sun Mar 16 18:21:59 2025 -0700
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Mon Mar 17 03:33:24 2025 +0100

    svtools a11y: Simplify AccessibleTabBarPageList::getAccessibleAtPoint
    
    * Only convert the vcl Point to awt::Point once, not
      in every loop iteration.
    * Return early.
    
    Change-Id: I267d9b1a188a9f9323dede0f30e46d4c990b188f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183017
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/svtools/source/control/accessibletabbarpagelist.cxx 
b/svtools/source/control/accessibletabbarpagelist.cxx
index ec67c2800d14..6a618f573bd1 100644
--- a/svtools/source/control/accessibletabbarpagelist.cxx
+++ b/svtools/source/control/accessibletabbarpagelist.cxx
@@ -483,7 +483,7 @@ namespace accessibility
     {
         OExternalLockGuard aGuard( this );
 
-        rtl::Reference< AccessibleTabBarPage > xChild;
+        Point aPos = vcl::unohelper::ConvertToVCLPoint(rPoint);
         for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i )
         {
             rtl::Reference< AccessibleTabBarPage > xAcc = 
getAccessibleChildImpl( i );
@@ -493,17 +493,13 @@ namespace accessibility
                 if ( xComp.is() )
                 {
                     tools::Rectangle aRect = 
vcl::unohelper::ConvertToVCLRect(xComp->getBounds());
-                    Point aPos = vcl::unohelper::ConvertToVCLPoint(rPoint);
                     if ( aRect.Contains( aPos ) )
-                    {
-                        xChild = std::move(xAcc);
-                        break;
-                    }
+                        return xAcc;
                 }
             }
         }
 
-        return xChild;
+        return nullptr;
     }
 
 

Reply via email to