Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions
nsTableRowFrame.cpp File Reference
#include "nsTableRowFrame.h"
#include "nsTableRowGroupFrame.h"
#include "nsIRenderingContext.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsStyleContext.h"
#include "nsStyleConsts.h"
#include "nsHTMLAtoms.h"
#include "nsIContent.h"
#include "nsTableFrame.h"
#include "nsTableCellFrame.h"
#include "nsIView.h"
#include "nsReflowPath.h"
#include "nsCSSRendering.h"
#include "nsLayoutAtoms.h"
#include "nsHTMLParts.h"
#include "nsTableColGroupFrame.h"
#include "nsTableColFrame.h"
#include "nsCOMPtr.h"

Go to the source code of this file.

Classes

struct  nsTableCellReflowState

Functions

static PRBool TallestCellGotShorter (nscoord aOld, nscoord aNew, nscoord aTallest)
nscoord GetHeightOfRowsSpannedBelowFirst (nsTableCellFrame &aTableCellFrame, nsTableFrame &aTableFrame)
static void CalcAvailWidth (nsTableFrame &aTableFrame, nscoord aTableComputedWidth, float aPixelToTwips, nsTableCellFrame &aCellFrame, nscoord aCellSpacingX, nscoord &aColAvailWidth, nscoord &aCellAvailWidth)
nscoord GetSpaceBetween (PRInt32 aPrevColIndex, PRInt32 aColIndex, PRInt32 aColSpan, nsTableFrame &aTableFrame, nscoord aCellSpacingX, PRBool aIsLeftToRight)
static nscoord GetComputedWidth (const nsHTMLReflowState &aReflowState, nsTableFrame &aTableFrame)
static nscoord CalcHeightFromUnpaginatedHeight (nsPresContext *aPresContext, nsTableRowFrame &aRow)
nsresult NS_NewTableRowFrame (nsIPresShell *aPresShell, nsIFrame **aNewFrame)

Function Documentation

static void CalcAvailWidth ( nsTableFrame aTableFrame,
nscoord  aTableComputedWidth,
float  aPixelToTwips,
nsTableCellFrame aCellFrame,
nscoord  aCellSpacingX,
nscoord aColAvailWidth,
nscoord aCellAvailWidth 
) [static]

Definition at line 683 of file nsTableRowFrame.cpp.

