nsTextRulesInfo ruleInfo(nsHTMLEditRules::kMakeBasicBlock);
nsTextRulesInfo ruleInfo(nsTextEditRules::kMakeBasicBlock);
nsHTMLEditor::InsertBasicBlock(const nsString& aBlockType){  nsresult res;  if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }  nsCOMPtr<nsIDOMSelection> selection;  PRBool cancel, handled;  nsAutoEditBatch beginBatching(this);  nsAutoRules beginRulesSniffing(this, kOpMakeBasicBlock, nsIEditor::eNext);    // pre-process  res = GetSelection(getter_AddRefs(selection));  if (NS_FAILED(res)) return res;  if (!selection) return NS_ERROR_NULL_POINTER;  nsTextRulesInfo ruleInfo(nsHTMLEditRules::kMakeBasicBlock);  ruleInfo.blockType = &aBlockType;  res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);  if (cancel || (NS_FAILED(res))) return res;  if (!handled)  {    // Find out if the selection is collapsed:    PRBool isCollapsed;    res = selection->GetIsCollapsed(&isCollapsed);    if (NS_FAILED(res)) return res;    nsCOMPtr<nsIDOMNode> node;    PRInt32 offset;      res = GetStartNodeAndOffset(selection, &node, &offset);    if (!node) res = NS_ERROR_FAILURE;    if (NS_FAILED(res)) return res;      if (isCollapsed)    {      // have to find a place to put the block      nsCOMPtr<nsIDOMNode> parent = node;      nsCOMPtr<nsIDOMNode> topChild = node;      nsCOMPtr<nsIDOMNode> tmp;          while ( !CanContainTag(parent, aBlockType))      {        parent->GetParentNode(getter_AddRefs(tmp));        if (!tmp) return NS_ERROR_FAILURE;        topChild = parent;        parent = tmp;      }          if (parent != node)      {        // we need to split up to the child of parent        res = SplitNodeDeep(topChild, node, offset, &offset);        if (NS_FAILED(res)) return res;      }      // make a block      nsCOMPtr<nsIDOMNode> newBlock;      res = CreateNode(aBlockType, parent, offset, getter_AddRefs(newBlock));      if (NS_FAILED(res)) return res;          // xxx// i'm def'ing this out to see if auto br insertion is working for this case#if 0          // put a space in it so layout will draw it      res = selection->Collapse(newBlock,0);      if (NS_FAILED(res)) return res;      nsAutoString theText(nbsp);      res = InsertText(theText);      if (NS_FAILED(res)) return res;#endif      // reposition selection to before the space character      res = GetStartNodeAndOffset(selection, &node, &offset);      if (NS_FAILED(res)) return res;      res = selection->Collapse(node,0);      if (NS_FAILED(res)) return res;      }  }  res = mRules->DidDoAction(selection, &ruleInfo, res);  return res;}