accessibility/source/extended/AccessibleBrowseBox.cxx | 29 ++++------ accessibility/source/extended/AccessibleGridControl.cxx | 9 +-- accessibility/source/standard/accessiblemenubasecomponent.cxx | 6 -- 3 files changed, 19 insertions(+), 25 deletions(-)
New commits: commit 4c1fea101d56a78cf2c16cf4dedb61c2888a44c3 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Oct 28 08:47:29 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Oct 28 12:14:03 2024 +0100 a11y: Return early in AccessibleBrowseBox::getAccessibleAtPoint Change-Id: Idbc3a08d7df6100fe073c2b4b805bfaab68d1c6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175713 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/accessibility/source/extended/AccessibleBrowseBox.cxx b/accessibility/source/extended/AccessibleBrowseBox.cxx index 250040030a5f..b78c6cb65048 100644 --- a/accessibility/source/extended/AccessibleBrowseBox.cxx +++ b/accessibility/source/extended/AccessibleBrowseBox.cxx @@ -134,27 +134,24 @@ AccessibleBrowseBox::getAccessibleAtPoint( const awt::Point& rPoint ) SolarMethodGuard aGuard(getMutex()); ensureIsAlive(); - css::uno::Reference< css::accessibility::XAccessible > xChild; sal_Int32 nIndex = 0; if (mpBrowseBox->ConvertPointToControlIndex(nIndex, VCLUnoHelper::ConvertToVCLPoint(rPoint))) - xChild = mpBrowseBox->CreateAccessibleControl( nIndex ); - else + return mpBrowseBox->CreateAccessibleControl(nIndex); + + // try whether point is in one of the fixed children + // (table, header bars, corner control) + Point aPoint(VCLUnoHelper::ConvertToVCLPoint(rPoint)); + for (nIndex = 0; nIndex < vcl::BBINDEX_FIRSTCONTROL; ++nIndex) { - // try whether point is in one of the fixed children - // (table, header bars, corner control) - Point aPoint(VCLUnoHelper::ConvertToVCLPoint(rPoint)); - for( nIndex = 0; (nIndex < vcl::BBINDEX_FIRSTCONTROL) && !xChild.is(); ++nIndex ) - { - css::uno::Reference< css::accessibility::XAccessible > xCurrChild( implGetFixedChild( nIndex ) ); - css::uno::Reference< css::accessibility::XAccessibleComponent > - xCurrChildComp( xCurrChild, uno::UNO_QUERY ); + css::uno::Reference< css::accessibility::XAccessible > xCurrChild(implGetFixedChild(nIndex)); + css::uno::Reference< css::accessibility::XAccessibleComponent > + xCurrChildComp( xCurrChild, uno::UNO_QUERY ); - if (xCurrChildComp.is() - && VCLUnoHelper::ConvertToVCLRect(xCurrChildComp->getBounds()).Contains(aPoint)) - xChild = std::move(xCurrChild); - } + if (xCurrChildComp.is() + && VCLUnoHelper::ConvertToVCLRect(xCurrChildComp->getBounds()).Contains(aPoint)) + return xCurrChild; } - return xChild; + return nullptr; } commit 9437babbcdcb9a33d82a091d57957e8ff8702db7 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Oct 28 08:43:20 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Oct 28 12:13:56 2024 +0100 a11y: Return early in AccessibleGridControl::getAccessibleAtPoint Change-Id: I0da4d4321f26e83fa8fba41ae49a4d23a0939e00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175712 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/accessibility/source/extended/AccessibleGridControl.cxx b/accessibility/source/extended/AccessibleGridControl.cxx index 483b75ed4c8f..6dcd09748d79 100644 --- a/accessibility/source/extended/AccessibleGridControl.cxx +++ b/accessibility/source/extended/AccessibleGridControl.cxx @@ -146,16 +146,15 @@ AccessibleGridControl::getAccessibleAtPoint( const awt::Point& rPoint ) SolarMutexGuard aSolarGuard; ensureIsAlive(); - css::uno::Reference< css::accessibility::XAccessible > xChild; sal_Int32 nIndex = 0; if (m_aTable.ConvertPointToControlIndex(nIndex, VCLUnoHelper::ConvertToVCLPoint(rPoint))) - xChild = m_aTable.CreateAccessibleControl( nIndex ); + return m_aTable.CreateAccessibleControl(nIndex); else { // try whether point is in one of the fixed children // (table, header bars, corner control) Point aPoint(VCLUnoHelper::ConvertToVCLPoint(rPoint)); - for( nIndex = 0; (nIndex < 3) && !xChild.is(); ++nIndex ) + for (nIndex = 0; nIndex < 3; ++nIndex) { css::uno::Reference< css::accessibility::XAccessible > xCurrChild( implGetFixedChild( nIndex ) ); css::uno::Reference< css::accessibility::XAccessibleComponent > @@ -163,10 +162,10 @@ AccessibleGridControl::getAccessibleAtPoint( const awt::Point& rPoint ) if (xCurrChildComp.is() && VCLUnoHelper::ConvertToVCLRect(xCurrChildComp->getBounds()).Contains(aPoint)) - xChild = std::move(xCurrChild); + return xCurrChild; } } - return xChild; + return nullptr; } commit d8ab848c05c66695eba558530b0955221a3be886 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Oct 28 08:36:53 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Oct 28 12:13:48 2024 +0100 a11y: Return early in OAccessibleMenuBaseComponent::GetChildAt Change-Id: Ia44d7341665e499549fd359f0daa69958647171d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175711 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/accessibility/source/standard/accessiblemenubasecomponent.cxx b/accessibility/source/standard/accessiblemenubasecomponent.cxx index 5369ac3bd2c9..5c9e1e47b637 100644 --- a/accessibility/source/standard/accessiblemenubasecomponent.cxx +++ b/accessibility/source/standard/accessiblemenubasecomponent.cxx @@ -334,7 +334,6 @@ Reference< XAccessible > OAccessibleMenuBaseComponent::GetChild( sal_Int64 i ) Reference< XAccessible > OAccessibleMenuBaseComponent::GetChildAt( const awt::Point& rPoint ) { - Reference< XAccessible > xChild; for ( sal_Int64 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) { Reference< XAccessible > xAcc = getAccessibleChild( i ); @@ -347,14 +346,13 @@ Reference< XAccessible > OAccessibleMenuBaseComponent::GetChildAt( const awt::Po Point aPos = VCLUnoHelper::ConvertToVCLPoint(rPoint); if ( aRect.Contains( aPos ) ) { - xChild = std::move(xAcc); - break; + return xAcc; } } } } - return xChild; + return nullptr; }