Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
nsTableFrame.cpp File Reference
#include "nsCOMPtr.h"
#include "nsVoidArray.h"
#include "nsTableFrame.h"
#include "nsIRenderingContext.h"
#include "nsStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIContent.h"
#include "nsCellMap.h"
#include "nsTableCellFrame.h"
#include "nsHTMLParts.h"
#include "nsTableColFrame.h"
#include "nsTableColGroupFrame.h"
#include "nsTableRowFrame.h"
#include "nsTableRowGroupFrame.h"
#include "nsTableOuterFrame.h"
#include "nsTablePainter.h"
#include "BasicTableLayoutStrategy.h"
#include "FixedTableLayoutStrategy.h"
#include "nsPresContext.h"
#include "nsCSSRendering.h"
#include "nsIView.h"
#include "nsHTMLAtoms.h"
#include "nsCSSAnonBoxes.h"
#include "nsHTMLReflowCommand.h"
#include "nsLayoutAtoms.h"
#include "nsIDeviceContext.h"
#include "nsIPresShell.h"
#include "nsIDOMElement.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMHTMLBodyElement.h"
#include "nsIScrollableFrame.h"
#include "nsFrameManager.h"
#include "nsLayoutErrors.h"
#include "nsAutoPtr.h"
#include "nsCSSFrameConstructor.h"
#include "nsStyleSet.h"

Go to the source code of this file.

Classes

struct  nsTableReflowState
struct  BCPropertyData
struct  BCMapCellInfo
class  BCMapCellIterator
struct  BCCellBorder
struct  BCCornerInfo
struct  BCCorners
struct  BCCellBorders
class  BCMapBorderIterator
struct  BCVerticalSeg
struct  BCHorizontalSeg
union  BCVerticalSeg.__unnamed__

Defines

#define CELL_CORNER   PR_TRUE
#define MAX_TABLE_BORDER_WIDTH   255
#define TOP_DAMAGED(aRowIndex)   ((aRowIndex) >= propData->mDamageArea.y)
#define RIGHT_DAMAGED(aColIndex)   ((aColIndex) < propData->mDamageArea.XMost())
#define BOTTOM_DAMAGED(aRowIndex)   ((aRowIndex) < propData->mDamageArea.YMost())
#define LEFT_DAMAGED(aColIndex)   ((aColIndex) >= propData->mDamageArea.x)
#define TABLE_EDGE   PR_TRUE
#define ADJACENT   PR_TRUE
#define HORIZONTAL   PR_TRUE

Functions

static PRBool IsRepeatedFrame (nsIFrame *kidFrame)
static void ProcessRowInserted (nsTableFrame &aTableFrame, PRBool aInvalidate, nscoord aNewHeight)
static PRBool IsPctStyleHeight (const nsStylePosition *aStylePosition)
static PRBool IsFixedStyleHeight (const nsStylePosition *aStylePosition)
static PRBool AncestorsHaveStyleHeight (const nsHTMLReflowState &aReflowState)
static void DivideBCBorderSize (nscoord aPixelSize, nscoord &aSmallHalf, nscoord &aLargeHalf)
static void GetSeparateModelBorderPadding (const nsHTMLReflowState *aReflowState, nsStyleContext &aStyleContext, nsMargin &aBorderPadding)
static PRBool IsRepeatable (nsTableRowGroupFrame &aHeaderOrFooter, nscoord aPageHeight)
static void ResizeCells (nsTableFrame &aTableFrame, nsPresContext *aPresContext, const nsHTMLReflowState &aReflowState)
static void UpdateCol (nsTableFrame &aTableFrame, nsTableColFrame &aColFrame, const nsTableCellFrame &aCellFrame, nscoord aColMaxWidth, PRBool aColMaxGetsBigger)
nscoord CalcPercentPadding (nscoord aBasis, nsStyleCoord aStyleCoord)
void GetPaddingFor (const nsSize &aBasis, const nsStylePadding &aPaddingData, nsMargin &aPadding)
nsresult NS_NewTableFrame (nsIPresShell *aPresShell, nsIFrame **aNewFrame)
static void CheckFixDamageArea (PRInt32 aNumRows, PRInt32 aNumCols, nsRect &aDamageArea)
static void GetColorAndStyle (const nsIFrame *aFrame, PRUint8 aSide, PRUint8 &aStyle, nscolor &aColor, PRBool aTableIsLTR, PRBool aIgnoreTableEdge)
 return the border style, border color for a given frame and side
static void GetPaintStyleInfo (const nsIFrame *aFrame, PRUint8 aSide, PRUint8 &aStyle, nscolor &aColor, PRBool aTableIsLTR, PRBool aIgnoreTableEdge)
 coerce the paint style as required by CSS2.1
static void GetColorAndStyle (const nsIFrame *aFrame, PRUint8 aSide, PRUint8 &aStyle, nscolor &aColor, PRBool aTableIsLTR, PRBool aIgnoreTableEdge, nscoord &aWidth, float aTwipsToPixels)
 return the border style, border color and the width in pixel for a given frame and side
static const BCCellBorderCompareBorders (PRBool aIsCorner, const BCCellBorder &aBorder1, const BCCellBorder &aBorder2, PRBool aSecondIsHorizontal, PRBool *aFirstDominates=nsnull)
static BCCellBorder CompareBorders (const nsIFrame *aTableFrame, const nsIFrame *aColGroupFrame, const nsIFrame *aColFrame, const nsIFrame *aRowGroupFrame, const nsIFrame *aRowFrame, const nsIFrame *aCellFrame, PRBool aTableIsLTR, PRBool aIgnoreTableEdge, PRUint8 aSide, PRBool aAja, float aTwipsToPixels)
 calc the dominant border by considering the table, row/col group, row/col, cell.
static PRBool Perpendicular (PRUint8 aSide1, PRUint8 aSide2)
static PRBool SetBorder (const BCCellBorder &aNewBorder, BCCellBorder &aBorder)
static PRBool SetHorBorder (const BCCellBorder &aNewBorder, const BCCornerInfo &aCorner, BCCellBorder &aBorder)
static PRUint8 LimitBorderWidth (PRUint16 aWidth)
static nscoord CalcVerCornerOffset (PRUint8 aCornerOwnerSide, nscoord aCornerSubWidth, nscoord aHorWidth, PRBool aIsStartOfSeg, PRBool aIsBevel, float aPixelsToTwips)
static nscoord CalcHorCornerOffset (PRUint8 aCornerOwnerSide, nscoord aCornerSubWidth, nscoord aVerWidth, PRBool aIsStartOfSeg, PRBool aIsBevel, float aPixelsToTwips, PRBool aTableIsLTR)
 Compute the horizontal offset of a horizontal border segment.
static void DestroyCoordFunc (void *aFrame, nsIAtom *aPropertyName, void *aPropertyValue, void *aDtorData)
static void DestroyPointFunc (void *aFrame, nsIAtom *aPropertyName, void *aPropertyValue, void *aDtorData)
static void DestroyBCPropertyDataFunc (void *aFrame, nsIAtom *aPropertyName, void *aPropertyValue, void *aDtorData)

Variables

static PRUint8 styleToPriority [13]

Class Documentation

union BCVerticalSeg.__unnamed__

Definition at line 6791 of file nsTableFrame.cpp.

Class Members
nsTableColFrame * col
PRInt32 colWidth

Define Documentation

Definition at line 5860 of file nsTableFrame.cpp.

#define BOTTOM_DAMAGED (   aRowIndex)    ((aRowIndex) < propData->mDamageArea.YMost())

Definition at line 5856 of file nsTableFrame.cpp.

Definition at line 5162 of file nsTableFrame.cpp.

Definition at line 5861 of file nsTableFrame.cpp.

#define LEFT_DAMAGED (   aColIndex)    ((aColIndex) >= propData->mDamageArea.x)

Definition at line 5857 of file nsTableFrame.cpp.

Definition at line 5807 of file nsTableFrame.cpp.

#define RIGHT_DAMAGED (   aColIndex)    ((aColIndex) < propData->mDamageArea.XMost())

Definition at line 5855 of file nsTableFrame.cpp.

Definition at line 5859 of file nsTableFrame.cpp.

#define TOP_DAMAGED (   aRowIndex)    ((aRowIndex) >= propData->mDamageArea.y)

Definition at line 5854 of file nsTableFrame.cpp.


Function Documentation

static PRBool AncestorsHaveStyleHeight ( const nsHTMLReflowState aReflowState) [static]

Definition at line 1721 of file nsTableFrame.cpp.

