Fix for bug 124209 (Deleting selection in plain text reply compose causes hang)

and bug 124375 (composer / editor hang when delete blank lines)

Allow start/end points to be set to empty text nodes to prevent
infinite loop.

r=glazman@netscape.com  sr=sfraser@netscape.com,shaver@mozilla.org
This commit is contained in:
kin%netscape.com 2002-02-08 15:20:19 +00:00
Родитель 06cd3f148a
Коммит 81eb5f8e2f
1 изменённых файлов: 58 добавлений и 38 удалений

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

@ -748,6 +748,15 @@ nsWSRunObject::GetWSNodes()
PRInt32 len;
res = textNode->GetTextLength(&len);
NS_ENSURE_SUCCESS(res, res);
if (len < 1)
{
// Zero length text node. Set start point to it
// so we can get past it!
start.SetPoint(priorNode,0);
}
else
{
PRInt32 pos;
for (pos=len-1; pos>=0; pos--)
{
@ -774,6 +783,7 @@ nsWSRunObject::GetWSNodes()
start.SetPoint(priorNode,pos);
}
}
}
else
{
// it's a break or a special node, like <img>, that is not a block and not
@ -859,6 +869,15 @@ nsWSRunObject::GetWSNodes()
PRInt32 len;
res = textNode->GetTextLength(&len);
NS_ENSURE_SUCCESS(res, res);
if (len < 1)
{
// Zero length text node. Set end point to it
// so we can get past it!
end.SetPoint(nextNode,0);
}
else
{
PRInt32 pos;
for (pos=0; pos<len; pos++)
{
@ -885,6 +904,7 @@ nsWSRunObject::GetWSNodes()
end.SetPoint(nextNode,pos+1);
}
}
}
else
{
// we encountered a break or a special node, like <img>,