Bug 755310 - Use nsINode::Length() in nsEditor::CreateTxnForDeleteInsertionPoint; r=ehsan

This commit is contained in:
Ms2ger 2012-05-18 10:29:40 +02:00
parent b0334f9c09
commit 63c3854253

View File

@ -4825,19 +4825,10 @@ nsEditor::CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange,
// determine if the insertion point is at the beginning, middle, or end of the node
nsCOMPtr<nsIDOMCharacterData> nodeAsText = do_QueryInterface(node);
nsCOMPtr<nsINode> inode = do_QueryInterface(node);
MOZ_ASSERT(inode);
PRUint32 count=0;
if (nodeAsText)
nodeAsText->GetLength(&count);
else
{
// get the child list and count
nsCOMPtr<nsIDOMNodeList>childList;
result = node->GetChildNodes(getter_AddRefs(childList));
if ((NS_SUCCEEDED(result)) && childList)
childList->GetLength(&count);
}
PRUint32 count = inode->Length();
bool isFirst = (0 == offset);
bool isLast = (count == (PRUint32)offset);