Bug 572598 - Part 6: Don't try to split a node which can't contain a list when inserting one; r=roc

This commit is contained in:
Ehsan Akhgari
2010-06-21 11:02:14 -04:00
parent 18a05d34d6
commit 660ff7b0b5

View File

@@ -3080,6 +3080,10 @@ nsHTMLEditRules::WillMakeList(nsISelection *aSelection,
NS_ENSURE_SUCCESS(res, res);
// make sure we can put a list here
if (!mHTMLEditor->CanContainTag(parent, *aListType)) {
*aCancel = PR_TRUE;
return NS_OK;
}
res = SplitAsNeeded(aListType, address_of(parent), &offset);
NS_ENSURE_SUCCESS(res, res);
res = mHTMLEditor->CreateNode(*aListType, parent, offset, getter_AddRefs(theList));