svx/source/table/accessibletableshape.cxx | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
New commits: commit 4038f5535658c0e0fb5e3711974f48ef4a96b30a Author: Justin Luth <justin_l...@sil.org> Date: Tue Jan 5 15:53:48 2016 +0300 optimize performance - avoid GetActiveAccessibleCell call pActiveAccessibleCell is only needed when the "FOCUSED" state is being set. Many other states are also set with the SetState function. Avoid the GetActiveAccessibleCell function call when processing these states. Change-Id: Ib317f0f4b290cc8d33f7af7f450e35c8b1f7f924 Reviewed-on: https://gerrit.libreoffice.org/21120 Reviewed-by: Justin Luth <justin_l...@sil.org> Reviewed-by: Noel Grandin <noelgran...@gmail.com> Tested-by: Noel Grandin <noelgran...@gmail.com> diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx index ce43969..aa24c1b 100644 --- a/svx/source/table/accessibletableshape.cxx +++ b/svx/source/table/accessibletableshape.cxx @@ -988,29 +988,27 @@ AccessibleCell* AccessibleTableShape::GetActiveAccessibleCell() //If current active cell is in editing, the focus state should be set to internal text bool AccessibleTableShape::SetState (sal_Int16 aState) { - AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell(); - bool bStateHasChanged = false; - if (aState == AccessibleStateType::FOCUSED && pActiveAccessibleCell != nullptr) + if( aState == AccessibleStateType::FOCUSED ) { - return pActiveAccessibleCell->SetState(aState); + AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell(); + if( pActiveAccessibleCell != nullptr ) + return pActiveAccessibleCell->SetState(aState); } - else - bStateHasChanged = AccessibleShape::SetState (aState); - return bStateHasChanged; + + return AccessibleShape::SetState (aState); } //If current active cell is in editing, the focus state should be reset to internal text bool AccessibleTableShape::ResetState (sal_Int16 aState) { - AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell(); - bool bStateHasChanged = false; - if (aState == AccessibleStateType::FOCUSED && pActiveAccessibleCell != nullptr) + if( aState == AccessibleStateType::FOCUSED ) { - return pActiveAccessibleCell->ResetState(aState); + AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell(); + if( pActiveAccessibleCell != nullptr ) + return pActiveAccessibleCell->ResetState(aState); } - else - bStateHasChanged = AccessibleShape::ResetState (aState); - return bStateHasChanged; + + return AccessibleShape::ResetState (aState); } bool AccessibleTableShape::SetStateDirectly (sal_Int16 aState) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits