Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Attributes
nsFrameContentIterator Class Reference
Inheritance diagram for nsFrameContentIterator:
Inheritance graph
[legend]
Collaboration diagram for nsFrameContentIterator:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsFrameContentIterator (nsPresContext *aPresContext, nsIFrame *aFrame)
virtual ~nsFrameContentIterator ()
virtual NS_DECL_ISUPPORTS nsresult Init (nsIContent *aRoot)
virtual nsresult Init (nsIDOMRange *aRange)
virtual void First ()
 First will reset the list.
virtual void Last ()
 Last will reset the list to the end.
virtual void Next ()
 Next will advance the list.
virtual void Prev ()
 Prev will decrement the list.
virtual nsIContentGetCurrentNode ()
 CurrentItem will return the current item, or null if the list is empty.
virtual PRBool IsDone ()
 return if the collection is at the end.
virtual nsresult PositionAt (nsIContent *aCurNode)
 PositionAt will position the iterator to the supplied node.

Private Attributes

nsCOMPtr< nsPresContextmPresContext
nsIFramemParentFrame
nsIFramemCurrentChild
PRBool mIsDone

Detailed Description

Definition at line 47 of file nsFrameContentIterator.cpp.


Constructor & Destructor Documentation

Definition at line 76 of file nsFrameContentIterator.cpp.

  : mPresContext(aPresContext), mParentFrame(aFrame), mIsDone(PR_FALSE)
{
  First();
}

Here is the call graph for this function:

Definition at line 85 of file nsFrameContentIterator.cpp.

{
}

Member Function Documentation

First will reset the list.

Implements nsIContentIterator.

Definition at line 102 of file nsFrameContentIterator.cpp.

{
  // Get the first child frame and make it the current node
  mCurrentChild = mParentFrame->GetFirstChild(nsnull);

  mIsDone = !mCurrentChild;
}

Here is the call graph for this function:

Here is the caller graph for this function:

CurrentItem will return the current item, or null if the list is empty.

Returns:
the current node

Implements nsIContentIterator.

Definition at line 228 of file nsFrameContentIterator.cpp.

{
  if (mCurrentChild && !mIsDone) {
    return mCurrentChild->GetContent();
  }

  return nsnull;
}

Here is the call graph for this function:

Implements nsIContentIterator.

Definition at line 90 of file nsFrameContentIterator.cpp.

Implements nsIContentIterator.

Definition at line 96 of file nsFrameContentIterator.cpp.

return if the collection is at the end.

that is the beginning following a call to Prev and it is the end of the list following a call to next

Returns:
if the iterator is done.

Implements nsIContentIterator.

Definition at line 238 of file nsFrameContentIterator.cpp.

{
  return mIsDone;
}

Last will reset the list to the end.

Implements nsIContentIterator.

Definition at line 136 of file nsFrameContentIterator.cpp.

{
  // Starting with the first child walk and find the last child
  mCurrentChild = nsnull;
  nsIFrame* nextChild = mParentFrame->GetFirstChild(nsnull);
  while (nextChild) {
    mCurrentChild = nextChild;
    nextChild = ::GetNextChildFrame(mPresContext, nextChild);
  }

  mIsDone = !mCurrentChild;
}

Here is the call graph for this function:

Next will advance the list.

Implements nsIContentIterator.

Definition at line 150 of file nsFrameContentIterator.cpp.

{
  nsIFrame* nextChild = ::GetNextChildFrame(mPresContext, mCurrentChild);

  if (nextChild) {
    // Advance to the next child
    mCurrentChild = nextChild;

    // If we're at the end then the collection is at the end
    mIsDone = (nsnull == ::GetNextChildFrame(mPresContext, mCurrentChild));

    return;
  }

  // No next frame, we're done.
  mIsDone = PR_TRUE;
}

Here is the call graph for this function:

PositionAt will position the iterator to the supplied node.

Implements nsIContentIterator.

Definition at line 244 of file nsFrameContentIterator.cpp.

{
  // Starting with the first child frame search for the child frame
  // with the matching content object
  nsIFrame* child = mParentFrame->GetFirstChild(nsnull);
  while (child) {
    if (child->GetContent() == aCurNode) {
      break;
    }
    child = ::GetNextChildFrame(mPresContext, child);
  }

  if (child) {
    // Make it the current child
    mCurrentChild = child;
    mIsDone = PR_FALSE;
  }

  return NS_OK;
}

Here is the call graph for this function:

Prev will decrement the list.

Implements nsIContentIterator.

Definition at line 209 of file nsFrameContentIterator.cpp.

{
  nsIFrame* prevChild = ::GetPrevChildFrame(mPresContext, mCurrentChild);

  if (prevChild) {
    // Make the previous child the current child
    mCurrentChild = prevChild;
    
    // If we're at the beginning then the collection is at the end
    mIsDone = (nsnull == ::GetPrevChildFrame(mPresContext, mCurrentChild));

    return;
  }

  // No previous frame, we're done.
  mIsDone = PR_TRUE;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 72 of file nsFrameContentIterator.cpp.

Definition at line 73 of file nsFrameContentIterator.cpp.

Definition at line 71 of file nsFrameContentIterator.cpp.

Definition at line 70 of file nsFrameContentIterator.cpp.


The documentation for this class was generated from the following file: