Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes
nsAutoSpaceManager Class Reference

A helper class to manage maintenance of the space manager during nsBlockFrame::Reflow. More...

#include <nsSpaceManager.h>

Collaboration diagram for nsAutoSpaceManager:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsAutoSpaceManager (nsHTMLReflowState &aReflowState)
 ~nsAutoSpaceManager ()
nsresult CreateSpaceManagerFor (nsPresContext *aPresContext, nsIFrame *aFrame)
 Create a new space manager for the specified frame.

Protected Attributes

nsHTMLReflowStatemReflowState
nsSpaceManagermNew
nsSpaceManagermOld

Detailed Description

A helper class to manage maintenance of the space manager during nsBlockFrame::Reflow.

It automatically restores the old space manager in the reflow state when the object goes out of scope.

Definition at line 473 of file nsSpaceManager.h.


Constructor & Destructor Documentation

Definition at line 475 of file nsSpaceManager.h.

    : mReflowState(aReflowState),
#ifdef DEBUG
      mOwns(PR_TRUE),
#endif
      mNew(nsnull),
      mOld(nsnull) {}

Definition at line 1477 of file nsSpaceManager.cpp.

{
  // Restore the old space manager in the reflow state if necessary.
  if (mNew) {
#ifdef NOISY_SPACEMANAGER
    printf("restoring old space manager %p\n", mOld);
#endif

    mReflowState.mSpaceManager = mOld;

#ifdef NOISY_SPACEMANAGER
    if (mOld) {
      NS_STATIC_CAST(nsFrame *, mReflowState.frame)->ListTag(stdout);
      printf(": space-manager %p after reflow\n", mOld);
      mOld->List(stdout);
    }
#endif

#ifdef DEBUG
    if (mOwns)
#endif
      delete mNew;
  }
}

Member Function Documentation

Create a new space manager for the specified frame.

This will `remember' the old space manager, and install the new space manager in the reflow state.

Definition at line 1503 of file nsSpaceManager.cpp.

{
  // Create a new space manager and install it in the reflow
  // state. `Remember' the old space manager so we can restore it
  // later.
  mNew = new nsSpaceManager(aPresContext->PresShell(), aFrame);
  if (! mNew)
    return NS_ERROR_OUT_OF_MEMORY;

#ifdef NOISY_SPACEMANAGER
  printf("constructed new space manager %p (replacing %p)\n",
         mNew, mReflowState.mSpaceManager);
#endif

  // Set the space manager in the existing reflow state
  mOld = mReflowState.mSpaceManager;
  mReflowState.mSpaceManager = mNew;
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 508 of file nsSpaceManager.h.

Definition at line 509 of file nsSpaceManager.h.

Definition at line 504 of file nsSpaceManager.h.


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