{
  aColAvailWidth = aCellAvailWidth = NS_UNCONSTRAINEDSIZE;
  PRInt32 colIndex;
  aCellFrame.GetColIndex(colIndex);
  PRInt32 colspan = aTableFrame.GetEffectiveColSpan(aCellFrame);
  nscoord cellSpacing = 0;

  for (PRInt32 spanX = 0; spanX < colspan; spanX++) {
    nscoord colWidth = aTableFrame.GetColumnWidth(colIndex + spanX);
    if (colWidth != WIDTH_NOT_SET) {
      if (NS_UNCONSTRAINEDSIZE == aColAvailWidth) {
        aColAvailWidth = colWidth; 
      }
      else {
        aColAvailWidth += colWidth;
      }
    }
    if ((spanX > 0) && (aTableFrame.GetNumCellsOriginatingInCol(colIndex + spanX) > 0)) {
      cellSpacing += aCellSpacingX;
    }
  }
  if (NS_UNCONSTRAINEDSIZE != aColAvailWidth) {
    aColAvailWidth += cellSpacing;
  } 
  aCellAvailWidth = aColAvailWidth;

  // for a cell with a colspan > 1, use its fix width (if set) as the avail width 
  // if this is its initial reflow
  if ((aCellFrame.GetStateBits() & NS_FRAME_FIRST_REFLOW)
      && (aTableFrame.GetEffectiveColSpan(aCellFrame) > 1)) {
    // see if the cell has a style width specified
    const nsStylePosition* cellPosition = aCellFrame.GetStylePosition();
    if (eStyleUnit_Coord == cellPosition->mWidth.GetUnit()) {
      // need to add padding into fixed width
      nsMargin borderPadding(0,0,0,0);
      if (NS_UNCONSTRAINEDSIZE != aTableComputedWidth) {
        borderPadding = nsTableFrame::GetBorderPadding(nsSize(aTableComputedWidth, 0), 
                                                       aPixelToTwips,  &aCellFrame);
      }
      nscoord fixWidth = cellPosition->mWidth.GetCoordValue() + borderPadding.left + borderPadding.right;
      if (NS_UNCONSTRAINEDSIZE != aColAvailWidth) {
        aCellAvailWidth = PR_MIN(aColAvailWidth, fixWidth);
      } else {
        aCellAvailWidth = fixWidth;
      }
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static nscoord CalcHeightFromUnpaginatedHeight ( nsPresContext aPresContext,
nsTableRowFrame aRow 
) [static]

Definition at line 787 of file nsTableRowFrame.cpp.

{
  nscoord height = 0;
  nsTableRowFrame* firstInFlow = (nsTableRowFrame*)aRow.GetFirstInFlow();
  if (!firstInFlow) ABORT1(0);
  if (firstInFlow->HasUnpaginatedHeight()) {
    height = firstInFlow->GetUnpaginatedHeight(aPresContext);
    for (nsIFrame* prevInFlow = aRow.GetPrevInFlow(); prevInFlow;
         prevInFlow = prevInFlow->GetPrevInFlow()) {
      height -= prevInFlow->GetSize().height;
    }
  }
  return PR_MAX(height, 0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static nscoord GetComputedWidth ( const nsHTMLReflowState aReflowState,
nsTableFrame aTableFrame 
) [static]

Definition at line 770 of file nsTableRowFrame.cpp.

{
  const nsHTMLReflowState* parentReflow = aReflowState.parentReflowState;
  nscoord computedWidth = 0;
  while (parentReflow) {
    if (parentReflow->frame == &aTableFrame) {
      computedWidth = parentReflow->mComputedWidth;
      break;
    }
    parentReflow = parentReflow->parentReflowState;
  }
  return computedWidth;
}

Here is the caller graph for this function:

nscoord GetHeightOfRowsSpannedBelowFirst ( nsTableCellFrame aTableCellFrame,
nsTableFrame aTableFrame 
)

Definition at line 311 of file nsTableRowFrame.cpp.

{
  nscoord height = 0;
  nscoord cellSpacingY = aTableFrame.GetCellSpacingY();
  PRInt32 rowSpan = aTableFrame.GetEffectiveRowSpan(aTableCellFrame);
  // add in height of rows spanned beyond the 1st one
  nsIFrame* nextRow = aTableCellFrame.GetParent()->GetNextSibling();
  for (PRInt32 rowX = 1; ((rowX < rowSpan) && nextRow);) {
    if (nsLayoutAtoms::tableRowFrame == nextRow->GetType()) {
      height += nextRow->GetSize().height;
      rowX++;
    }
    height += cellSpacingY;
    nextRow = nextRow->GetNextSibling();
  }
  return height;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nscoord GetSpaceBetween ( PRInt32  aPrevColIndex,
PRInt32  aColIndex,
PRInt32  aColSpan,
nsTableFrame aTableFrame,
nscoord  aCellSpacingX,
PRBool  aIsLeftToRight 
)

Definition at line 740 of file nsTableRowFrame.cpp.

{
  nscoord space = 0;
  PRInt32 colX;
  if (aIsLeftToRight) {
    for (colX = aPrevColIndex + 1; aColIndex > colX; colX++) {
      space += aTableFrame.GetColumnWidth(colX);
      if (aTableFrame.GetNumCellsOriginatingInCol(colX) > 0) {
        space += aCellSpacingX;
      }
    }
  } 
  else {
    PRInt32 lastCol = aColIndex + aColSpan - 1;
    for (colX = aPrevColIndex - 1; colX > lastCol; colX--) {
      space += aTableFrame.GetColumnWidth(colX);
      if (aTableFrame.GetNumCellsOriginatingInCol(colX) > 0) {
        space += aCellSpacingX;
      }
    }
  }
  return space;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_NewTableRowFrame ( nsIPresShell aPresShell,
nsIFrame **  aNewFrame 
)
Parameters:
aResultthe new object is returned in this out-param
aContentthe table object to map
aParentthe parent of the new frame
Returns:
NS_OK if the frame was properly allocated, otherwise an error code

Definition at line 1578 of file nsTableRowFrame.cpp.

{
  NS_PRECONDITION(aNewFrame, "null OUT ptr");
  if (nsnull == aNewFrame) {
    return NS_ERROR_NULL_POINTER;
  }
  nsTableRowFrame* it = new (aPresShell) nsTableRowFrame;
  if (nsnull == it) {
    return NS_ERROR_OUT_OF_MEMORY;
  }
  *aNewFrame = it;
  return NS_OK;
}

Here is the caller graph for this function:

static PRBool TallestCellGotShorter ( nscoord  aOld,
nscoord  aNew,
nscoord  aTallest 
) [static]

Definition at line 159 of file nsTableRowFrame.cpp.

{
  return ((aNew < aOld) && (aOld == aTallest));
}

Here is the caller graph for this function: