Bug 1732464 - Reverse the order of calls to FindLineContaining in IsLocalAccAtLineStart, so that we can pass prevLineNum as a starting index to accelerate the second call. r=Jamie

Depends on D126587

Differential Revision: https://phabricator.services.mozilla.com/D126588
This commit is contained in:
Jonathan Kew 2021-09-27 08:35:35 +00:00
Родитель ea7fdbb90f
Коммит 98c510163c
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -155,14 +155,14 @@ static bool IsLocalAccAtLineStart(LocalAccessible* aAcc) {
// same line, so we're at the start.
return true;
}
nsAutoLineIterator it = thisBlock->GetLineIterator();
nsAutoLineIterator it = prevBlock->GetLineIterator();
MOZ_ASSERT(it, "GetLineIterator impl in line-container blocks is infallible");
int32_t thisLineNum = it->FindLineContaining(thisLineFrame);
if (thisLineNum < 0) {
int32_t prevLineNum = it->FindLineContaining(prevLineFrame);
if (prevLineNum < 0) {
// Error; play it safe.
return true;
}
int32_t prevLineNum = it->FindLineContaining(prevLineFrame);
int32_t thisLineNum = it->FindLineContaining(thisLineFrame, prevLineNum);
// if the blocks and line numbers are different, that means there's nothing
// before us on the same line, so we're at the start.
return thisLineNum != prevLineNum;