Classes | Public Member Functions | Static Public Member Functions | Protected Attributes

nsFrameList Class Reference

A class for managing a list of frames. More...

#include <nsFrameList.h>

Collaboration diagram for nsFrameList:

List of all members.

Classes

class  Enumerator
class  FrameLinkEnumerator
 A class that can be used to enumerate links between frames. More...
class  Slice
 A class representing a slice of a frame list. More...

Public Member Functions

 nsFrameList ()
 nsFrameList (nsIFrame *aFirstFrame, nsIFrame *aLastFrame)
 nsFrameList (const nsFrameList &aOther)
 ~nsFrameList ()
void DestroyFrames ()
 For each frame in this list: remove it from the list then call Destroy() on it.
void DestroyFramesFrom (nsIFrame *aDestructRoot)
 For each frame in this list: remove it from the list then call DestroyFrom() on it.
void Destroy ()
 For each frame in this list: remove it from the list then call Destroy() on it.
void DestroyFrom (nsIFrame *aDestructRoot)
 For each frame in this list: remove it from the list then call DestroyFrom() on it.
void Clear ()
void SetFrames (nsIFrame *aFrameList)
void SetFrames (nsFrameList &aFrameList)
Slice AppendFrames (nsIFrame *aParent, nsFrameList &aFrameList)
 Append aFrameList to this list.
void AppendFrame (nsIFrame *aParent, nsIFrame *aFrame)
 Append aFrame to this list.
void RemoveFrame (nsIFrame *aFrame)
 Take aFrame out of the frame list.
PRBool RemoveFrameIfPresent (nsIFrame *aFrame)
 Take aFrame out of the frame list, if present.
nsFrameList RemoveFramesAfter (nsIFrame *aAfterFrame)
 Take the frames after aAfterFrame out of the frame list.
nsIFrame * RemoveFirstChild ()
 Take the first frame (if any) out of the frame list.
void DestroyFrame (nsIFrame *aFrame)
 Take aFrame out of the frame list and then destroy it.
PRBool DestroyFrameIfPresent (nsIFrame *aFrame)
 If aFrame is present on this list then take it out of the list and then destroy it.
void InsertFrame (nsIFrame *aParent, nsIFrame *aPrevSibling, nsIFrame *aFrame)
 Insert aFrame right after aPrevSibling, or prepend it to this list if aPrevSibling is null.
Slice InsertFrames (nsIFrame *aParent, nsIFrame *aPrevSibling, nsFrameList &aFrameList)
 Inserts aFrameList into this list after aPrevSibling (at the beginning if aPrevSibling is null).
nsFrameList ExtractHead (FrameLinkEnumerator &aLink)
 Split this frame list such that all the frames before the link pointed to by aLink end up in the returned list, while the remaining frames stay in this list.
nsFrameList ExtractTail (FrameLinkEnumerator &aLink)
 Split this frame list such that all the frames coming after the link pointed to by aLink end up in the returned list, while the frames before that link stay in this list.
void SortByContentOrder ()
 Sort the frames according to content order so that the first frame in the list is the first in content order.
nsIFrame * FirstChild () const
nsIFrame * LastChild () const
nsIFrame * FrameAt (PRInt32 aIndex) const
PRInt32 IndexOf (nsIFrame *aFrame) const
PRBool IsEmpty () const
PRBool NotEmpty () const
PRBool ContainsFrame (const nsIFrame *aFrame) const
PRBool ContainsFrameBefore (const nsIFrame *aFrame, const nsIFrame *aEnd) const
PRInt32 GetLength () const
nsIFrame * OnlyChild () const
 If this frame list has only one frame, return that frame.
void ApplySetParent (nsIFrame *aParent) const
 Call SetParent(aParent) for each frame in this list.

Static Public Member Functions

static nsresult Init ()
static void Shutdown ()
static const nsFrameListEmptyList ()

Protected Attributes

nsIFrame * mFirstChild
nsIFrame * mLastChild

Detailed Description

A class for managing a list of frames.


Constructor & Destructor Documentation

nsFrameList::nsFrameList (  )  [inline]
nsFrameList::nsFrameList ( nsIFrame *  aFirstFrame,
nsIFrame *  aLastFrame 
) [inline]
nsFrameList::nsFrameList ( const nsFrameList aOther  )  [inline]
nsFrameList::~nsFrameList (  )  [inline]

Member Function Documentation

void nsFrameList::AppendFrame ( nsIFrame *  aParent,
nsIFrame *  aFrame 
) [inline]

Append aFrame to this list.

If aParent is not null, reparents the newly added frame.

Slice nsFrameList::AppendFrames ( nsIFrame *  aParent,
nsFrameList aFrameList 
) [inline]

Append aFrameList to this list.

If aParent is not null, reparents the newly added frames. Clears out aFrameList and returns a list slice represening the newly-appended frames.

void nsFrameList::ApplySetParent ( nsIFrame *  aParent  )  const

Call SetParent(aParent) for each frame in this list.

Parameters:
aParent the new parent frame, must be non-null
void nsFrameList::Clear (  )  [inline]
PRBool nsFrameList::ContainsFrame ( const nsIFrame *  aFrame  )  const
PRBool nsFrameList::ContainsFrameBefore ( const nsIFrame *  aFrame,
const nsIFrame *  aEnd 
) const
void nsFrameList::Destroy (  ) 

For each frame in this list: remove it from the list then call Destroy() on it.

Finally delete this.

void nsFrameList::DestroyFrame ( nsIFrame *  aFrame  ) 

Take aFrame out of the frame list and then destroy it.

The frame must be non-null and present on this list.

PRBool nsFrameList::DestroyFrameIfPresent ( nsIFrame *  aFrame  ) 

If aFrame is present on this list then take it out of the list and then destroy it.

The frame must be non-null.

Returns:
PR_TRUE if the frame was found
void nsFrameList::DestroyFrames (  ) 

For each frame in this list: remove it from the list then call Destroy() on it.

void nsFrameList::DestroyFramesFrom ( nsIFrame *  aDestructRoot  ) 

For each frame in this list: remove it from the list then call DestroyFrom() on it.

void nsFrameList::DestroyFrom ( nsIFrame *  aDestructRoot  ) 

For each frame in this list: remove it from the list then call DestroyFrom() on it.

Finally delete this.

static const nsFrameList& nsFrameList::EmptyList (  )  [inline, static]
nsFrameList nsFrameList::ExtractHead ( FrameLinkEnumerator aLink  ) 

Split this frame list such that all the frames before the link pointed to by aLink end up in the returned list, while the remaining frames stay in this list.

After this call, aLink points to the beginning of this list.

nsFrameList nsFrameList::ExtractTail ( FrameLinkEnumerator aLink  ) 

Split this frame list such that all the frames coming after the link pointed to by aLink end up in the returned list, while the frames before that link stay in this list.

After this call, aLink is at end.

nsIFrame* nsFrameList::FirstChild (  )  const [inline]
nsIFrame* nsFrameList::FrameAt ( PRInt32  aIndex  )  const
PRInt32 nsFrameList::GetLength (  )  const
PRInt32 nsFrameList::IndexOf ( nsIFrame *  aFrame  )  const
static nsresult nsFrameList::Init (  )  [static]
void nsFrameList::InsertFrame ( nsIFrame *  aParent,
nsIFrame *  aPrevSibling,
nsIFrame *  aFrame 
) [inline]

Insert aFrame right after aPrevSibling, or prepend it to this list if aPrevSibling is null.

If aParent is not null, also reparents newly-added frame. Note that this method always sets the frame's nextSibling pointer.

Slice nsFrameList::InsertFrames ( nsIFrame *  aParent,
nsIFrame *  aPrevSibling,
nsFrameList aFrameList 
)

Inserts aFrameList into this list after aPrevSibling (at the beginning if aPrevSibling is null).

If aParent is not null, reparents the newly added frames. Clears out aFrameList and returns a list slice representing the newly-inserted frames.

PRBool nsFrameList::IsEmpty (  )  const [inline]
nsIFrame* nsFrameList::LastChild (  )  const [inline]
PRBool nsFrameList::NotEmpty (  )  const [inline]
nsIFrame* nsFrameList::OnlyChild (  )  const [inline]

If this frame list has only one frame, return that frame.

Otherwise, return null.

nsIFrame* nsFrameList::RemoveFirstChild (  ) 

Take the first frame (if any) out of the frame list.

Returns:
the first child, or nsnull if the list is empty
void nsFrameList::RemoveFrame ( nsIFrame *  aFrame  ) 

Take aFrame out of the frame list.

This also disconnects aFrame from the sibling list. The frame must be non-null and present on this list.

PRBool nsFrameList::RemoveFrameIfPresent ( nsIFrame *  aFrame  ) 

Take aFrame out of the frame list, if present.

This also disconnects aFrame from the sibling list. aFrame must be non-null but is not required to be on the list.

Returns:
PR_TRUE if aFrame was removed
nsFrameList nsFrameList::RemoveFramesAfter ( nsIFrame *  aAfterFrame  ) 

Take the frames after aAfterFrame out of the frame list.

Parameters:
aAfterFrame a frame in this list
Returns:
the removed frames, if any
void nsFrameList::SetFrames ( nsIFrame *  aFrameList  ) 
void nsFrameList::SetFrames ( nsFrameList aFrameList  )  [inline]
static void nsFrameList::Shutdown (  )  [inline, static]
void nsFrameList::SortByContentOrder (  ) 

Sort the frames according to content order so that the first frame in the list is the first in content order.

Frames for the same content will be ordered so that a prev in flow comes before its next in flow.


Member Data Documentation

nsIFrame* nsFrameList::mFirstChild [protected]
nsIFrame* nsFrameList::mLastChild [protected]

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