Logo Search packages:      
Sourcecode: firefox-3.5 version File versions  Download package

nsresult nsEditor::GetNextNode ( nsIDOMNode aCurrentNode,
PRBool  aEditableNode,
nsCOMPtr< nsIDOMNode > *  aResultNode,
PRBool  bNoBlockCrossing = PR_FALSE 
) [inherited]

get the node immediately after to aCurrentNode

aCurrentNode the node from which we start the search
aEditableNode if PR_TRUE, only return an editable node
aResultNode [OUT] the node that occurs after aCurrentNode in the tree, skipping non-editable nodes if aEditableNode is PR_TRUE. If there is no prior node, aResultNode will be nsnull.

Definition at line 3533 of file nsEditor.cpp.

References nsEditor::IsEditable(), and nsEditor::IsRootNode().

Referenced by nsEditor::GetFirstEditableNode().

  if (!aCurrentNode || !aResultNode) { return NS_ERROR_NULL_POINTER; }
  *aResultNode = nsnull;  // init out-param

  if (IsRootNode(aCurrentNode))
    // Don't allow traversal above the root node! This helps
    // prevent us from accidentally editing browser content
    // when the editor is in a text widget.

    return NS_OK;

  nsCOMPtr<nsIDOMNode> candidate;
  nsresult result = GetNextNodeImpl(aCurrentNode, aEditableNode,
                                    address_of(candidate), bNoBlockCrossing);
  if (NS_FAILED(result)) return result;
  if (!candidate)
    // we could not find a next node.  return null.
    *aResultNode = nsnull;
    return NS_OK;
  else if (!aEditableNode) *aResultNode = candidate;
  else if (IsEditable(candidate)) *aResultNode = candidate;
  { // restart the search from the non-editable node we just found
    nsCOMPtr<nsIDOMNode> notEditableNode = do_QueryInterface(candidate);
    return GetNextNode(notEditableNode, aEditableNode, aResultNode, bNoBlockCrossing);
  return result;

Generated by  Doxygen 1.6.0   Back to index