зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
06cd3f148a
Коммит
81eb5f8e2f
|
@ -748,6 +748,15 @@ nsWSRunObject::GetWSNodes()
|
||||||
PRInt32 len;
|
PRInt32 len;
|
||||||
res = textNode->GetTextLength(&len);
|
res = textNode->GetTextLength(&len);
|
||||||
NS_ENSURE_SUCCESS(res, res);
|
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;
|
PRInt32 pos;
|
||||||
for (pos=len-1; pos>=0; pos--)
|
for (pos=len-1; pos>=0; pos--)
|
||||||
{
|
{
|
||||||
|
@ -774,6 +783,7 @@ nsWSRunObject::GetWSNodes()
|
||||||
start.SetPoint(priorNode,pos);
|
start.SetPoint(priorNode,pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// it's a break or a special node, like <img>, that is not a block and not
|
// 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;
|
PRInt32 len;
|
||||||
res = textNode->GetTextLength(&len);
|
res = textNode->GetTextLength(&len);
|
||||||
NS_ENSURE_SUCCESS(res, res);
|
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;
|
PRInt32 pos;
|
||||||
for (pos=0; pos<len; pos++)
|
for (pos=0; pos<len; pos++)
|
||||||
{
|
{
|
||||||
|
@ -885,6 +904,7 @@ nsWSRunObject::GetWSNodes()
|
||||||
end.SetPoint(nextNode,pos+1);
|
end.SetPoint(nextNode,pos+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// we encountered a break or a special node, like <img>,
|
// we encountered a break or a special node, like <img>,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче