Bug 680279 - Splitting Gmail rich-text list with Enter misplaces the caret; r=ehsan

The patch for bug 674861 has introduced a regression.
When a list is splitted, a new paragraph should inserted before the new list.
This commit is contained in:
Fabien Cazenave
2011-08-19 18:14:04 -04:00
parent b656001a60
commit 74593b8409
2 changed files with 102 additions and 34 deletions

View File

@@ -6789,6 +6789,12 @@ nsHTMLEditRules::ReturnInListItem(nsISelection *aSelection,
NS_ENSURE_SUCCESS(res, res);
if (isEmpty && (rootNode != list) && mReturnInEmptyLIKillsList)
{
// get the list offset now -- before we might eventually split the list
nsCOMPtr<nsIDOMNode> listparent;
PRInt32 offset;
res = nsEditor::GetNodeLocation(list, address_of(listparent), &offset);
NS_ENSURE_SUCCESS(res, res);
// are we the last list item in the list?
PRBool bIsLast;
res = mHTMLEditor->IsLastEditableChild(aListItem, &bIsLast);
@@ -6802,10 +6808,6 @@ nsHTMLEditRules::ReturnInListItem(nsISelection *aSelection,
}
// are we in a sublist?
nsCOMPtr<nsIDOMNode> listparent;
PRInt32 offset;
res = nsEditor::GetNodeLocation(list, address_of(listparent), &offset);
NS_ENSURE_SUCCESS(res, res);
if (nsHTMLEditUtils::IsList(listparent)) //in a sublist
{
// if so, move this list item out of this list and into the grandparent list