Back to index

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

List of all members.

Public Member Functions

 nsLeafIterator (nsPresContext *aPresContext, nsIFrame *start)
void SetExtensive (PRBool aExtensive)
PRBool GetExtensive ()
void SetLockInScrollView (PRBool aLockScroll)
NS_DECL_ISUPPORTS NS_IMETHOD First ()
NS_IMETHOD Last ()
NS_IMETHOD CurrentItem (nsISupports **aItem)
NS_IMETHOD IsDone ()
void last ()
 Last will reset the list to the end.
void prev ()
 Prev will decrement the list.
void first ()
 First will reset the list.
void next ()
 Next will advance the list.
nsISupports currentItem ()
 CurrentItem will return the CurrentItem item it will fail if the list is empty.
void isDone ()
 return if the collection is at the end.

Protected Member Functions

void setCurrent (nsIFrame *aFrame)
nsIFramegetCurrent ()
void setStart (nsIFrame *aFrame)
nsIFramegetStart ()
nsIFramegetLast ()
void setLast (nsIFrame *aFrame)
PRInt8 getOffEdge ()
void setOffEdge (PRInt8 aOffEdge)

Private Member Functions

NS_IMETHOD Next ()
NS_IMETHOD Prev ()

Private Attributes

nsPresContextmPresContext
PRPackedBool mExtensive
PRBool mLockScroll

Detailed Description

Definition at line 94 of file nsFrameTraversal.cpp.


Constructor & Destructor Documentation

nsLeafIterator::nsLeafIterator ( nsPresContext aPresContext,
nsIFrame start 
)

Definition at line 325 of file nsFrameTraversal.cpp.

  : mPresContext(aPresContext)
{
  setStart(aStart);
  setCurrent(aStart);
  setLast(aStart);
  SetLockInScrollView(PR_FALSE);
}

Here is the call graph for this function:


Member Function Documentation

NS_IMETHODIMP nsFrameIterator::CurrentItem ( nsISupports **  aItem) [inherited]

Definition at line 283 of file nsFrameTraversal.cpp.

{
  if (!aItem)
    return NS_ERROR_NULL_POINTER;
  *aItem = mCurrent;
  if (mOffEdge)
    return NS_ENUMERATOR_FALSE;
  return NS_OK;
}
nsISupports nsIEnumerator::currentItem ( ) [inherited]

CurrentItem will return the CurrentItem item it will fail if the list is empty.

Definition at line 306 of file nsFrameTraversal.cpp.

{
  mCurrent = mStart;
  return NS_OK;
}
void nsIEnumerator::first ( ) [inherited]

First will reset the list.

will return NS_FAILED if no items

nsIFrame* nsFrameIterator::getCurrent ( ) [inline, protected, inherited]

Definition at line 66 of file nsFrameTraversal.cpp.

{return mCurrent;}

Here is the caller graph for this function:

Definition at line 99 of file nsFrameTraversal.cpp.

{return mExtensive;}
nsIFrame* nsFrameIterator::getLast ( ) [inline, protected, inherited]

Definition at line 69 of file nsFrameTraversal.cpp.

{return mLast;}

Here is the caller graph for this function:

PRInt8 nsFrameIterator::getOffEdge ( ) [inline, protected, inherited]

Definition at line 71 of file nsFrameTraversal.cpp.

{return mOffEdge;}
nsIFrame* nsFrameIterator::getStart ( ) [inline, protected, inherited]

Definition at line 68 of file nsFrameTraversal.cpp.

{return mStart;}

Definition at line 296 of file nsFrameTraversal.cpp.

{
  if (mOffEdge != 0)
    return NS_OK;
  return NS_ENUMERATOR_FALSE;
}
void nsIEnumerator::isDone ( ) [inherited]

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

Reimplemented in nsFocusIterator.

Definition at line 315 of file nsFrameTraversal.cpp.

{
  return NS_ERROR_FAILURE;
}

Last will reset the list to the end.

will return NS_FAILED if no items

void nsIEnumerator::next ( ) [inherited]

Next will advance the list.

will return failed if already at end

NS_IMETHODIMP nsLeafIterator::Next ( ) [private, virtual]

Implements nsFrameIterator.

Definition at line 343 of file nsFrameTraversal.cpp.

