accessibility/source/extended/accessibletabbar.cxx | 6 +---- accessibility/source/helper/acc_factory.cxx | 24 +++++++++------------ 2 files changed, 13 insertions(+), 17 deletions(-)
New commits: commit c8371b5f1a84191d38185820915f0d93741df1fe Author: Michael Weghorn <[email protected]> AuthorDate: Tue Oct 22 12:23:36 2024 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Oct 22 15:42:52 2024 +0200 a11y: Return early in AccessibleFactory::createAccessibleContext Return the XAccessibleContext reference right away, instead of assigning it to a local variable and returning at the end of the method. Change-Id: Iec47f4158dd40c25482366c33ed4a4642709f641 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175405 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx index d7df60d69ae0..d95d47b214d9 100644 --- a/accessibility/source/helper/acc_factory.cxx +++ b/accessibility/source/helper/acc_factory.cxx @@ -303,8 +303,6 @@ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLX Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXWindow* _pXWindow ) { - Reference< XAccessibleContext > xContext; - VclPtr<vcl::Window> pWindow = _pXWindow->GetWindow(); if ( pWindow ) { @@ -315,50 +313,50 @@ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLX Reference< XAccessible > xAcc( pWindow->GetAccessible() ); if ( xAcc.is() ) { - Reference< XAccessibleContext > xCont( xAcc->getAccessibleContext() ); + Reference<XAccessibleContext > xContext(xAcc->getAccessibleContext()); if ( pWindow->GetType() == WindowType::MENUBARWINDOW || - ( xCont.is() && xCont->getAccessibleRole() == AccessibleRole::POPUP_MENU ) ) + ( xContext.is() && xContext->getAccessibleRole() == AccessibleRole::POPUP_MENU ) ) { - xContext = std::move(xCont); + return xContext; } } } else if ( nType == WindowType::STATUSBAR ) { - xContext = new VCLXAccessibleStatusBar(_pXWindow); + return new VCLXAccessibleStatusBar(_pXWindow); } else if ( nType == WindowType::TABCONTROL ) { - xContext = new VCLXAccessibleTabControl(_pXWindow); + return new VCLXAccessibleTabControl(_pXWindow); } else if ( nType == WindowType::TABPAGE && pWindow->GetAccessibleParentWindow() && pWindow->GetAccessibleParentWindow()->GetType() == WindowType::TABCONTROL ) { - xContext = new VCLXAccessibleTabPageWindow( _pXWindow ); + return new VCLXAccessibleTabPageWindow(_pXWindow); } else if ( nType == WindowType::FLOATINGWINDOW ) { - xContext = new FloatingWindowAccessible( _pXWindow ); + return new FloatingWindowAccessible(_pXWindow); } else if ( nType == WindowType::BORDERWINDOW && hasFloatingChild( pWindow ) ) { - xContext = new FloatingWindowAccessible( _pXWindow ); + return new FloatingWindowAccessible(_pXWindow); } else if ( ( nType == WindowType::HELPTEXTWINDOW ) || ( nType == WindowType::FIXEDLINE ) ) { - xContext = new VCLXAccessibleFixedText(_pXWindow); + return new VCLXAccessibleFixedText(_pXWindow); } else { - xContext = new VCLXAccessibleComponent(_pXWindow); + return new VCLXAccessibleComponent(_pXWindow); } } - return xContext; + return nullptr; } Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXToolBox* _pXWindow ) commit 51a482bc0452003dbbd396cb39bb9c2b1261df64 Author: Michael Weghorn <[email protected]> AuthorDate: Tue Oct 22 12:17:03 2024 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Oct 22 15:42:46 2024 +0200 a11y: Return early in AccessibleTabBar::getAccessibleAtPoint Just return `xAcc` right away instead of first assigning it to a local variable. Change-Id: If11c88266b4ec72b2d5d927e3f28a14bf0cdc304 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175404 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/accessibility/source/extended/accessibletabbar.cxx b/accessibility/source/extended/accessibletabbar.cxx index 55318298d1ae..2b1522f30a28 100644 --- a/accessibility/source/extended/accessibletabbar.cxx +++ b/accessibility/source/extended/accessibletabbar.cxx @@ -354,7 +354,6 @@ namespace accessibility { OExternalLockGuard aGuard( this ); - Reference< XAccessible > xChild; for( sal_Int64 i = 0; i < getAccessibleChildCount(); ++i ) { Reference< XAccessible > xAcc = getAccessibleChild( i ); @@ -367,14 +366,13 @@ namespace accessibility Point aPos = VCLUnoHelper::ConvertToVCLPoint(rPoint); if ( aRect.Contains( aPos ) ) { - xChild = std::move(xAcc); - break; + return xAcc; } } } } - return xChild; + return nullptr; } void AccessibleTabBar::grabFocus( )
