Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions | Private Attributes
nsWeakFrame Class Reference

nsWeakFrame can be used to keep a reference to a nsIFrame in a safe way. More...

#include <nsIFrame.h>

Collaboration diagram for nsWeakFrame:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsWeakFrame (nsIFrame *aFrame)
nsWeakFrameoperator= (nsWeakFrame &aOther)
nsWeakFrameoperator= (nsIFrame *aFrame)
nsIFrameoperator-> ()
 operator nsIFrame * ()
void Clear (nsIPresShell_MOZILLA_1_8_BRANCH *aShell)
PRBool IsAlive ()
nsIFrameGetFrame ()
nsWeakFrameGetPreviousWeakFrame ()
void SetPreviousWeakFrame (nsWeakFrame *aPrev)
 ~nsWeakFrame ()

Private Member Functions

void Init (nsIFrame *aFrame)

Private Attributes

nsWeakFramemPrev
nsIFramemFrame

Detailed Description

nsWeakFrame can be used to keep a reference to a nsIFrame in a safe way.

Whenever an nsIFrame object is deleted, the nsWeakFrames pointing to it will be cleared.

Create nsWeakFrame object when it is sure that nsIFrame object is alive and after some operations which may destroy the nsIFrame (for example any DOM modifications) use IsAlive() or GetFrame() methods to check whether it is safe to continue to use the nsIFrame object.

Note:
The usage of this class should be kept to a minimum.

Definition at line 1532 of file nsIFrame.h.


Constructor & Destructor Documentation

nsWeakFrame::nsWeakFrame ( nsIFrame aFrame) [inline]

Definition at line 1534 of file nsIFrame.h.

                                : mPrev(nsnull), mFrame(nsnull)
  {
    Init(aFrame);
  }

Here is the call graph for this function:

Definition at line 1575 of file nsIFrame.h.

Here is the call graph for this function:


Member Function Documentation

Definition at line 1559 of file nsIFrame.h.

                                                      {
    if (aShell) {
      aShell->RemoveWeakFrame(this);
    }
    mFrame = nsnull;
    mPrev = nsnull;
  }

Here is the call graph for this function:

Definition at line 1569 of file nsIFrame.h.

{ return mFrame; }

Here is the caller graph for this function:

Definition at line 1571 of file nsIFrame.h.

{ return mPrev; }
void nsWeakFrame::Init ( nsIFrame aFrame) [inline, private]

Definition at line 1582 of file nsIFrame.h.

  {
    nsCOMPtr<nsIPresShell_MOZILLA_1_8_BRANCH> shell18 =
      do_QueryInterface(mFrame ? mFrame->GetPresContext()->GetPresShell() : nsnull);
    Clear(shell18);
    mFrame = aFrame;
    if (mFrame) {
      shell18 = do_QueryInterface(mFrame->GetPresContext()->GetPresShell());
      NS_WARN_IF_FALSE(shell18, "Null PresShell in nsWeakFrame!");
      if (shell18) {
        shell18->AddWeakFrame(this);
      } else {
        mFrame = nsnull;
      }
    }
  }

Here is the call graph for this function:

Definition at line 1567 of file nsIFrame.h.

{ return !!mFrame; }
nsWeakFrame::operator nsIFrame * ( ) [inline]

Definition at line 1554 of file nsIFrame.h.

  {
    return mFrame;
  }
nsIFrame* nsWeakFrame::operator-> ( ) [inline]

Definition at line 1549 of file nsIFrame.h.

  {
    return mFrame;
  }
nsWeakFrame& nsWeakFrame::operator= ( nsWeakFrame aOther) [inline]

Definition at line 1539 of file nsIFrame.h.

                                              {
    Init(aOther.GetFrame());
    return *this;
  }

Here is the call graph for this function:

nsWeakFrame& nsWeakFrame::operator= ( nsIFrame aFrame) [inline]

Definition at line 1544 of file nsIFrame.h.

                                           {
    Init(aFrame);
    return *this;
  }

Here is the call graph for this function:

Definition at line 1573 of file nsIFrame.h.

{ mPrev = aPrev; }

Member Data Documentation

Definition at line 1600 of file nsIFrame.h.

Definition at line 1599 of file nsIFrame.h.


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