Back to index

lightning-sunbird  0.9+nobinonly
nsFilteredContentIterator.cpp File Reference
#include "nsFilteredContentIterator.h"
#include "nsIContentIterator.h"
#include "nsComponentManagerUtils.h"
#include "nsIContent.h"
#include "nsString.h"
#include "nsIEnumerator.h"
#include "nsTextServicesDocument.h"
#include "nsIDOMNode.h"
#include "nsIDOMRange.h"

Go to the source code of this file.


static void ContentToParentOffset (nsIContent *aContent, nsIDOMNode **aParent, PRInt32 *aOffset)
static PRBool ContentIsInTraversalRange (nsIContent *aContent, PRBool aIsPreMode, nsIDOMNode *aStartNode, PRInt32 aStartOffset, nsIDOMNode *aEndNode, PRInt32 aEndOffset)
static PRBool ContentIsInTraversalRange (nsIDOMNSRange *aRange, nsIDOMNode *aNextNode, PRBool aIsPreMode)

Function Documentation

static PRBool ContentIsInTraversalRange ( nsIContent aContent,
PRBool  aIsPreMode,
nsIDOMNode aStartNode,
PRInt32  aStartOffset,
nsIDOMNode aEndNode,
PRInt32  aEndOffset 
) [static]

Definition at line 231 of file nsFilteredContentIterator.cpp.

  if (!aStartNode || !aEndNode || !aContent)
    return PR_FALSE;

  nsCOMPtr<nsIDOMNode> parentNode;
  PRInt32 indx = 0;

  ContentToParentOffset(aContent, getter_AddRefs(parentNode), &indx);

  if (!parentNode)
    return PR_FALSE;

  if (!aIsPreMode)

  PRInt32 startRes;
  PRInt32 endRes;
  nsresult rv = nsTextServicesDocument::ComparePoints(aStartNode, aStartOffset, parentNode, indx, &startRes);
  if (NS_FAILED(rv)) return PR_FALSE;

  rv = nsTextServicesDocument::ComparePoints(aEndNode,   aEndOffset,   parentNode, indx,  &endRes);
  if (NS_FAILED(rv)) return PR_FALSE;

  return (startRes <= 0) && (endRes >= 0);

Here is the call graph for this function:

static PRBool ContentIsInTraversalRange ( nsIDOMNSRange aRange,
nsIDOMNode aNextNode,
PRBool  aIsPreMode 
) [static]

Definition at line 261 of file nsFilteredContentIterator.cpp.

  nsCOMPtr<nsIContent>  content(do_QueryInterface(aNextNode));
  nsCOMPtr<nsIDOMRange> range(do_QueryInterface(aRange));
  if (!content || !range)
    return PR_FALSE;

  nsCOMPtr<nsIDOMNode> sNode;
  nsCOMPtr<nsIDOMNode> eNode;
  PRInt32 sOffset;
  PRInt32 eOffset;
  return ContentIsInTraversalRange(content, aIsPreMode, sNode, sOffset, eNode, eOffset);

Here is the call graph for this function:

static void ContentToParentOffset ( nsIContent aContent,
nsIDOMNode **  aParent,
PRInt32 aOffset 
) [static]

Definition at line 204 of file nsFilteredContentIterator.cpp.

  if (!aParent || !aOffset)

  *aParent = nsnull;
  *aOffset  = 0;

  if (!aContent)

  nsIContent* parent = aContent->GetParent();

  if (!parent)

  *aOffset = parent->IndexOf(aContent);

  CallQueryInterface(parent, aParent);

Here is the call graph for this function:

Here is the caller graph for this function: