BColumnListView: Optimize check for whether the focus row has moved.

If the new row is not in an open branch, it cannot possibly have
caused the focused row to have moved, and so we need neither check
nor perform an invalidation if that is the case.

This code has been this way since it was originally imported into
Vision's (!) CVS repository in 2001 from some Be sample code area,
and has not been substantially changed since it was imported into
Haiku's repository in 2004.

This saves quite a number of app_server round-trips and redraws
when importing lots of rows to the list, which fixes the other half
of the hang when changing functions in the call stack in Debugger.
This commit is contained in:
Augustin Cavalier 2022-08-31 00:13:24 -04:00
parent 29335bd389
commit cd3045596e

View File

@ -4387,16 +4387,16 @@ OutlineView::AddRow(BRow* row, int32 Index, BRow* parentRow)
FixScrollBar(false);
BRect newRowRect;
bool newRowIsInOpenBranch = FindRect(row, &newRowRect);
if (fFocusRow && fFocusRowRect.top > newRowRect.bottom) {
// The focus row has moved.
Invalidate(fFocusRowRect);
FindRect(fFocusRow, &fFocusRowRect);
Invalidate(fFocusRowRect);
}
const bool newRowIsInOpenBranch = FindRect(row, &newRowRect);
if (newRowIsInOpenBranch) {
if (fFocusRow && fFocusRowRect.top > newRowRect.bottom) {
// The focus row has moved.
Invalidate(fFocusRowRect);
FindRect(fFocusRow, &fFocusRowRect);
Invalidate(fFocusRowRect);
}
if (fCurrentState == INACTIVE) {
if (newRowRect.bottom < fVisibleRect.top) {
// The new row is totally above the current viewport, move