if (PR_TRUE==IsEditable(currentNode))
if (IsEditable(currentNode))
nsresult nsHTMLEditor::GetAbsoluteOffsetsForPoints(nsIDOMNode *aInStartNode,                                                   PRInt32 aInStartOffset,                                                   nsIDOMNode *aInEndNode,                                                   PRInt32 aInEndOffset,                                                   nsIDOMNode *aInCommonParentNode,                                                   PRInt32 &aOutStartOffset,                                                    PRInt32 &aOutEndOffset){  if(!aInStartNode || !aInEndNode || !aInCommonParentNode) { return NS_ERROR_NULL_POINTER; }  nsresult result;  // initialize out params  aOutStartOffset = 0; // default to first char in selection  aOutEndOffset = -1;  // default to total length of text in selection  nsCOMPtr<nsIContentIterator> iter;  result = nsComponentManager::CreateInstance(kCContentIteratorCID, nsnull,                                              NS_GET_IID(nsIContentIterator),                                               getter_AddRefs(iter));  if (NS_FAILED(result)) return result;  if (!iter) return NS_ERROR_NULL_POINTER;      PRUint32 totalLength=0;  nsCOMPtr<nsIDOMCharacterData>textNode;  nsCOMPtr<nsIContent>blockParentContent = do_QueryInterface(aInCommonParentNode);  iter->Init(blockParentContent);  // loop through the content iterator for each content node  nsCOMPtr<nsIContent> content;  result = iter->CurrentNode(getter_AddRefs(content));  while (NS_ENUMERATOR_FALSE == iter->IsDone())  {    textNode = do_QueryInterface(content);    if (textNode)    {      nsCOMPtr<nsIDOMNode>currentNode = do_QueryInterface(textNode);      if (!currentNode) {return NS_ERROR_NO_INTERFACE;}      if (PR_TRUE==IsEditable(currentNode))      {        if (currentNode.get() == aInStartNode)        {          aOutStartOffset = totalLength + aInStartOffset;        }        if (currentNode.get() == aInEndNode)        {          aOutEndOffset = totalLength + aInEndOffset;          break;        }        PRUint32 length;        textNode->GetLength(&length);        totalLength += length;      }    }    iter->Next();    iter->CurrentNode(getter_AddRefs(content));  }  if (-1==aOutEndOffset) {    aOutEndOffset = totalLength;  }  // guarantee that aOutStartOffset <= aOutEndOffset  if (aOutEndOffset<aOutStartOffset)   {    PRInt32 temp;    temp = aOutStartOffset;    aOutStartOffset= aOutEndOffset;    aOutEndOffset = temp;  }  NS_POSTCONDITION(aOutStartOffset <= aOutEndOffset, "start > end");  return result;}