{
  for (const nsHTMLReflowState* parentRS = aReflowState.parentReflowState;
       parentRS && parentRS->frame; 
       parentRS = parentRS->parentReflowState) {
    nsIAtom* frameType = parentRS->frame->GetType();
    if (IS_TABLE_CELL(frameType)                         ||
        (nsLayoutAtoms::tableRowFrame      == frameType) ||
        (nsLayoutAtoms::tableRowGroupFrame == frameType)) {
      if (::IsPctStyleHeight(parentRS->mStylePosition) || ::IsFixedStyleHeight(parentRS->mStylePosition)) {
        return PR_TRUE;
      }
    }
    else if (nsLayoutAtoms::tableFrame == frameType) {
      // we reached the containing table, so always return
      if (::IsPctStyleHeight(parentRS->mStylePosition) || ::IsFixedStyleHeight(parentRS->mStylePosition)) {
        return PR_TRUE;
      }
      else return PR_FALSE;
    }
  }
  return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static nscoord CalcHorCornerOffset ( PRUint8  aCornerOwnerSide,
nscoord  aCornerSubWidth,
nscoord  aVerWidth,
PRBool  aIsStartOfSeg,
PRBool  aIsBevel,
float  aPixelsToTwips,
PRBool  aTableIsLTR 
) [static]

Compute the horizontal offset of a horizontal border segment.

Parameters:
aCornerOwnerSide- which side owns the corner
aCornerSubWidth- how wide is the nonwinning side of the corner
aVerWidth- how wide is the vertical edge of the corner
aIsStartOfSeg- does this corner start a new segment
aIsBevel- is this corner beveled
aPixelsToTwips- conversion factor
aTableIsLTR- direction, the computation depends on ltr or rtl
Returns:
- offset in pixel

Definition at line 6737 of file nsTableFrame.cpp.

{
  nscoord offset = 0;
  // XXX These should be replaced with appropriate side-specific macros (which?).
  nscoord smallHalf, largeHalf;
  if ((NS_SIDE_LEFT == aCornerOwnerSide) || (NS_SIDE_RIGHT == aCornerOwnerSide)) {
    if (aTableIsLTR) {
      DivideBCBorderSize(aCornerSubWidth, smallHalf, largeHalf);
    }
    else {
      DivideBCBorderSize(aCornerSubWidth, largeHalf, smallHalf);
    }
    if (aIsBevel) {
      offset = (aIsStartOfSeg) ? -largeHalf : smallHalf;
    }
    else {
      offset = (NS_SIDE_LEFT == aCornerOwnerSide) ? smallHalf : -largeHalf;
    }
  }
  else {
    if (aTableIsLTR) {
      DivideBCBorderSize(aVerWidth, smallHalf, largeHalf);
    }
    else {
      DivideBCBorderSize(aVerWidth, largeHalf, smallHalf);
    }
    if (aIsBevel) {
      offset = (aIsStartOfSeg) ? -largeHalf : smallHalf;
    }
    else {
      offset = (aIsStartOfSeg) ? smallHalf : -largeHalf;
    }
  }
  return NSToCoordRound(aPixelsToTwips * (float)offset);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nscoord CalcPercentPadding ( nscoord  aBasis,
nsStyleCoord  aStyleCoord 
)

Definition at line 4043 of file nsTableFrame.cpp.

{
  float percent = (NS_UNCONSTRAINEDSIZE == aBasis)
                  ? 0 : aStyleCoord.GetPercentValue();
  return NSToCoordRound(((float)aBasis) * percent);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static nscoord CalcVerCornerOffset ( PRUint8  aCornerOwnerSide,
nscoord  aCornerSubWidth,
nscoord  aHorWidth,
PRBool  aIsStartOfSeg,
PRBool  aIsBevel,
float  aPixelsToTwips 
) [static]

Definition at line 6695 of file nsTableFrame.cpp.

{
  nscoord offset = 0;
  // XXX These should be replaced with appropriate side-specific macros (which?).
  nscoord smallHalf, largeHalf;
  if ((NS_SIDE_TOP == aCornerOwnerSide) || (NS_SIDE_BOTTOM == aCornerOwnerSide)) {
    DivideBCBorderSize(aCornerSubWidth, smallHalf, largeHalf);
    if (aIsBevel) {
      offset = (aIsStartOfSeg) ? -largeHalf : smallHalf;
    }
    else {
      offset = (NS_SIDE_TOP == aCornerOwnerSide) ? smallHalf : -largeHalf;
    }
  }
  else {
    DivideBCBorderSize(aHorWidth, smallHalf, largeHalf);
    if (aIsBevel) {
      offset = (aIsStartOfSeg) ? -largeHalf : smallHalf;
    }
    else {
      offset = (aIsStartOfSeg) ? smallHalf : -largeHalf;
    }
  }
  return NSToCoordRound(aPixelsToTwips * (float)offset);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void CheckFixDamageArea ( PRInt32  aNumRows,
PRInt32  aNumCols,
nsRect aDamageArea 
) [static]

Definition at line 4675 of file nsTableFrame.cpp.

{
  if (((aDamageArea.XMost() > aNumCols) && (aDamageArea.width  != 1) && (aNumCols != 0)) || 
      ((aDamageArea.YMost() > aNumRows) && (aDamageArea.height != 1) && (aNumRows != 0))) {
    // the damage area was set incorrectly, just be safe and make it the entire table
    NS_ASSERTION(PR_FALSE, "invalid BC damage area");
    aDamageArea.x      = 0;
    aDamageArea.y      = 0;
    aDamageArea.width  = aNumCols;
    aDamageArea.height = aNumRows;
  }
}

Here is the caller graph for this function:

static const BCCellBorder& CompareBorders ( PRBool  aIsCorner,
const BCCellBorder aBorder1,
const BCCellBorder aBorder2,
PRBool  aSecondIsHorizontal,
PRBool aFirstDominates = nsnull 
) [static]

Definition at line 5336 of file nsTableFrame.cpp.

{
  PRBool firstDominates = PR_TRUE;
  
  if (NS_STYLE_BORDER_STYLE_HIDDEN == aBorder1.style) {
    firstDominates = (aIsCorner) ? PR_FALSE : PR_TRUE;
  }
  else if (NS_STYLE_BORDER_STYLE_HIDDEN == aBorder2.style) {
    firstDominates = (aIsCorner) ? PR_TRUE : PR_FALSE;
  }
  else if (aBorder1.width < aBorder2.width) {
    firstDominates = PR_FALSE;
  }
  else if (aBorder1.width == aBorder2.width) {
    if (styleToPriority[aBorder1.style] < styleToPriority[aBorder2.style]) {
      firstDominates = PR_FALSE;
    }
    else if (styleToPriority[aBorder1.style] == styleToPriority[aBorder2.style]) {
      if (aBorder1.owner == aBorder2.owner) {
        firstDominates = !aSecondIsHorizontal;
      }
      else if (aBorder1.owner < aBorder2.owner) {
        firstDominates = PR_FALSE;
      }
    }
  }

  if (aFirstDominates)
    *aFirstDominates = firstDominates;

  if (firstDominates)
    return aBorder1;
  return aBorder2;
}

Here is the caller graph for this function:

static BCCellBorder CompareBorders ( const nsIFrame aTableFrame,
const nsIFrame aColGroupFrame,
const nsIFrame aColFrame,
const nsIFrame aRowGroupFrame,
const nsIFrame aRowFrame,
const nsIFrame aCellFrame,
PRBool  aTableIsLTR,
PRBool  aIgnoreTableEdge,
PRUint8  aSide,
PRBool  aAja,
float  aTwipsToPixels 
) [static]

calc the dominant border by considering the table, row/col group, row/col, cell.

At the table edges borders coming from the 'rules' attribute should be ignored as they are only inner borders. Depending on whether the side is vertical or horizontal and whether adjacent frames are taken into account the ownership of a single border segment is defined. The return value is the dominating border The cellmap stores only top and left borders for each cellmap position. If the cell border is owned by the cell that is left of the border it will be an adjacent owner aka eAjaCellOwner. See celldata.h for the other scenarios with a adjacent owner.

Parameters:
xxxFrame- the frame for style information, might be zero if it should not be considered
aIgnoreTableEdge- if true the border should be ignored at the table edge, as rules can be drawn only inside the table
aSide- side of the frames that should be considered
aAja- the border comparison takes place from the point of a frame that is adjacent to the cellmap entry, for when a cell owns its lower border it will be the adjacent owner as in the cellmap only top and left borders are stored.
aTwipsToPixels- conversion factor as borders need to be drawn pixel aligned.

Definition at line 5399 of file nsTableFrame.cpp.

{
  BCCellBorder border, tempBorder;
  PRBool horizontal = (NS_SIDE_TOP == aSide) || (NS_SIDE_BOTTOM == aSide);

  // start with the table as dominant if present
  if (aTableFrame) {
    GetColorAndStyle(aTableFrame, aSide, border.style, border.color, aTableIsLTR, aIgnoreTableEdge, border.width, aTwipsToPixels);
    border.owner = eTableOwner;
    if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) {
      return border;
    }
  }
  // see if the colgroup is dominant
  if (aColGroupFrame) {
    GetColorAndStyle(aColGroupFrame, aSide, tempBorder.style, tempBorder.color, aTableIsLTR, aIgnoreTableEdge, tempBorder.width, aTwipsToPixels);
    tempBorder.owner = (aAja && !horizontal) ? eAjaColGroupOwner : eColGroupOwner;
    // pass here and below PR_FALSE for aSecondIsHorizontal as it is only used for corner calculations.
    border = CompareBorders(!CELL_CORNER, border, tempBorder, PR_FALSE);
    if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) {
      return border;
    }
  }
  // see if the col is dominant
  if (aColFrame) {
    GetColorAndStyle(aColFrame, aSide, tempBorder.style, tempBorder.color, aTableIsLTR, aIgnoreTableEdge, tempBorder.width, aTwipsToPixels);
    tempBorder.owner = (aAja && !horizontal) ? eAjaColOwner : eColOwner;
    border = CompareBorders(!CELL_CORNER, border, tempBorder, PR_FALSE);
    if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) {
      return border;
    }
  }
  // see if the rowgroup is dominant
  if (aRowGroupFrame) {
    GetColorAndStyle(aRowGroupFrame, aSide, tempBorder.style, tempBorder.color, aTableIsLTR, aIgnoreTableEdge, tempBorder.width, aTwipsToPixels);
    tempBorder.owner = (aAja && horizontal) ? eAjaRowGroupOwner : eRowGroupOwner;
    border = CompareBorders(!CELL_CORNER, border, tempBorder, PR_FALSE);
    if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) {
      return border;
    }
  }
  // see if the row is dominant
  if (aRowFrame) {
    GetColorAndStyle(aRowFrame, aSide, tempBorder.style, tempBorder.color, aTableIsLTR, aIgnoreTableEdge, tempBorder.width, aTwipsToPixels);
    tempBorder.owner = (aAja && horizontal) ? eAjaRowOwner : eRowOwner;
    border = CompareBorders(!CELL_CORNER, border, tempBorder, PR_FALSE);
    if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) {
      return border;
    }
  }
  // see if the cell is dominant
  if (aCellFrame) {
    GetColorAndStyle(aCellFrame, aSide, tempBorder.style, tempBorder.color, aTableIsLTR, aIgnoreTableEdge, tempBorder.width, aTwipsToPixels);
    tempBorder.owner = (aAja) ? eAjaCellOwner : eCellOwner;
    border = CompareBorders(!CELL_CORNER, border, tempBorder, PR_FALSE);
  }
  return border;
}

Here is the call graph for this function:

static void DestroyBCPropertyDataFunc ( void aFrame,
nsIAtom aPropertyName,
void aPropertyValue,
void aDtorData 
) [static]

Definition at line 7711 of file nsTableFrame.cpp.

{
  delete NS_STATIC_CAST(BCPropertyData*, aPropertyValue);
}

Here is the caller graph for this function:

static void DestroyCoordFunc ( void aFrame,
nsIAtom aPropertyName,
void aPropertyValue,
void aDtorData 
) [static]

Definition at line 7691 of file nsTableFrame.cpp.

{
  delete NS_STATIC_CAST(nscoord*, aPropertyValue);
}

Here is the caller graph for this function:

static void DestroyPointFunc ( void aFrame,
nsIAtom aPropertyName,
void aPropertyValue,
void aDtorData 
) [static]

Definition at line 7701 of file nsTableFrame.cpp.

{
  delete NS_STATIC_CAST(nsPoint*, aPropertyValue);
}

Here is the caller graph for this function:

static void DivideBCBorderSize ( nscoord  aPixelSize,
nscoord aSmallHalf,
nscoord aLargeHalf 
) [static]

Definition at line 2820 of file nsTableFrame.cpp.

{
  aSmallHalf = aPixelSize / 2;
  aLargeHalf = aPixelSize - aSmallHalf;
}

Here is the caller graph for this function:

static void GetColorAndStyle ( const nsIFrame aFrame,
PRUint8  aSide,
PRUint8 aStyle,
nscolor aColor,
PRBool  aTableIsLTR,
PRBool  aIgnoreTableEdge 
) [static]

return the border style, border color for a given frame and side

Parameters:
aFrame- query the info for this frame
aSide- the side of the frame
aStyle- the border style
aColor- the border color
aTableIsLTR- table direction is LTR
aIgnoreTableEdge- if is a table edge any borders set for the purpose of satisfying the rules attribute should be ignored

Definition at line 5174 of file nsTableFrame.cpp.

{
  NS_PRECONDITION(aFrame, "null frame");
  // initialize out arg
  aColor = 0;
  const nsStyleBorder* styleData = aFrame->GetStyleBorder();
  if(!aTableIsLTR) { // revert the directions
    if (NS_SIDE_RIGHT == aSide) {
      aSide = NS_SIDE_LEFT;
    }
    else if (NS_SIDE_LEFT == aSide) {
      aSide = NS_SIDE_RIGHT;
    }
  }
  aStyle = styleData->GetBorderStyle(aSide);

  // if the rules marker is set, set the style either to none or remove the mask
  if (NS_STYLE_BORDER_STYLE_RULES_MARKER & aStyle) {
    if (aIgnoreTableEdge) {
      aStyle = NS_STYLE_BORDER_STYLE_NONE;
      return;
    }
    else {
      aStyle &= ~NS_STYLE_BORDER_STYLE_RULES_MARKER;
    }
  }

  if ((NS_STYLE_BORDER_STYLE_NONE == aStyle) ||
      (NS_STYLE_BORDER_STYLE_HIDDEN == aStyle)) {
    return;
  }
  PRBool transparent, foreground;
  styleData->GetBorderColor(aSide, aColor, transparent, foreground);
  if (transparent) { 
    aColor = 0;
  }
  else if (foreground) {
    aColor = aFrame->GetStyleColor()->mColor;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void GetColorAndStyle ( const nsIFrame aFrame,
PRUint8  aSide,
PRUint8 aStyle,
nscolor aColor,
PRBool  aTableIsLTR,
PRBool  aIgnoreTableEdge,
nscoord aWidth,
float  aTwipsToPixels 
) [static]

return the border style, border color and the width in pixel for a given frame and side

Parameters:
aFrame- query the info for this frame
aSide- the side of the frame
aStyle- the border style
aColor- the border color
aTableIsLTR- table direction is LTR
aIgnoreTableEdge- if is a table edge any borders set for the purpose of satisfying the rules attribute should be ignored
aWidth- the border width in px.
aTwipsToPixels- conversion factor from twips to pixel

Definition at line 5261 of file nsTableFrame.cpp.

{
  GetColorAndStyle(aFrame, aSide, aStyle, aColor, aTableIsLTR, aIgnoreTableEdge);
  if ((NS_STYLE_BORDER_STYLE_NONE == aStyle) ||
      (NS_STYLE_BORDER_STYLE_HIDDEN == aStyle)) {
    aWidth = 0;
    return;
  }
  const nsStyleBorder* styleData = aFrame->GetStyleBorder();
  nscoord width;
  if(!aTableIsLTR) { // revert the directions
    if (NS_SIDE_RIGHT == aSide) {
      aSide = NS_SIDE_LEFT;
    }
    else if (NS_SIDE_LEFT == aSide) {
      aSide = NS_SIDE_RIGHT;
    }
  }
  styleData->CalcBorderFor(aFrame, aSide, width);
  aWidth = NSToCoordRound(aTwipsToPixels * (float)width);
}

Here is the call graph for this function:

void GetPaddingFor ( const nsSize aBasis,
const nsStylePadding aPaddingData,
nsMargin aPadding 
)

Definition at line 4052 of file nsTableFrame.cpp.

{
  nsStyleCoord styleCoord;
  aPaddingData.mPadding.GetTop(styleCoord);
  if (eStyleUnit_Percent == aPaddingData.mPadding.GetTopUnit()) {
    aPadding.top = CalcPercentPadding(aBasis.height, styleCoord);
  }
  else if (eStyleUnit_Coord == aPaddingData.mPadding.GetTopUnit()) {
    aPadding.top = styleCoord.GetCoordValue();
  }

  aPaddingData.mPadding.GetRight(styleCoord);
  if (eStyleUnit_Percent == aPaddingData.mPadding.GetRightUnit()) {
    aPadding.right = CalcPercentPadding(aBasis.width, styleCoord);
  }
  else if (eStyleUnit_Coord == aPaddingData.mPadding.GetTopUnit()) {
    aPadding.right = styleCoord.GetCoordValue();
  }

  aPaddingData.mPadding.GetBottom(styleCoord);
  if (eStyleUnit_Percent == aPaddingData.mPadding.GetBottomUnit()) {
    aPadding.bottom = CalcPercentPadding(aBasis.height, styleCoord);
  }
  else if (eStyleUnit_Coord == aPaddingData.mPadding.GetTopUnit()) {
    aPadding.bottom = styleCoord.GetCoordValue();
  }

  aPaddingData.mPadding.GetLeft(styleCoord);
  if (eStyleUnit_Percent == aPaddingData.mPadding.GetLeftUnit()) {
    aPadding.left = CalcPercentPadding(aBasis.width, styleCoord);
  }
  else if (eStyleUnit_Coord == aPaddingData.mPadding.GetTopUnit()) {
    aPadding.left = styleCoord.GetCoordValue();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void GetPaintStyleInfo ( const nsIFrame aFrame,
PRUint8  aSide,
PRUint8 aStyle,
nscolor aColor,
PRBool  aTableIsLTR,
PRBool  aIgnoreTableEdge 
) [static]

coerce the paint style as required by CSS2.1

Parameters:
aFrame- query the info for this frame
aSide- the side of the frame
aStyle- the border style
aColor- the border color
aTableIsLTR- table direction is LTR
aIgnoreTableEdge- if is a table edge any borders set for the purpose of satisfying the rules attribute should be ignored

Definition at line 5230 of file nsTableFrame.cpp.

{
  GetColorAndStyle(aFrame, aSide, aStyle, aColor, aTableIsLTR, aIgnoreTableEdge);
  if ((NS_STYLE_BORDER_STYLE_INSET    == aStyle) || 
      (NS_STYLE_BORDER_STYLE_BG_INSET == aStyle)) {
    aStyle = NS_STYLE_BORDER_STYLE_RIDGE;
  }
  else if ((NS_STYLE_BORDER_STYLE_OUTSET    == aStyle) || 
           (NS_STYLE_BORDER_STYLE_BG_OUTSET == aStyle)) {
    aStyle = NS_STYLE_BORDER_STYLE_GROOVE;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void GetSeparateModelBorderPadding ( const nsHTMLReflowState aReflowState,
nsStyleContext aStyleContext,
nsMargin aBorderPadding 
) [static]

Definition at line 2874 of file nsTableFrame.cpp.

{
  // XXXbz Either we _do_ have a reflow state and then we can use its
  // mComputedBorderPadding or we don't and then we get the padding
  // wrong!
  const nsStyleBorder* border = aStyleContext.GetStyleBorder();
  aBorderPadding = border->GetBorder();
  if (aReflowState) {
    aBorderPadding += aReflowState->mComputedPadding;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool IsFixedStyleHeight ( const nsStylePosition aStylePosition) [static]

Definition at line 1712 of file nsTableFrame.cpp.

{
  return (aStylePosition && 
          (eStyleUnit_Coord == aStylePosition->mHeight.GetUnit()));
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool IsPctStyleHeight ( const nsStylePosition aStylePosition) [static]

Definition at line 1704 of file nsTableFrame.cpp.

{
  return (aStylePosition && 
          (eStyleUnit_Percent == aStylePosition->mHeight.GetUnit()));
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool IsRepeatable ( nsTableRowGroupFrame aHeaderOrFooter,
nscoord  aPageHeight 
) [static]

Definition at line 3193 of file nsTableFrame.cpp.

{
  return aHeaderOrFooter.GetSize().height < (aPageHeight / 4);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool IsRepeatedFrame ( nsIFrame kidFrame) [static]

Definition at line 362 of file nsTableFrame.cpp.

{
  return (kidFrame->GetType() == nsLayoutAtoms::tableRowFrame ||
          kidFrame->GetType() == nsLayoutAtoms::tableRowGroupFrame) &&
         (kidFrame->GetStateBits() & NS_REPEATED_ROW_OR_ROWGROUP);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRUint8 LimitBorderWidth ( PRUint16  aWidth) [static]

Definition at line 5809 of file nsTableFrame.cpp.

{
  return PR_MIN(MAX_TABLE_BORDER_WIDTH, aWidth);
}

Here is the caller graph for this function:

nsresult NS_NewTableFrame ( 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 4157 of file nsTableFrame.cpp.

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

Here is the caller graph for this function:

static PRBool Perpendicular ( PRUint8  aSide1,
PRUint8  aSide2 
) [static]

Definition at line 5469 of file nsTableFrame.cpp.

{
  switch (aSide1) {
  case NS_SIDE_TOP:
    return (NS_SIDE_BOTTOM != aSide2);
  case NS_SIDE_RIGHT:
    return (NS_SIDE_LEFT != aSide2);
  case NS_SIDE_BOTTOM:
    return (NS_SIDE_TOP != aSide2);
  default: // NS_SIDE_LEFT
    return (NS_SIDE_RIGHT != aSide2);
  }
}

Here is the caller graph for this function:

static void ProcessRowInserted ( nsTableFrame aTableFrame,
PRBool  aInvalidate,
nscoord  aNewHeight 
) [static]

Definition at line 1666 of file nsTableFrame.cpp.

{
  aTableFrame.SetRowInserted(PR_FALSE); // reset the bit that got us here
  nsAutoVoidArray rowGroups;
  PRUint32 numRowGroups;
  aTableFrame.OrderRowGroups(rowGroups, numRowGroups);
  // find the row group containing the inserted row
  for (PRUint32 rgX = 0; rgX < numRowGroups; rgX++) {
    nsTableRowGroupFrame* rgFrame = (nsTableRowGroupFrame*)rowGroups.ElementAt(rgX);
    if (!rgFrame) continue; // should never happen
    nsIFrame* childFrame = rgFrame->GetFirstChild(nsnull);
    // find the row that was inserted first
    while (childFrame) {
      if (nsLayoutAtoms::tableRowFrame == childFrame->GetType()) {
        nsTableRowFrame* rowFrame = (nsTableRowFrame*)childFrame;
        if (rowFrame->IsFirstInserted()) {
          rowFrame->SetFirstInserted(PR_FALSE);
          if (aInvalidate) {
            // damage the table from the 1st row inserted to the end of the table
            nscoord damageY = rgFrame->GetPosition().y + rowFrame->GetPosition().y;
            nsRect damageRect(0, damageY,
                              aTableFrame.GetSize().width, aNewHeight - damageY);

            aTableFrame.Invalidate(damageRect);
            aTableFrame.SetRowInserted(PR_FALSE);
          }
          return; // found it, so leave
        }
      }
      childFrame = childFrame->GetNextSibling();
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void ResizeCells ( nsTableFrame aTableFrame,
nsPresContext aPresContext,
const nsHTMLReflowState aReflowState 
) [static]

Definition at line 3585 of file nsTableFrame.cpp.

{
  nsAutoVoidArray rowGroups;
  PRUint32 numRowGroups;
  aTableFrame.OrderRowGroups(rowGroups, numRowGroups, nsnull);
  nsHTMLReflowMetrics tableDesiredSize(PR_FALSE);
  nsRect tableRect = aTableFrame.GetRect();
  tableDesiredSize.width = tableRect.width;
  tableDesiredSize.height = tableRect.height;
  tableDesiredSize.mOverflowArea = nsRect(0, 0, tableRect.width,
                                          tableRect.height);

  for (PRUint32 rgX = 0; (rgX < numRowGroups); rgX++) {
    nsTableRowGroupFrame* rgFrame = aTableFrame.GetRowGroupFrame((nsIFrame*)rowGroups.ElementAt(rgX));
   
    nsRect rowGroupRect = rgFrame->GetRect();
    nsHTMLReflowMetrics groupDesiredSize(PR_FALSE);
    groupDesiredSize.width = rowGroupRect.width;
    groupDesiredSize.height = rowGroupRect.height;
    groupDesiredSize.mOverflowArea = nsRect(0, 0, groupDesiredSize.width,
                                      groupDesiredSize.height);
    nsTableRowFrame* rowFrame = rgFrame->GetFirstRow();
    while (rowFrame) {
      rowFrame->DidResize(aPresContext, aReflowState);
      rgFrame->ConsiderChildOverflow(groupDesiredSize.mOverflowArea, rowFrame);
      rowFrame = rowFrame->GetNextRow();
    }
    rgFrame->FinishAndStoreOverflow(&groupDesiredSize.mOverflowArea,
                                    nsSize(groupDesiredSize.width, groupDesiredSize.height));
    // make the coordinates of |desiredSize.mOverflowArea| incorrect
    // since it's about to go away:
    groupDesiredSize.mOverflowArea.MoveBy(rgFrame->GetPosition());
    tableDesiredSize.mOverflowArea.UnionRect(tableDesiredSize.mOverflowArea, groupDesiredSize.mOverflowArea);
  }
  aTableFrame.FinishAndStoreOverflow(&tableDesiredSize.mOverflowArea,
                                     nsSize(tableDesiredSize.width, tableDesiredSize.height));
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool SetBorder ( const BCCellBorder aNewBorder,
BCCellBorder aBorder 
) [static]

Definition at line 5657 of file nsTableFrame.cpp.

{
  PRBool changed = (aNewBorder.style != aBorder.style) ||
                   (aNewBorder.width != aBorder.width) ||
                   (aNewBorder.color != aBorder.color);
  aBorder.color        = aNewBorder.color;
  aBorder.width        = aNewBorder.width;
  aBorder.style        = aNewBorder.style;
  aBorder.owner        = aNewBorder.owner;

  return changed;
}

Here is the caller graph for this function:

static PRBool SetHorBorder ( const BCCellBorder aNewBorder,
const BCCornerInfo aCorner,
BCCellBorder aBorder 
) [static]

Definition at line 5675 of file nsTableFrame.cpp.

{
  PRBool startSeg = ::SetBorder(aNewBorder, aBorder);
  if (!startSeg) {
    startSeg = ((NS_SIDE_LEFT != aCorner.ownerSide) && (NS_SIDE_RIGHT != aCorner.ownerSide));
  }
  return startSeg;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void UpdateCol ( nsTableFrame aTableFrame,
nsTableColFrame aColFrame,
const nsTableCellFrame aCellFrame,
nscoord  aColMaxWidth,
PRBool  aColMaxGetsBigger 
) [static]

Definition at line 3806 of file nsTableFrame.cpp.

{
  if (aColMaxGetsBigger) {
    // update the columns's new min width
    aColFrame.SetWidth(DES_CON, aColMaxWidth);
  }
  else {
    // determine the new max width
    PRInt32 numRows = aTableFrame.GetRowCount();
    PRInt32 colIndex = aColFrame.GetColIndex();
    PRBool originates;
    PRInt32 colSpan;
    nscoord maxWidth = 0;
    for (PRInt32 rowX = 0; rowX < numRows; rowX++) {
      nsTableCellFrame* cellFrame = aTableFrame.GetCellInfoAt(rowX, colIndex, &originates, &colSpan);
      if (cellFrame && originates && (1 == colSpan)) {
        maxWidth = PR_MAX(maxWidth, cellFrame->GetMaximumWidth());
      }
    }
    // update the columns's new max width
    aColFrame.SetWidth(DES_CON, maxWidth);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

PRUint8 styleToPriority[13] [static]
Initial value:
 { 0,  
                                       3,  
                                       6,  
                                       7,  
                                       8,  
                                       10, 
                                       11, 
                                       2,  
                                       5,  
                                       12, 
                                       1,  
                                       4,  
                                       9 }

Definition at line 5146 of file nsTableFrame.cpp.