Kaydet (Commit) 4038f553 authored tarafından Justin Luth's avatar Justin Luth

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/21120Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Tested-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst f5151af4
...@@ -988,29 +988,27 @@ AccessibleCell* AccessibleTableShape::GetActiveAccessibleCell() ...@@ -988,29 +988,27 @@ AccessibleCell* AccessibleTableShape::GetActiveAccessibleCell()
//If current active cell is in editing, the focus state should be set to internal text //If current active cell is in editing, the focus state should be set to internal text
bool AccessibleTableShape::SetState (sal_Int16 aState) bool AccessibleTableShape::SetState (sal_Int16 aState)
{ {
AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell(); if( aState == AccessibleStateType::FOCUSED )
bool bStateHasChanged = false;
if (aState == AccessibleStateType::FOCUSED && pActiveAccessibleCell != nullptr)
{ {
return pActiveAccessibleCell->SetState(aState); AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell();
if( pActiveAccessibleCell != nullptr )
return pActiveAccessibleCell->SetState(aState);
} }
else
bStateHasChanged = AccessibleShape::SetState (aState); return AccessibleShape::SetState (aState);
return bStateHasChanged;
} }
//If current active cell is in editing, the focus state should be reset to internal text //If current active cell is in editing, the focus state should be reset to internal text
bool AccessibleTableShape::ResetState (sal_Int16 aState) bool AccessibleTableShape::ResetState (sal_Int16 aState)
{ {
AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell(); if( aState == AccessibleStateType::FOCUSED )
bool bStateHasChanged = false;
if (aState == AccessibleStateType::FOCUSED && pActiveAccessibleCell != nullptr)
{ {
return pActiveAccessibleCell->ResetState(aState); AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell();
if( pActiveAccessibleCell != nullptr )
return pActiveAccessibleCell->ResetState(aState);
} }
else
bStateHasChanged = AccessibleShape::ResetState (aState); return AccessibleShape::ResetState (aState);
return bStateHasChanged;
} }
bool AccessibleTableShape::SetStateDirectly (sal_Int16 aState) bool AccessibleTableShape::SetStateDirectly (sal_Int16 aState)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment