Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions
nsRange.cpp File Reference
#include "nscore.h"
#include "nsRange.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsIDOMNode.h"
#include "nsIDOMDocument.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMDocumentFragment.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsVoidArray.h"
#include "nsIDOMText.h"
#include "nsDOMError.h"
#include "nsIContentIterator.h"
#include "nsIDOMNodeList.h"
#include "nsIParser.h"
#include "nsIComponentManager.h"
#include "nsParserCIID.h"
#include "nsIFragmentContentSink.h"
#include "nsIContentSink.h"
#include "nsIEnumerator.h"
#include "nsIScriptSecurityManager.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptContext.h"
#include "nsIHTMLDocument.h"
#include "nsCRT.h"
#include "nsIJSContextStack.h"
#include "nsHTMLParts.h"
#include "nsContentUtils.h"

Go to the source code of this file.

Classes

class  RangeSubtreeIterator

Defines

#define VALIDATE_ACCESS(node_)

Functions

static NS_DEFINE_CID (kCParserCID, NS_PARSER_CID)
nsresult NS_NewContentIterator (nsIContentIterator **aInstancePtrResult)
nsresult NS_NewContentSubtreeIterator (nsIContentIterator **aInstancePtrResult)
PRBool GetNodeBracketPoints (nsIContent *aNode, nsCOMPtr< nsIDOMNode > *outParent, PRInt32 *outStartOffset, PRInt32 *outEndOffset)
nsresult NS_NewRangeUtils (nsIRangeUtils **aResult)
nsresult NS_NewRange (nsIDOMRange **aResult)

Define Documentation

#define VALIDATE_ACCESS (   node_)
Value:
PR_BEGIN_MACRO                                                                   \
    if (!node_) {                                                                  \
      return NS_ERROR_DOM_NOT_OBJECT_ERR;                                          \
    }                                                                              \
    if (!nsContentUtils::CanCallerAccess(node_)) {                                 \
      return NS_ERROR_DOM_SECURITY_ERR;                                            \
    }                                                                              \
    if (IsDetached()) {                                                            \
      return NS_ERROR_DOM_INVALID_STATE_ERR;                                       \
    }                                                                              \
  PR_END_MACRO

Definition at line 96 of file nsRange.cpp.


Function Documentation

PRBool GetNodeBracketPoints ( nsIContent aNode,
nsCOMPtr< nsIDOMNode > *  outParent,
PRInt32 outStartOffset,
PRInt32 outEndOffset 
)

Definition at line 249 of file nsRange.cpp.

{
  if (!aNode) 
    return PR_FALSE;
  if (!outParent) 
    return PR_FALSE;
  if (!outStartOffset)
    return PR_FALSE;
  if (!outEndOffset)
    return PR_FALSE;
    
  nsIContent* parent = aNode->GetParent();

  if (!parent) // special case for root node
  {
    // can't make a parent/offset pair to represent start or 
    // end of the root node, becasue it has no parent.
    // so instead represent it by (node,0) and (node,numChildren)
    *outParent = do_QueryInterface(aNode);
    PRUint32 indx = aNode->GetChildCount();
    if (!indx)
      return PR_FALSE;
    *outStartOffset = 0;
    *outEndOffset = indx;
  }
  else
  {
    *outParent = do_QueryInterface(parent);
    *outStartOffset = parent->IndexOf(aNode);
    *outEndOffset = *outStartOffset+1;
  }
  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static NS_DEFINE_CID ( kCParserCID  ,
NS_PARSER_CID   
) [static]

Definition at line 299 of file nsContentIterator.cpp.

{
  nsContentIterator * iter = new nsContentIterator();
  if (!iter) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  NS_ADDREF(*aInstancePtrResult = iter);

  return NS_OK;
}

Definition at line 1269 of file nsContentIterator.cpp.

{
  nsContentIterator * iter = new nsContentSubtreeIterator();
  if (!iter) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  NS_ADDREF(*aInstancePtrResult = iter);

  return NS_OK;
}
nsresult NS_NewRange ( nsIDOMRange **  aResult)

Definition at line 366 of file nsRange.cpp.

{
  NS_ENSURE_ARG_POINTER(aResult);

  nsRange * range = new nsRange();
  if (!range) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  return CallQueryInterface(range, aResult);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 300 of file nsRange.cpp.

{
  NS_ENSURE_ARG_POINTER(aResult);

  nsRangeUtils* rangeUtil = new nsRangeUtils();
  if (!rangeUtil) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  return CallQueryInterface(rangeUtil, aResult);
}

Here is the call graph for this function: