From e4f1fd7dba9351bd8a94761682e9d8bac477e07e Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 18 May 2012 10:29:39 +0200 Subject: [PATCH] Bug 755204 - Use nsINode::GetChildCount() in nsHTMLEditRules::MakeSureElemStartsOrEndsOnCR; r=ehsan --- editor/libeditor/html/nsHTMLEditRules.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/editor/libeditor/html/nsHTMLEditRules.cpp b/editor/libeditor/html/nsHTMLEditRules.cpp index cd8e106b504..029f066faf9 100644 --- a/editor/libeditor/html/nsHTMLEditRules.cpp +++ b/editor/libeditor/html/nsHTMLEditRules.cpp @@ -8721,19 +8721,13 @@ nsHTMLEditRules::MakeSureElemStartsOrEndsOnCR(nsIDOMNode *aNode, bool aStarts) } if (!foundCR) { - nsCOMPtr brNode; PRInt32 offset = 0; - if (!aStarts) - { - nsCOMPtr childNodes; - res = aNode->GetChildNodes(getter_AddRefs(childNodes)); - NS_ENSURE_SUCCESS(res, res); - NS_ENSURE_TRUE(childNodes, NS_ERROR_NULL_POINTER); - PRUint32 childCount; - res = childNodes->GetLength(&childCount); - NS_ENSURE_SUCCESS(res, res); - offset = childCount; + if (!aStarts) { + nsCOMPtr node = do_QueryInterface(aNode); + NS_ENSURE_STATE(node); + offset = node->GetChildCount(); } + nsCOMPtr brNode; res = mHTMLEditor->CreateBR(aNode, offset, address_of(brNode)); NS_ENSURE_SUCCESS(res, res); }