{
//recursive-oid method to get next frame
  nsIFrame *result = nsnull;
  nsIFrame *parent = getCurrent();
  if (!parent)
    parent = getLast();
  if (!mExtensive)
  {
    while (nsnull != (result = parent->GetFirstChild(nsnull)))
    {
      parent = result;
    }
  }
  if (parent != getCurrent())
  {
    result = parent;
  }
  else {
    while(parent) {
      result = parent->GetNextSibling();
      if (result) {
        parent = result;
        while (nsnull != (result = parent->GetFirstChild(nsnull)))
          {
            parent = result;
          }
        result = parent;
        break;
      }
      else
      {
        result = parent->GetParent();
        if (!result || IsRootFrame(result)) {
          result = nsnull;
          break;
        }
        else 
        {
          parent = result;
          // check if  FrameType of result is TextInputFrame
          if (mLockScroll) //lock the traversal when we hit a scroll frame
          {
            if ( result->GetType() == nsLayoutAtoms::scrollFrame )
              return NS_ERROR_FAILURE;
          }
          if (mExtensive)
            break;
        }  
      }
    }
  }
  setCurrent(result);
  if (!result)
    setOffEdge(1);
  return NS_OK;
}

Here is the call graph for this function:

Prev will decrement the list.

will return failed if already at beginning

NS_IMETHODIMP nsLeafIterator::Prev ( ) [private, virtual]

Implements nsFrameIterator.

Definition at line 405 of file nsFrameTraversal.cpp.

{
//recursive-oid method to get prev frame
  nsIFrame *result = nsnull;
  nsIFrame *parent = getCurrent();
  if (!parent)
    parent = getLast();

  while (parent){
    nsIFrame *grandParent = parent->GetParent();
    if (grandParent) 
    {
      // check if  FrameType of grandParent is TextInputFrame
      if (mLockScroll) //lock the traversal when we hit a scroll frame
      {
        nsIAtom* atom = grandParent->GetType();
  #ifdef DEBUG_skamio
        if ( atom ) 
        {
          nsAutoString aString;
          res = atom->ToString(aString);
          if ( NS_SUCCEEDED(res) ) {
            printf("%s:%d\n", __FILE__, __LINE__);
            printf("FrameType: %s\n", NS_ConvertUCS2toUTF8(aString).get());
          }
        }
  #endif
        if ( atom == nsLayoutAtoms::scrollFrame ) 
          return NS_ERROR_FAILURE;
      }
      result = grandParent->GetFirstChild(nsnull);
      nsFrameList list(result);
      result = list.GetPrevSiblingFor(parent);
      if (result)
      {
        parent = result;
        while (nsnull != (result = parent->GetFirstChild(nsnull)))
        {
          parent = result;
          while ((result = parent->GetNextSibling()) != nsnull)
          {
            parent = result;
          }
        }
        result = parent;
        break;
      }
      else if (!(result = parent->GetParent()))
      {
        result = nsnull;
        break;
      }
      else 
      {
        parent = result;
        if (mExtensive)
          break;
      }
    }
    else
    {
      setLast(parent);
      result = nsnull;
      break;
    }
  }

  setCurrent(result);
  if (!result)
    setOffEdge(-1);
  return NS_OK;
}

Here is the call graph for this function:

void nsFrameIterator::setCurrent ( nsIFrame aFrame) [inline, protected, inherited]

Definition at line 65 of file nsFrameTraversal.cpp.

{mCurrent = aFrame;}

Here is the caller graph for this function:

void nsLeafIterator::SetExtensive ( PRBool  aExtensive) [inline]

Definition at line 98 of file nsFrameTraversal.cpp.

{mExtensive = aExtensive;}

Here is the caller graph for this function:

void nsFrameIterator::setLast ( nsIFrame aFrame) [inline, protected, inherited]

Definition at line 70 of file nsFrameTraversal.cpp.

{mLast = aFrame;}

Here is the caller graph for this function:

void nsLeafIterator::SetLockInScrollView ( PRBool  aLockScroll) [inline]

Definition at line 100 of file nsFrameTraversal.cpp.

{mLockScroll = aLockScroll;}

Here is the caller graph for this function:

void nsFrameIterator::setOffEdge ( PRInt8  aOffEdge) [inline, protected, inherited]

Definition at line 72 of file nsFrameTraversal.cpp.

{mOffEdge = aOffEdge;}

Here is the caller graph for this function:

void nsFrameIterator::setStart ( nsIFrame aFrame) [inline, protected, inherited]

Definition at line 67 of file nsFrameTraversal.cpp.

{mStart = aFrame;}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 108 of file nsFrameTraversal.cpp.

Definition at line 109 of file nsFrameTraversal.cpp.

Definition at line 107 of file nsFrameTraversal.cpp.


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