Bug 761297 - Simplify debug code in DeleteRangeTxn::Init; r=ehsan

This commit is contained in:
Ms2ger 2012-06-06 09:41:35 +02:00
Родитель 62daf99946
Коммит 54fa2b7140
1 изменённых файлов: 9 добавлений и 28 удалений

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

@ -86,44 +86,25 @@ NS_IMETHODIMP DeleteRangeTxn::Init(nsIEditor *aEditor,
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
#ifdef NS_DEBUG #ifdef DEBUG
{ {
PRUint32 count; nsCOMPtr<nsINode> start = do_QueryInterface(mStartParent);
nsCOMPtr<nsIDOMCharacterData> textNode = do_QueryInterface(mStartParent); MOZ_ASSERT(start);
if (textNode) NS_ASSERTION(mStartOffset <= PRInt32(start->Length()), "bad start offset");
textNode->GetLength(&count);
else
{
nsCOMPtr<nsIDOMNodeList> children;
result = mStartParent->GetChildNodes(getter_AddRefs(children));
NS_ASSERTION(((NS_SUCCEEDED(result)) && children), "bad start child list");
children->GetLength(&count);
}
NS_ASSERTION(mStartOffset<=(PRInt32)count, "bad start offset");
textNode = do_QueryInterface(mEndParent); nsCOMPtr<nsINode> end = do_QueryInterface(mEndParent);
if (textNode) MOZ_ASSERT(end);
textNode->GetLength(&count); NS_ASSERTION(mEndOffset <= PRInt32(end->Length()), "bad end offset");
else
{
nsCOMPtr<nsIDOMNodeList> children;
result = mEndParent->GetChildNodes(getter_AddRefs(children));
NS_ASSERTION(((NS_SUCCEEDED(result)) && children), "bad end child list");
children->GetLength(&count);
}
NS_ASSERTION(mEndOffset<=(PRInt32)count, "bad end offset");
#ifdef NS_DEBUG
if (gNoisy) if (gNoisy)
{ {
printf ("DeleteRange: %d of %p to %d of %p\n", printf ("DeleteRange: %d of %p to %d of %p\n",
mStartOffset, (void *)mStartParent, mEndOffset, (void *)mEndParent); mStartOffset, (void *)mStartParent, mEndOffset, (void *)mEndParent);
} }
#endif
} }
#endif #endif // DEBUG
return result;
return NS_OK;
} }
NS_IMETHODIMP DeleteRangeTxn::DoTransaction(void) NS_IMETHODIMP DeleteRangeTxn::DoTransaction(void)