Bug 1794265 - Fix infinite loop in PeekOffsetFromLine. r=dholbert

This effectively restores the blockFrame != aPos->mResultFrame check
here:

  66a061bd76 (l1.260)

This is hitting this rather odd code-path from the netscape era, which
is clearly not well tested:

  https://searchfox.org/mozilla-central/rev/ffa4d00965c5281def6d3ddcbcdf6259d38c9b9a/layout/generic/nsIFrame.cpp#8451-8482

I'd happily write a test, but I think I'd need some assistance as I
haven't been able to reproduce this with regular selection APIs / line
movement.

Differential Revision: https://phabricator.services.mozilla.com/D158926
This commit is contained in:
Emilio Cobos Álvarez 2022-10-10 17:01:06 +00:00
Родитель ada494c889
Коммит 3a8f47bb4a
1 изменённых файлов: 5 добавлений и 0 удалений

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

@ -9004,6 +9004,11 @@ nsresult nsIFrame::PeekOffsetForLine(nsPeekOffsetStruct* aPos) {
break;
}
if (aPos->mResultFrame == blockFrame) {
// Make sure block element is not the same as the one we had before.
break;
}
// we've struck another block element with selectable content!
if (aPos->mDirection == eDirPrevious) {
edgeCase = 1; // far edge, search from end backwards