fix for 38991: making lists screwed up

This commit is contained in:
jfrancis%netscape.com 2000-05-12 23:43:50 +00:00
Родитель fdc271ace2
Коммит 1ccf4a309f
2 изменённых файлов: 14 добавлений и 2 удалений

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

@ -1819,6 +1819,7 @@ nsHTMLEditRules::CreateStyleForInsertText(nsIDOMSelection *aSelection, nsIDOMDoc
if (!aSelection || !aDoc) return NS_ERROR_NULL_POINTER;
if (!mEditor->mTypeInState) return NS_ERROR_NULL_POINTER;
PRBool weDidSometing = PR_FALSE;
nsCOMPtr<nsIDOMNode> node;
PRInt32 offset;
nsresult res = mEditor->GetStartNodeAndOffset(aSelection, &node, &offset);
@ -1834,6 +1835,7 @@ nsHTMLEditRules::CreateStyleForInsertText(nsIDOMSelection *aSelection, nsIDOMDoc
// we own item now (TakeClearProperty hands ownership to us)
delete item;
mEditor->mTypeInState->TakeClearProperty(&item);
weDidSometing = PR_TRUE;
}
// then process setting any styles
@ -1860,6 +1862,7 @@ nsHTMLEditRules::CreateStyleForInsertText(nsIDOMSelection *aSelection, nsIDOMDoc
if (NS_FAILED(res)) return res;
node = newNode;
offset = 0;
weDidSometing = PR_TRUE;
}
while (item)
@ -1871,7 +1874,10 @@ nsHTMLEditRules::CreateStyleForInsertText(nsIDOMSelection *aSelection, nsIDOMDoc
mEditor->mTypeInState->TakeSetProperty(&item);
}
return aSelection->Collapse(node, offset);
if (weDidSometing)
return aSelection->Collapse(node, offset);
return res;
}

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

@ -1819,6 +1819,7 @@ nsHTMLEditRules::CreateStyleForInsertText(nsIDOMSelection *aSelection, nsIDOMDoc
if (!aSelection || !aDoc) return NS_ERROR_NULL_POINTER;
if (!mEditor->mTypeInState) return NS_ERROR_NULL_POINTER;
PRBool weDidSometing = PR_FALSE;
nsCOMPtr<nsIDOMNode> node;
PRInt32 offset;
nsresult res = mEditor->GetStartNodeAndOffset(aSelection, &node, &offset);
@ -1834,6 +1835,7 @@ nsHTMLEditRules::CreateStyleForInsertText(nsIDOMSelection *aSelection, nsIDOMDoc
// we own item now (TakeClearProperty hands ownership to us)
delete item;
mEditor->mTypeInState->TakeClearProperty(&item);
weDidSometing = PR_TRUE;
}
// then process setting any styles
@ -1860,6 +1862,7 @@ nsHTMLEditRules::CreateStyleForInsertText(nsIDOMSelection *aSelection, nsIDOMDoc
if (NS_FAILED(res)) return res;
node = newNode;
offset = 0;
weDidSometing = PR_TRUE;
}
while (item)
@ -1871,7 +1874,10 @@ nsHTMLEditRules::CreateStyleForInsertText(nsIDOMSelection *aSelection, nsIDOMDoc
mEditor->mTypeInState->TakeSetProperty(&item);
}
return aSelection->Collapse(node, offset);
if (weDidSometing)
return aSelection->Collapse(node, offset);
return res;
}