Back to index

lightning-sunbird  0.9+nobinonly
Classes | Public Member Functions | Public Attributes | Protected Attributes | Friends
nsReflowPath Class Reference

A reflow `path' that is a sparse tree the parallels the frame hierarchy. More...

#include <nsReflowPath.h>

Collaboration diagram for nsReflowPath:
Collaboration graph
[legend]

List of all members.

Classes

class  iterator
 An iterator for enumerating the reflow path's immediate children. More...

Public Member Functions

 nsReflowPath (nsIFrame *aFrame)
 Construct a reflow path object that parallels the specified frame.
 ~nsReflowPath ()
iterator FirstChild ()
 Return an iterator that points to the first immediate child of the reflow path.
iterator EndChildren ()
 Return an iterator that points `one past the end' of the immediate children of the reflow path.
PRBool HasChild (nsIFrame *aFrame) const
 Determine if the reflow path contains the specified frame as one of its immediate children.
iterator FindChild (nsIFrame *aFrame)
 Return an iterator over the current reflow path that corresponds to the specified child frame.
void RemoveChild (nsIFrame *aFrame)
 Remove the specified child frame from the reflow path, along with any of its descendants.
nsReflowPathGetSubtreeFor (nsIFrame *aFrame) const
 Return the child reflow path that corresponds to the specified frame, or null if the frame is not an immediate descendant.
nsReflowPathEnsureSubtreeFor (nsIFrame *aFrame)
 Return the child reflow path that corresponds to the specified frame, constructing a new child reflow path if one doesn't exist already.
void Remove (iterator &aIterator)
 Remove the child reflow path that corresponds to the specified iterator.

Public Attributes

nsIFramemFrame
 The frame that this reflow path object is associated with.
nsHTMLReflowCommandmReflowCommand
 If mFrame is the immediate target of an incremental reflow, this contains the reflow command that targeted it.

Protected Attributes

nsSmallVoidArray mChildren
 The children of this reflow path; also contains pointers to nsReflowPath objects.

Friends

class iterator

Detailed Description

A reflow `path' that is a sparse tree the parallels the frame hierarchy.

This is used during an incremental reflow to record the path which the reflow must trace through the frame hierarchy.

Definition at line 62 of file nsReflowPath.h.


Constructor & Destructor Documentation

nsReflowPath::nsReflowPath ( nsIFrame aFrame) [inline]

Construct a reflow path object that parallels the specified frame.

Definition at line 69 of file nsReflowPath.h.

        : mFrame(aFrame),
          mReflowCommand(nsnull) {}

Here is the caller graph for this function:

Definition at line 49 of file nsReflowPath.cpp.

{
    for (PRInt32 i = mChildren.Count() - 1; i >= 0; --i)
        delete NS_STATIC_CAST(nsReflowPath *, mChildren[i]);

    delete mReflowCommand;
}

Member Function Documentation

Return an iterator that points `one past the end' of the immediate children of the reflow path.

Definition at line 150 of file nsReflowPath.h.

{ return iterator(this, -1); }

Here is the caller graph for this function:

Return the child reflow path that corresponds to the specified frame, constructing a new child reflow path if one doesn't exist already.

Definition at line 82 of file nsReflowPath.cpp.

{
    for (PRInt32 i = mChildren.Count() - 1; i >= 0; --i) {
        nsReflowPath *subtree = NS_STATIC_CAST(nsReflowPath *, mChildren[i]);
        if (subtree->mFrame == aFrame)
            return subtree;
    }

    nsReflowPath *subtree = new nsReflowPath(aFrame);
    mChildren.AppendElement(subtree);

    return subtree;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Return an iterator over the current reflow path that corresponds to the specified child frame.

Returns EndChildren if aFrame is not an immediate child of the reflow path.

Definition at line 58 of file nsReflowPath.cpp.

{
    for (PRInt32 i = mChildren.Count() - 1; i >= 0; --i) {
        nsReflowPath *subtree = NS_STATIC_CAST(nsReflowPath *, mChildren[i]);
        if (subtree->mFrame == aFrame)
            return iterator(this, i);
    }

    return iterator(this, -1);
}

Here is the caller graph for this function:

Return an iterator that points to the first immediate child of the reflow path.

Definition at line 144 of file nsReflowPath.h.

{ return iterator(this, mChildren.Count() - 1); }

Here is the caller graph for this function:

Return the child reflow path that corresponds to the specified frame, or null if the frame is not an immediate descendant.

Definition at line 70 of file nsReflowPath.cpp.

{
    for (PRInt32 i = mChildren.Count() - 1; i >= 0; --i) {
        nsReflowPath *subtree = NS_STATIC_CAST(nsReflowPath *, mChildren[i]);
        if (subtree->mFrame == aFrame)
            return subtree;
    }

    return nsnull;
}

Here is the caller graph for this function:

PRBool nsReflowPath::HasChild ( nsIFrame aFrame) const [inline]

Determine if the reflow path contains the specified frame as one of its immediate children.

Definition at line 157 of file nsReflowPath.h.

                                     {
        return GetSubtreeFor(aFrame) != nsnull; }

Here is the call graph for this function:

Here is the caller graph for this function:

Remove the child reflow path that corresponds to the specified iterator.

Definition at line 97 of file nsReflowPath.cpp.

{
    NS_ASSERTION(aIterator.mNode == this, "inconsistent iterator");

    if (aIterator.mIndex >= 0 && aIterator.mIndex < mChildren.Count()) {
        delete NS_STATIC_CAST(nsReflowPath *, mChildren[aIterator.mIndex]);
        mChildren.RemoveElementAt(aIterator.mIndex);
    }
}

Here is the caller graph for this function:

void nsReflowPath::RemoveChild ( nsIFrame aFrame) [inline]

Remove the specified child frame from the reflow path, along with any of its descendants.

Does nothing if aFrame is not an immediate child of the reflow path.

Definition at line 174 of file nsReflowPath.h.

                                  { 
        iterator iter = FindChild(aFrame);
        Remove(iter); }

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class iterator [friend]

Definition at line 229 of file nsReflowPath.h.


Member Data Documentation

nsSmallVoidArray nsReflowPath::mChildren [protected]

The children of this reflow path; also contains pointers to nsReflowPath objects.

Definition at line 227 of file nsReflowPath.h.

The frame that this reflow path object is associated with.

Definition at line 211 of file nsReflowPath.h.

If mFrame is the immediate target of an incremental reflow, this contains the reflow command that targeted it.

Otherwise, this is null (and mFrame simply lies along the path to a target frame). The reflow path object assumes ownership of the reflow command.

Definition at line 220 of file nsReflowPath.h.


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