Made SetStyleContext take the presentation context as a parameter
Made DidSetStyleContext virtual, since we need to override the behavior in subclasses Moved attribute setting logic from nsTableCell to nsTableCellFrame Table Borders are being drawn again : ) Table Padding is being displayed
This commit is contained in:
@@ -82,7 +82,7 @@ void nsTableCaptionFrame::CreatePsuedoFrame(nsIPresContext* aPresContext)
|
|||||||
// Resolve style and set the style context
|
// Resolve style and set the style context
|
||||||
nsIStyleContext* styleContext =
|
nsIStyleContext* styleContext =
|
||||||
aPresContext->ResolveStyleContextFor(mContent, this); // styleContext: ADDREF++
|
aPresContext->ResolveStyleContextFor(mContent, this); // styleContext: ADDREF++
|
||||||
mFirstChild->SetStyleContext(styleContext);
|
mFirstChild->SetStyleContext(aPresContext,styleContext);
|
||||||
NS_RELEASE(styleContext); // styleContext: ADDREF--
|
NS_RELEASE(styleContext); // styleContext: ADDREF--
|
||||||
} else {
|
} else {
|
||||||
nsTableCaptionFrame* prevFrame = (nsTableCaptionFrame *)mPrevInFlow;
|
nsTableCaptionFrame* prevFrame = (nsTableCaptionFrame *)mPrevInFlow;
|
||||||
|
|||||||
@@ -191,95 +191,6 @@ void nsTableCell::SetAttribute(nsIAtom* aAttribute, const nsString& aValue)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void nsTableCell::MapHTMLBorderStyle(nsStyleBorder& aBorderStyle, nscoord aBorderWidth)
|
|
||||||
{
|
|
||||||
for (PRInt32 index = 0; index < 4; index++)
|
|
||||||
aBorderStyle.mSizeFlag[index] = NS_STYLE_BORDER_WIDTH_LENGTH_VALUE;
|
|
||||||
|
|
||||||
aBorderStyle.mSize.top =
|
|
||||||
aBorderStyle.mSize.left =
|
|
||||||
aBorderStyle.mSize.bottom =
|
|
||||||
aBorderStyle.mSize.right = aBorderWidth;
|
|
||||||
|
|
||||||
|
|
||||||
aBorderStyle.mStyle[NS_SIDE_TOP] = NS_STYLE_BORDER_STYLE_INSET;
|
|
||||||
aBorderStyle.mStyle[NS_SIDE_LEFT] = NS_STYLE_BORDER_STYLE_INSET;
|
|
||||||
aBorderStyle.mStyle[NS_SIDE_BOTTOM] = NS_STYLE_BORDER_STYLE_OUTSET;
|
|
||||||
aBorderStyle.mStyle[NS_SIDE_RIGHT] = NS_STYLE_BORDER_STYLE_OUTSET;
|
|
||||||
|
|
||||||
NS_ColorNameToRGB("white",&aBorderStyle.mColor[NS_SIDE_TOP]);
|
|
||||||
NS_ColorNameToRGB("white",&aBorderStyle.mColor[NS_SIDE_LEFT]);
|
|
||||||
|
|
||||||
// This should be the background color of the tables
|
|
||||||
// container
|
|
||||||
NS_ColorNameToRGB("gray",&aBorderStyle.mColor[NS_SIDE_BOTTOM]);
|
|
||||||
NS_ColorNameToRGB("gray",&aBorderStyle.mColor[NS_SIDE_RIGHT]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void nsTableCell::MapBorderMarginPaddingInto(nsIStyleContext* aContext,
|
|
||||||
nsIPresContext* aPresContext)
|
|
||||||
{
|
|
||||||
// Check to see if the table has either cell padding or
|
|
||||||
// Cell spacing defined for the table. If true, then
|
|
||||||
// this setting overrides any specific border, margin or
|
|
||||||
// padding information in the cell. If these attributes
|
|
||||||
// are not defined, the the cells attributes are used
|
|
||||||
|
|
||||||
nsHTMLValue padding_value;
|
|
||||||
nsHTMLValue spacing_value;
|
|
||||||
nsHTMLValue border_value;
|
|
||||||
|
|
||||||
nsContentAttr padding_result;
|
|
||||||
nsContentAttr spacing_result;
|
|
||||||
nsContentAttr border_result;
|
|
||||||
|
|
||||||
NS_ASSERTION(mTable,"Table Must not be null");
|
|
||||||
if (!mTable)
|
|
||||||
return;
|
|
||||||
|
|
||||||
padding_result = mTable->GetAttribute(nsHTMLAtoms::cellpadding,padding_value);
|
|
||||||
spacing_result = mTable->GetAttribute(nsHTMLAtoms::cellspacing,spacing_value);
|
|
||||||
border_result = mTable->GetAttribute(nsHTMLAtoms::border,border_value);
|
|
||||||
|
|
||||||
// check to see if cellpadding or cellspacing is defined
|
|
||||||
if (spacing_result == eContentAttr_HasValue || padding_result == eContentAttr_HasValue)
|
|
||||||
{
|
|
||||||
nscoord padding = 0;
|
|
||||||
nscoord spacing = 0;
|
|
||||||
nscoord border = 0;
|
|
||||||
|
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
|
||||||
if (padding_result == eContentAttr_HasValue)
|
|
||||||
padding = p2t*(float)padding_value.GetPixelValue();
|
|
||||||
|
|
||||||
if (spacing_result == eContentAttr_HasValue)
|
|
||||||
spacing = p2t*(float)spacing_value.GetPixelValue();
|
|
||||||
|
|
||||||
nsStyleSpacing* spacingData = (nsStyleSpacing*)aContext->GetData(kStyleSpacingSID);
|
|
||||||
spacingData->mMargin.SizeTo(spacing,spacing,spacing,spacing);
|
|
||||||
spacingData->mPadding.top =
|
|
||||||
spacingData->mPadding.left =
|
|
||||||
spacingData->mPadding.bottom =
|
|
||||||
spacingData->mPadding.right = padding;
|
|
||||||
|
|
||||||
nsStyleBorder& borderData = *(nsStyleBorder*)aContext->GetData(kStyleBorderSID);
|
|
||||||
if (border_result == eContentAttr_HasValue)
|
|
||||||
{
|
|
||||||
// The HTML rule is that if the table's border style is
|
|
||||||
// zero, then the cell's border width is also zero,
|
|
||||||
// otherwise the cell's border width is one
|
|
||||||
|
|
||||||
PRInt32 intValue = border_value.GetPixelValue();
|
|
||||||
if (intValue > 0)
|
|
||||||
intValue = 1;
|
|
||||||
border = p2t*(float)intValue;
|
|
||||||
MapHTMLBorderStyle(borderData,border);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void nsTableCell::MapAttributesInto(nsIStyleContext* aContext,
|
void nsTableCell::MapAttributesInto(nsIStyleContext* aContext,
|
||||||
nsIPresContext* aPresContext)
|
nsIPresContext* aPresContext)
|
||||||
@@ -291,15 +202,13 @@ void nsTableCell::MapAttributesInto(nsIStyleContext* aContext,
|
|||||||
|
|
||||||
// align: enum
|
// align: enum
|
||||||
GetAttribute(nsHTMLAtoms::align, value);
|
GetAttribute(nsHTMLAtoms::align, value);
|
||||||
if (value.GetUnit() == eHTMLUnit_Enumerated) {
|
if (value.GetUnit() == eHTMLUnit_Enumerated)
|
||||||
|
{
|
||||||
nsStyleText* text = (nsStyleText*)aContext->GetData(kStyleTextSID);
|
nsStyleText* text = (nsStyleText*)aContext->GetData(kStyleTextSID);
|
||||||
text->mTextAlign = value.GetIntValue();
|
text->mTextAlign = value.GetIntValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
MapBorderMarginPaddingInto(aContext,aPresContext);
|
|
||||||
MapBackgroundAttributesInto(aContext, aPresContext);
|
MapBackgroundAttributesInto(aContext, aPresContext);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsTableCell::SetRowSpan(int aRowSpan)
|
void nsTableCell::SetRowSpan(int aRowSpan)
|
||||||
|
|||||||
@@ -96,9 +96,6 @@ public:
|
|||||||
nsIPresContext* aPresContext);
|
nsIPresContext* aPresContext);
|
||||||
|
|
||||||
|
|
||||||
virtual void MapHTMLBorderStyle(nsStyleBorder& aBorderStyle, nscoord aBorderWidth);
|
|
||||||
virtual void MapBorderMarginPaddingInto(nsIStyleContext* aContext,
|
|
||||||
nsIPresContext* aPresContext);
|
|
||||||
|
|
||||||
/** @return the number of rows spanned by this cell. Always >= 1 */
|
/** @return the number of rows spanned by this cell. Always >= 1 */
|
||||||
virtual int GetRowSpan ();
|
virtual int GetRowSpan ();
|
||||||
|
|||||||
@@ -26,10 +26,11 @@
|
|||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIContentDelegate.h"
|
#include "nsIContentDelegate.h"
|
||||||
#include "nsCSSLayout.h"
|
#include "nsCSSLayout.h"
|
||||||
|
#include "nsHTMLAtoms.h"
|
||||||
|
|
||||||
#ifdef NS_DEBUG
|
#ifdef NS_DEBUG
|
||||||
static PRBool gsDebug = PR_FALSE;
|
static PRBool gsDebug = PR_FALSE;
|
||||||
//#define NOISY
|
#define NOISY_STYLE
|
||||||
//#define NOISY_FLOW
|
//#define NOISY_FLOW
|
||||||
#else
|
#else
|
||||||
static const PRBool gsDebug = PR_FALSE;
|
static const PRBool gsDebug = PR_FALSE;
|
||||||
@@ -185,7 +186,7 @@ void nsTableCellFrame::CreatePsuedoFrame(nsIPresContext* aPresContext)
|
|||||||
// Resolve style and set the style context
|
// Resolve style and set the style context
|
||||||
nsIStyleContext* styleContext =
|
nsIStyleContext* styleContext =
|
||||||
aPresContext->ResolveStyleContextFor(mContent, this); // styleContext: ADDREF++
|
aPresContext->ResolveStyleContextFor(mContent, this); // styleContext: ADDREF++
|
||||||
mFirstChild->SetStyleContext(styleContext);
|
mFirstChild->SetStyleContext(aPresContext,styleContext);
|
||||||
NS_RELEASE(styleContext); // styleContext: ADDREF--
|
NS_RELEASE(styleContext); // styleContext: ADDREF--
|
||||||
} else {
|
} else {
|
||||||
nsTableCellFrame* prevFrame = (nsTableCellFrame *)mPrevInFlow;
|
nsTableCellFrame* prevFrame = (nsTableCellFrame *)mPrevInFlow;
|
||||||
@@ -345,6 +346,129 @@ NS_METHOD nsTableCellFrame::CreateContinuingFrame(nsIPresContext* aPresContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Update the border style to map to the HTML border style
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void nsTableCellFrame::MapHTMLBorderStyle(nsStyleBorder& aBorderStyle, nscoord aBorderWidth)
|
||||||
|
{
|
||||||
|
for (PRInt32 index = 0; index < 4; index++)
|
||||||
|
aBorderStyle.mSizeFlag[index] = NS_STYLE_BORDER_WIDTH_LENGTH_VALUE;
|
||||||
|
|
||||||
|
aBorderStyle.mSize.top =
|
||||||
|
aBorderStyle.mSize.left =
|
||||||
|
aBorderStyle.mSize.bottom =
|
||||||
|
aBorderStyle.mSize.right = aBorderWidth;
|
||||||
|
|
||||||
|
|
||||||
|
aBorderStyle.mStyle[NS_SIDE_TOP] = NS_STYLE_BORDER_STYLE_INSET;
|
||||||
|
aBorderStyle.mStyle[NS_SIDE_LEFT] = NS_STYLE_BORDER_STYLE_INSET;
|
||||||
|
aBorderStyle.mStyle[NS_SIDE_BOTTOM] = NS_STYLE_BORDER_STYLE_OUTSET;
|
||||||
|
aBorderStyle.mStyle[NS_SIDE_RIGHT] = NS_STYLE_BORDER_STYLE_OUTSET;
|
||||||
|
|
||||||
|
NS_ColorNameToRGB("white",&aBorderStyle.mColor[NS_SIDE_TOP]);
|
||||||
|
NS_ColorNameToRGB("white",&aBorderStyle.mColor[NS_SIDE_LEFT]);
|
||||||
|
|
||||||
|
// This should be the background color of the tables
|
||||||
|
// container
|
||||||
|
NS_ColorNameToRGB("gray",&aBorderStyle.mColor[NS_SIDE_BOTTOM]);
|
||||||
|
NS_ColorNameToRGB("gray",&aBorderStyle.mColor[NS_SIDE_RIGHT]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void nsTableCellFrame::MapBorderMarginPadding(nsIPresContext* aPresContext)
|
||||||
|
{
|
||||||
|
// Check to see if the table has either cell padding or
|
||||||
|
// Cell spacing defined for the table. If true, then
|
||||||
|
// this setting overrides any specific border, margin or
|
||||||
|
// padding information in the cell. If these attributes
|
||||||
|
// are not defined, the the cells attributes are used
|
||||||
|
|
||||||
|
nsHTMLValue padding_value;
|
||||||
|
nsHTMLValue spacing_value;
|
||||||
|
nsHTMLValue border_value;
|
||||||
|
|
||||||
|
nsContentAttr padding_result;
|
||||||
|
nsContentAttr spacing_result;
|
||||||
|
nsContentAttr border_result;
|
||||||
|
|
||||||
|
nscoord padding = 0;
|
||||||
|
nscoord spacing = 0;
|
||||||
|
nscoord border = 1;
|
||||||
|
|
||||||
|
float p2t = aPresContext->GetPixelsToTwips();
|
||||||
|
|
||||||
|
nsTablePart* table = ((nsTableContent*)mContent)->GetTable();
|
||||||
|
|
||||||
|
NS_ASSERTION(table,"Table Must not be null");
|
||||||
|
if (!table)
|
||||||
|
return;
|
||||||
|
|
||||||
|
padding_result = table->GetAttribute(nsHTMLAtoms::cellpadding,padding_value);
|
||||||
|
spacing_result = table->GetAttribute(nsHTMLAtoms::cellspacing,spacing_value);
|
||||||
|
border_result = table->GetAttribute(nsHTMLAtoms::border,border_value);
|
||||||
|
|
||||||
|
// check to see if cellpadding or cellspacing is defined
|
||||||
|
if (spacing_result == eContentAttr_HasValue || padding_result == eContentAttr_HasValue)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (padding_result == eContentAttr_HasValue)
|
||||||
|
padding = (nscoord)(p2t*(float)padding_value.GetPixelValue());
|
||||||
|
|
||||||
|
if (spacing_result == eContentAttr_HasValue)
|
||||||
|
spacing = (nscoord)(p2t*(float)spacing_value.GetPixelValue());
|
||||||
|
|
||||||
|
nsStyleSpacing* spacingData = (nsStyleSpacing*)mStyleContext->GetData(kStyleSpacingSID);
|
||||||
|
spacingData->mMargin.SizeTo(spacing,spacing,spacing,spacing);
|
||||||
|
spacingData->mPadding.top =
|
||||||
|
spacingData->mPadding.left =
|
||||||
|
spacingData->mPadding.bottom =
|
||||||
|
spacingData->mPadding.right = padding;
|
||||||
|
|
||||||
|
}
|
||||||
|
if (border_result == eContentAttr_HasValue)
|
||||||
|
{
|
||||||
|
PRInt32 intValue = border_value.GetPixelValue();
|
||||||
|
if (intValue > 0)
|
||||||
|
intValue = 1;
|
||||||
|
border = nscoord(p2t*(float)intValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
nsStyleBorder& borderData = *(nsStyleBorder*)mStyleContext->GetData(kStyleBorderSID);
|
||||||
|
MapHTMLBorderStyle(borderData,border);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nsTableCellFrame::MapTextAttributes(nsIPresContext* aPresContext)
|
||||||
|
{
|
||||||
|
nsHTMLValue value;
|
||||||
|
|
||||||
|
((nsTableCell*)mContent)->GetAttribute(nsHTMLAtoms::align, value);
|
||||||
|
if (value.GetUnit() == eHTMLUnit_Enumerated)
|
||||||
|
{
|
||||||
|
nsStyleText* text = (nsStyleText*)mStyleContext->GetData(kStyleTextSID);
|
||||||
|
text->mTextAlign = value.GetIntValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Subclass hook for style post processing
|
||||||
|
NS_METHOD nsTableCellFrame::DidSetStyleContext(nsIPresContext* aPresContext)
|
||||||
|
{
|
||||||
|
#ifdef NOISY_STYLE
|
||||||
|
printf("nsTableCellFrame::DidSetStyleContext \n");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
MapTextAttributes(aPresContext);
|
||||||
|
MapBorderMarginPadding(aPresContext);
|
||||||
|
mStyleContext->RecalcAutomaticData();
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----- static methods ----- */
|
/* ----- static methods ----- */
|
||||||
|
|
||||||
nsresult nsTableCellFrame::NewFrame(nsIFrame** aInstancePtrResult,
|
nsresult nsTableCellFrame::NewFrame(nsIFrame** aInstancePtrResult,
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ public:
|
|||||||
|
|
||||||
virtual ~nsTableCellFrame();
|
virtual ~nsTableCellFrame();
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** protected constructor.
|
/** protected constructor.
|
||||||
@@ -85,6 +86,16 @@ protected:
|
|||||||
*/
|
*/
|
||||||
virtual void CreatePsuedoFrame(nsIPresContext* aPresContext);
|
virtual void CreatePsuedoFrame(nsIPresContext* aPresContext);
|
||||||
|
|
||||||
|
// Subclass hook for style post processing
|
||||||
|
NS_METHOD DidSetStyleContext(nsIPresContext* aPresContext);
|
||||||
|
void MapTextAttributes(nsIPresContext* aPresContext);
|
||||||
|
void MapBorderMarginPadding(nsIPresContext* aPresContext);
|
||||||
|
void MapHTMLBorderStyle(nsStyleBorder& aBorderStyle, nscoord aBorderWidth);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ static PRBool gsTiming = PR_FALSE;
|
|||||||
static PRBool gsDebugMBP = PR_FALSE;
|
static PRBool gsDebugMBP = PR_FALSE;
|
||||||
//#define NOISY
|
//#define NOISY
|
||||||
//#define NOISY_FLOW
|
//#define NOISY_FLOW
|
||||||
|
//#ifdef NOISY_STYLE
|
||||||
#else
|
#else
|
||||||
static const PRBool gsDebug = PR_FALSE;
|
static const PRBool gsDebug = PR_FALSE;
|
||||||
static const PRBool gsDebugCLD = PR_FALSE;
|
static const PRBool gsDebugCLD = PR_FALSE;
|
||||||
@@ -640,7 +641,7 @@ nsIFrame::ReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresCont
|
|||||||
kidDel = kid->GetDelegate(aPresContext);
|
kidDel = kid->GetDelegate(aPresContext);
|
||||||
kidFrame = kidDel->CreateFrame(aPresContext, kid, contentOffset, this);
|
kidFrame = kidDel->CreateFrame(aPresContext, kid, contentOffset, this);
|
||||||
NS_RELEASE(kidDel);
|
NS_RELEASE(kidDel);
|
||||||
kidFrame->SetStyleContext(kidStyleContext);
|
kidFrame->SetStyleContext(aPresContext,kidStyleContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSize maxKidElementSize;
|
nsSize maxKidElementSize;
|
||||||
@@ -1415,7 +1416,7 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
|
|||||||
kidDel = kid->GetDelegate(aPresContext);
|
kidDel = kid->GetDelegate(aPresContext);
|
||||||
kidFrame = kidDel->CreateFrame(aPresContext, kid, kidIndex, this);
|
kidFrame = kidDel->CreateFrame(aPresContext, kid, kidIndex, this);
|
||||||
NS_RELEASE(kidDel);
|
NS_RELEASE(kidDel);
|
||||||
kidFrame->SetStyleContext(kidStyleContext);
|
kidFrame->SetStyleContext(aPresContext, kidStyleContext);
|
||||||
} else {
|
} else {
|
||||||
kidPrevInFlow->CreateContinuingFrame(aPresContext, this, kidFrame);
|
kidPrevInFlow->CreateContinuingFrame(aPresContext, this, kidFrame);
|
||||||
}
|
}
|
||||||
@@ -2077,7 +2078,7 @@ NS_METHOD nsTableFrame::CreateContinuingFrame(nsIPresContext* aPresContext,
|
|||||||
kidDel = content->GetDelegate(aPresContext); // kidDel: REFCNT++
|
kidDel = content->GetDelegate(aPresContext); // kidDel: REFCNT++
|
||||||
nsIFrame * duplicateFrame = kidDel->CreateFrame(aPresContext, content, index, cf);
|
nsIFrame * duplicateFrame = kidDel->CreateFrame(aPresContext, content, index, cf);
|
||||||
NS_RELEASE(kidDel); // kidDel: REFCNT--
|
NS_RELEASE(kidDel); // kidDel: REFCNT--
|
||||||
duplicateFrame->SetStyleContext(kidStyleContext);
|
duplicateFrame->SetStyleContext(aPresContext,kidStyleContext);
|
||||||
NS_RELEASE(kidStyleContext); // kidStyleContenxt: REFCNT--
|
NS_RELEASE(kidStyleContext); // kidStyleContenxt: REFCNT--
|
||||||
|
|
||||||
if (nsnull==lastSib)
|
if (nsnull==lastSib)
|
||||||
@@ -2147,6 +2148,14 @@ void nsTableFrame::SetColumnWidth(PRInt32 aColIndex, PRInt32 aWidth)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Subclass hook for style post processing
|
||||||
|
NS_METHOD nsTableFrame::DidSetStyleContext(nsIPresContext* aPresContext)
|
||||||
|
{
|
||||||
|
#ifdef NOISY_STYLE
|
||||||
|
printf("nsTableFrame::DidSetStyleContext \n");
|
||||||
|
#endif
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* ---------- static methods ---------- */
|
/* ---------- static methods ---------- */
|
||||||
|
|
||||||
|
|||||||
@@ -297,6 +297,9 @@ protected:
|
|||||||
/** returns PR_TRUE if the cached pass 1 data is still valid */
|
/** returns PR_TRUE if the cached pass 1 data is still valid */
|
||||||
virtual PRBool IsFirstPassValid() const;
|
virtual PRBool IsFirstPassValid() const;
|
||||||
|
|
||||||
|
/** do post processing to setting up style information for the frame */
|
||||||
|
virtual NS_METHOD DidSetStyleContext(nsIPresContext* aPresContext);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void nsTableFrame::DebugPrintCount() const; // Debugging routine
|
void nsTableFrame::DebugPrintCount() const; // Debugging routine
|
||||||
|
|
||||||
|
|||||||
@@ -227,16 +227,17 @@ NS_METHOD nsTableOuterFrame::ResizeReflow(nsIPresContext* aPresContext,
|
|||||||
aStatus = mInnerTableFrame->ResizeReflowPass1(aPresContext, aDesiredSize, aMaxSize,
|
aStatus = mInnerTableFrame->ResizeReflowPass1(aPresContext, aDesiredSize, aMaxSize,
|
||||||
&innerTableMaxElementSize);
|
&innerTableMaxElementSize);
|
||||||
|
|
||||||
|
nsIContentPtr content;
|
||||||
|
mInnerTableFrame->GetContent(content.AssignRef());
|
||||||
|
nsTablePart *table = (nsTablePart*)(nsIContent*)content;
|
||||||
#ifdef NOISY_MARGINS
|
#ifdef NOISY_MARGINS
|
||||||
nsIContent* content = nsnull;
|
|
||||||
mInnerTableFrame->GetContent(content);
|
|
||||||
nsTablePart *table = (nsTablePart*)content;
|
|
||||||
if (table != nsnull)
|
if (table != nsnull)
|
||||||
table->DumpCellMap();
|
table->DumpCellMap();
|
||||||
|
#endif
|
||||||
mInnerTableFrame->RecalcLayoutData();
|
mInnerTableFrame->RecalcLayoutData();
|
||||||
|
#ifdef NOISY_MARGINS
|
||||||
mInnerTableFrame->ListColumnLayoutData(stdout,1);
|
mInnerTableFrame->ListColumnLayoutData(stdout,1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
mInnerTableFrame->SetReflowPass(nsTableFrame::kPASS_SECOND);
|
mInnerTableFrame->SetReflowPass(nsTableFrame::kPASS_SECOND);
|
||||||
// assign table width info only if the inner table frame is a first-in-flow
|
// assign table width info only if the inner table frame is a first-in-flow
|
||||||
@@ -945,7 +946,7 @@ void nsTableOuterFrame::CreateChildFrames(nsIPresContext* aPresContext)
|
|||||||
nsIStyleContextPtr kidStyleContext =
|
nsIStyleContextPtr kidStyleContext =
|
||||||
aPresContext->ResolveStyleContextFor(mContent, this);
|
aPresContext->ResolveStyleContextFor(mContent, this);
|
||||||
NS_ASSERTION(kidStyleContext.IsNotNull(), "bad style context for kid.");
|
NS_ASSERTION(kidStyleContext.IsNotNull(), "bad style context for kid.");
|
||||||
mInnerTableFrame->SetStyleContext(kidStyleContext);
|
mInnerTableFrame->SetStyleContext(aPresContext,kidStyleContext);
|
||||||
mChildCount++;
|
mChildCount++;
|
||||||
// Link child frame into the list of children
|
// Link child frame into the list of children
|
||||||
mFirstChild = mInnerTableFrame;
|
mFirstChild = mInnerTableFrame;
|
||||||
@@ -974,7 +975,7 @@ void nsTableOuterFrame::CreateChildFrames(nsIPresContext* aPresContext)
|
|||||||
NS_ASSERTION(captionStyleContext.IsNotNull(), "bad style context for caption.");
|
NS_ASSERTION(captionStyleContext.IsNotNull(), "bad style context for caption.");
|
||||||
nsStyleText* captionStyle =
|
nsStyleText* captionStyle =
|
||||||
(nsStyleText*)captionStyleContext->GetData(kStyleTextSID);
|
(nsStyleText*)captionStyleContext->GetData(kStyleTextSID);
|
||||||
captionFrame->SetStyleContext(captionStyleContext);
|
captionFrame->SetStyleContext(aPresContext,captionStyleContext);
|
||||||
mChildCount++;
|
mChildCount++;
|
||||||
// Link child frame into the list of children
|
// Link child frame into the list of children
|
||||||
if ((eStyleUnit_Enumerated == captionStyle->mVerticalAlign.GetUnit()) &&
|
if ((eStyleUnit_Enumerated == captionStyle->mVerticalAlign.GetUnit()) &&
|
||||||
@@ -1244,7 +1245,7 @@ void nsTableOuterFrame::PrepareContinuingFrame(nsIPresContext* aPresContext,
|
|||||||
// XXX presumptive
|
// XXX presumptive
|
||||||
nsIStyleContextPtr styleContext =
|
nsIStyleContextPtr styleContext =
|
||||||
aPresContext->ResolveStyleContextFor(mContent, aParent);
|
aPresContext->ResolveStyleContextFor(mContent, aParent);
|
||||||
aContFrame->SetStyleContext(styleContext);
|
aContFrame->SetStyleContext(aPresContext,styleContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_METHOD nsTableOuterFrame::VerifyTree() const
|
NS_METHOD nsTableOuterFrame::VerifyTree() const
|
||||||
@@ -1363,7 +1364,7 @@ void nsTableOuterFrame::CreateInnerTableFrame(nsIPresContext* aPresContext)
|
|||||||
// Resolve style and set the style context
|
// Resolve style and set the style context
|
||||||
nsIStyleContextPtr styleContext =
|
nsIStyleContextPtr styleContext =
|
||||||
aPresContext->ResolveStyleContextFor(mContent, this);
|
aPresContext->ResolveStyleContextFor(mContent, this);
|
||||||
mInnerTableFrame->SetStyleContext(styleContext);
|
mInnerTableFrame->SetStyleContext(aPresContext,styleContext);
|
||||||
} else {
|
} else {
|
||||||
nsTableOuterFrame* prevOuterTable = (nsTableOuterFrame*)mPrevInFlow;
|
nsTableOuterFrame* prevOuterTable = (nsTableOuterFrame*)mPrevInFlow;
|
||||||
|
|
||||||
|
|||||||
@@ -153,6 +153,14 @@ nsTablePart::~nsTablePart()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
nsTablePart::void compact() {
|
||||||
|
compact();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// for debugging only
|
// for debugging only
|
||||||
nsrefcnt nsTablePart::AddRef(void)
|
nsrefcnt nsTablePart::AddRef(void)
|
||||||
{
|
{
|
||||||
@@ -1064,7 +1072,6 @@ void nsTablePart::MapAttributesInto(nsIStyleContext* aContext,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// border
|
// border
|
||||||
GetTableBorder(this, aContext, aPresContext, PR_FALSE);
|
GetTableBorder(this, aContext, aPresContext, PR_FALSE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -811,7 +811,7 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext,
|
|||||||
kidDel = cell->GetDelegate(aPresContext);
|
kidDel = cell->GetDelegate(aPresContext);
|
||||||
kidFrame = kidDel->CreateFrame(aPresContext, cell, kidIndex, this);
|
kidFrame = kidDel->CreateFrame(aPresContext, cell, kidIndex, this);
|
||||||
NS_RELEASE(kidDel);
|
NS_RELEASE(kidDel);
|
||||||
kidFrame->SetStyleContext(kidStyleContext);
|
kidFrame->SetStyleContext(aPresContext,kidStyleContext);
|
||||||
} else {
|
} else {
|
||||||
kidPrevInFlow->CreateContinuingFrame(aPresContext, this, kidFrame);
|
kidPrevInFlow->CreateContinuingFrame(aPresContext, this, kidFrame);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -743,7 +743,7 @@ nsTableRowGroupFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
|
|||||||
kidDel = kid->GetDelegate(aPresContext);
|
kidDel = kid->GetDelegate(aPresContext);
|
||||||
kidFrame = kidDel->CreateFrame(aPresContext, kid, kidIndex, this);
|
kidFrame = kidDel->CreateFrame(aPresContext, kid, kidIndex, this);
|
||||||
NS_RELEASE(kidDel);
|
NS_RELEASE(kidDel);
|
||||||
kidFrame->SetStyleContext(kidSC);
|
kidFrame->SetStyleContext(aPresContext,kidSC);
|
||||||
} else {
|
} else {
|
||||||
kidPrevInFlow->CreateContinuingFrame(aPresContext, this, kidFrame);
|
kidPrevInFlow->CreateContinuingFrame(aPresContext, this, kidFrame);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,10 +26,11 @@
|
|||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIContentDelegate.h"
|
#include "nsIContentDelegate.h"
|
||||||
#include "nsCSSLayout.h"
|
#include "nsCSSLayout.h"
|
||||||
|
#include "nsHTMLAtoms.h"
|
||||||
|
|
||||||
#ifdef NS_DEBUG
|
#ifdef NS_DEBUG
|
||||||
static PRBool gsDebug = PR_FALSE;
|
static PRBool gsDebug = PR_FALSE;
|
||||||
//#define NOISY
|
#define NOISY_STYLE
|
||||||
//#define NOISY_FLOW
|
//#define NOISY_FLOW
|
||||||
#else
|
#else
|
||||||
static const PRBool gsDebug = PR_FALSE;
|
static const PRBool gsDebug = PR_FALSE;
|
||||||
@@ -185,7 +186,7 @@ void nsTableCellFrame::CreatePsuedoFrame(nsIPresContext* aPresContext)
|
|||||||
// Resolve style and set the style context
|
// Resolve style and set the style context
|
||||||
nsIStyleContext* styleContext =
|
nsIStyleContext* styleContext =
|
||||||
aPresContext->ResolveStyleContextFor(mContent, this); // styleContext: ADDREF++
|
aPresContext->ResolveStyleContextFor(mContent, this); // styleContext: ADDREF++
|
||||||
mFirstChild->SetStyleContext(styleContext);
|
mFirstChild->SetStyleContext(aPresContext,styleContext);
|
||||||
NS_RELEASE(styleContext); // styleContext: ADDREF--
|
NS_RELEASE(styleContext); // styleContext: ADDREF--
|
||||||
} else {
|
} else {
|
||||||
nsTableCellFrame* prevFrame = (nsTableCellFrame *)mPrevInFlow;
|
nsTableCellFrame* prevFrame = (nsTableCellFrame *)mPrevInFlow;
|
||||||
@@ -345,6 +346,129 @@ NS_METHOD nsTableCellFrame::CreateContinuingFrame(nsIPresContext* aPresContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Update the border style to map to the HTML border style
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void nsTableCellFrame::MapHTMLBorderStyle(nsStyleBorder& aBorderStyle, nscoord aBorderWidth)
|
||||||
|
{
|
||||||
|
for (PRInt32 index = 0; index < 4; index++)
|
||||||
|
aBorderStyle.mSizeFlag[index] = NS_STYLE_BORDER_WIDTH_LENGTH_VALUE;
|
||||||
|
|
||||||
|
aBorderStyle.mSize.top =
|
||||||
|
aBorderStyle.mSize.left =
|
||||||
|
aBorderStyle.mSize.bottom =
|
||||||
|
aBorderStyle.mSize.right = aBorderWidth;
|
||||||
|
|
||||||
|
|
||||||
|
aBorderStyle.mStyle[NS_SIDE_TOP] = NS_STYLE_BORDER_STYLE_INSET;
|
||||||
|
aBorderStyle.mStyle[NS_SIDE_LEFT] = NS_STYLE_BORDER_STYLE_INSET;
|
||||||
|
aBorderStyle.mStyle[NS_SIDE_BOTTOM] = NS_STYLE_BORDER_STYLE_OUTSET;
|
||||||
|
aBorderStyle.mStyle[NS_SIDE_RIGHT] = NS_STYLE_BORDER_STYLE_OUTSET;
|
||||||
|
|
||||||
|
NS_ColorNameToRGB("white",&aBorderStyle.mColor[NS_SIDE_TOP]);
|
||||||
|
NS_ColorNameToRGB("white",&aBorderStyle.mColor[NS_SIDE_LEFT]);
|
||||||
|
|
||||||
|
// This should be the background color of the tables
|
||||||
|
// container
|
||||||
|
NS_ColorNameToRGB("gray",&aBorderStyle.mColor[NS_SIDE_BOTTOM]);
|
||||||
|
NS_ColorNameToRGB("gray",&aBorderStyle.mColor[NS_SIDE_RIGHT]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void nsTableCellFrame::MapBorderMarginPadding(nsIPresContext* aPresContext)
|
||||||
|
{
|
||||||
|
// Check to see if the table has either cell padding or
|
||||||
|
// Cell spacing defined for the table. If true, then
|
||||||
|
// this setting overrides any specific border, margin or
|
||||||
|
// padding information in the cell. If these attributes
|
||||||
|
// are not defined, the the cells attributes are used
|
||||||
|
|
||||||
|
nsHTMLValue padding_value;
|
||||||
|
nsHTMLValue spacing_value;
|
||||||
|
nsHTMLValue border_value;
|
||||||
|
|
||||||
|
nsContentAttr padding_result;
|
||||||
|
nsContentAttr spacing_result;
|
||||||
|
nsContentAttr border_result;
|
||||||
|
|
||||||
|
nscoord padding = 0;
|
||||||
|
nscoord spacing = 0;
|
||||||
|
nscoord border = 1;
|
||||||
|
|
||||||
|
float p2t = aPresContext->GetPixelsToTwips();
|
||||||
|
|
||||||
|
nsTablePart* table = ((nsTableContent*)mContent)->GetTable();
|
||||||
|
|
||||||
|
NS_ASSERTION(table,"Table Must not be null");
|
||||||
|
if (!table)
|
||||||
|
return;
|
||||||
|
|
||||||
|
padding_result = table->GetAttribute(nsHTMLAtoms::cellpadding,padding_value);
|
||||||
|
spacing_result = table->GetAttribute(nsHTMLAtoms::cellspacing,spacing_value);
|
||||||
|
border_result = table->GetAttribute(nsHTMLAtoms::border,border_value);
|
||||||
|
|
||||||
|
// check to see if cellpadding or cellspacing is defined
|
||||||
|
if (spacing_result == eContentAttr_HasValue || padding_result == eContentAttr_HasValue)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (padding_result == eContentAttr_HasValue)
|
||||||
|
padding = (nscoord)(p2t*(float)padding_value.GetPixelValue());
|
||||||
|
|
||||||
|
if (spacing_result == eContentAttr_HasValue)
|
||||||
|
spacing = (nscoord)(p2t*(float)spacing_value.GetPixelValue());
|
||||||
|
|
||||||
|
nsStyleSpacing* spacingData = (nsStyleSpacing*)mStyleContext->GetData(kStyleSpacingSID);
|
||||||
|
spacingData->mMargin.SizeTo(spacing,spacing,spacing,spacing);
|
||||||
|
spacingData->mPadding.top =
|
||||||
|
spacingData->mPadding.left =
|
||||||
|
spacingData->mPadding.bottom =
|
||||||
|
spacingData->mPadding.right = padding;
|
||||||
|
|
||||||
|
}
|
||||||
|
if (border_result == eContentAttr_HasValue)
|
||||||
|
{
|
||||||
|
PRInt32 intValue = border_value.GetPixelValue();
|
||||||
|
if (intValue > 0)
|
||||||
|
intValue = 1;
|
||||||
|
border = nscoord(p2t*(float)intValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
nsStyleBorder& borderData = *(nsStyleBorder*)mStyleContext->GetData(kStyleBorderSID);
|
||||||
|
MapHTMLBorderStyle(borderData,border);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nsTableCellFrame::MapTextAttributes(nsIPresContext* aPresContext)
|
||||||
|
{
|
||||||
|
nsHTMLValue value;
|
||||||
|
|
||||||
|
((nsTableCell*)mContent)->GetAttribute(nsHTMLAtoms::align, value);
|
||||||
|
if (value.GetUnit() == eHTMLUnit_Enumerated)
|
||||||
|
{
|
||||||
|
nsStyleText* text = (nsStyleText*)mStyleContext->GetData(kStyleTextSID);
|
||||||
|
text->mTextAlign = value.GetIntValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Subclass hook for style post processing
|
||||||
|
NS_METHOD nsTableCellFrame::DidSetStyleContext(nsIPresContext* aPresContext)
|
||||||
|
{
|
||||||
|
#ifdef NOISY_STYLE
|
||||||
|
printf("nsTableCellFrame::DidSetStyleContext \n");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
MapTextAttributes(aPresContext);
|
||||||
|
MapBorderMarginPadding(aPresContext);
|
||||||
|
mStyleContext->RecalcAutomaticData();
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----- static methods ----- */
|
/* ----- static methods ----- */
|
||||||
|
|
||||||
nsresult nsTableCellFrame::NewFrame(nsIFrame** aInstancePtrResult,
|
nsresult nsTableCellFrame::NewFrame(nsIFrame** aInstancePtrResult,
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ public:
|
|||||||
|
|
||||||
virtual ~nsTableCellFrame();
|
virtual ~nsTableCellFrame();
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** protected constructor.
|
/** protected constructor.
|
||||||
@@ -85,6 +86,16 @@ protected:
|
|||||||
*/
|
*/
|
||||||
virtual void CreatePsuedoFrame(nsIPresContext* aPresContext);
|
virtual void CreatePsuedoFrame(nsIPresContext* aPresContext);
|
||||||
|
|
||||||
|
// Subclass hook for style post processing
|
||||||
|
NS_METHOD DidSetStyleContext(nsIPresContext* aPresContext);
|
||||||
|
void MapTextAttributes(nsIPresContext* aPresContext);
|
||||||
|
void MapBorderMarginPadding(nsIPresContext* aPresContext);
|
||||||
|
void MapHTMLBorderStyle(nsStyleBorder& aBorderStyle, nscoord aBorderWidth);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ static PRBool gsTiming = PR_FALSE;
|
|||||||
static PRBool gsDebugMBP = PR_FALSE;
|
static PRBool gsDebugMBP = PR_FALSE;
|
||||||
//#define NOISY
|
//#define NOISY
|
||||||
//#define NOISY_FLOW
|
//#define NOISY_FLOW
|
||||||
|
//#ifdef NOISY_STYLE
|
||||||
#else
|
#else
|
||||||
static const PRBool gsDebug = PR_FALSE;
|
static const PRBool gsDebug = PR_FALSE;
|
||||||
static const PRBool gsDebugCLD = PR_FALSE;
|
static const PRBool gsDebugCLD = PR_FALSE;
|
||||||
@@ -640,7 +641,7 @@ nsIFrame::ReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresCont
|
|||||||
kidDel = kid->GetDelegate(aPresContext);
|
kidDel = kid->GetDelegate(aPresContext);
|
||||||
kidFrame = kidDel->CreateFrame(aPresContext, kid, contentOffset, this);
|
kidFrame = kidDel->CreateFrame(aPresContext, kid, contentOffset, this);
|
||||||
NS_RELEASE(kidDel);
|
NS_RELEASE(kidDel);
|
||||||
kidFrame->SetStyleContext(kidStyleContext);
|
kidFrame->SetStyleContext(aPresContext,kidStyleContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSize maxKidElementSize;
|
nsSize maxKidElementSize;
|
||||||
@@ -1415,7 +1416,7 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
|
|||||||
kidDel = kid->GetDelegate(aPresContext);
|
kidDel = kid->GetDelegate(aPresContext);
|
||||||
kidFrame = kidDel->CreateFrame(aPresContext, kid, kidIndex, this);
|
kidFrame = kidDel->CreateFrame(aPresContext, kid, kidIndex, this);
|
||||||
NS_RELEASE(kidDel);
|
NS_RELEASE(kidDel);
|
||||||
kidFrame->SetStyleContext(kidStyleContext);
|
kidFrame->SetStyleContext(aPresContext, kidStyleContext);
|
||||||
} else {
|
} else {
|
||||||
kidPrevInFlow->CreateContinuingFrame(aPresContext, this, kidFrame);
|
kidPrevInFlow->CreateContinuingFrame(aPresContext, this, kidFrame);
|
||||||
}
|
}
|
||||||
@@ -2077,7 +2078,7 @@ NS_METHOD nsTableFrame::CreateContinuingFrame(nsIPresContext* aPresContext,
|
|||||||
kidDel = content->GetDelegate(aPresContext); // kidDel: REFCNT++
|
kidDel = content->GetDelegate(aPresContext); // kidDel: REFCNT++
|
||||||
nsIFrame * duplicateFrame = kidDel->CreateFrame(aPresContext, content, index, cf);
|
nsIFrame * duplicateFrame = kidDel->CreateFrame(aPresContext, content, index, cf);
|
||||||
NS_RELEASE(kidDel); // kidDel: REFCNT--
|
NS_RELEASE(kidDel); // kidDel: REFCNT--
|
||||||
duplicateFrame->SetStyleContext(kidStyleContext);
|
duplicateFrame->SetStyleContext(aPresContext,kidStyleContext);
|
||||||
NS_RELEASE(kidStyleContext); // kidStyleContenxt: REFCNT--
|
NS_RELEASE(kidStyleContext); // kidStyleContenxt: REFCNT--
|
||||||
|
|
||||||
if (nsnull==lastSib)
|
if (nsnull==lastSib)
|
||||||
@@ -2147,6 +2148,14 @@ void nsTableFrame::SetColumnWidth(PRInt32 aColIndex, PRInt32 aWidth)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Subclass hook for style post processing
|
||||||
|
NS_METHOD nsTableFrame::DidSetStyleContext(nsIPresContext* aPresContext)
|
||||||
|
{
|
||||||
|
#ifdef NOISY_STYLE
|
||||||
|
printf("nsTableFrame::DidSetStyleContext \n");
|
||||||
|
#endif
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* ---------- static methods ---------- */
|
/* ---------- static methods ---------- */
|
||||||
|
|
||||||
|
|||||||
@@ -297,6 +297,9 @@ protected:
|
|||||||
/** returns PR_TRUE if the cached pass 1 data is still valid */
|
/** returns PR_TRUE if the cached pass 1 data is still valid */
|
||||||
virtual PRBool IsFirstPassValid() const;
|
virtual PRBool IsFirstPassValid() const;
|
||||||
|
|
||||||
|
/** do post processing to setting up style information for the frame */
|
||||||
|
virtual NS_METHOD DidSetStyleContext(nsIPresContext* aPresContext);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void nsTableFrame::DebugPrintCount() const; // Debugging routine
|
void nsTableFrame::DebugPrintCount() const; // Debugging routine
|
||||||
|
|
||||||
|
|||||||
@@ -227,16 +227,17 @@ NS_METHOD nsTableOuterFrame::ResizeReflow(nsIPresContext* aPresContext,
|
|||||||
aStatus = mInnerTableFrame->ResizeReflowPass1(aPresContext, aDesiredSize, aMaxSize,
|
aStatus = mInnerTableFrame->ResizeReflowPass1(aPresContext, aDesiredSize, aMaxSize,
|
||||||
&innerTableMaxElementSize);
|
&innerTableMaxElementSize);
|
||||||
|
|
||||||
|
nsIContentPtr content;
|
||||||
|
mInnerTableFrame->GetContent(content.AssignRef());
|
||||||
|
nsTablePart *table = (nsTablePart*)(nsIContent*)content;
|
||||||
#ifdef NOISY_MARGINS
|
#ifdef NOISY_MARGINS
|
||||||
nsIContent* content = nsnull;
|
|
||||||
mInnerTableFrame->GetContent(content);
|
|
||||||
nsTablePart *table = (nsTablePart*)content;
|
|
||||||
if (table != nsnull)
|
if (table != nsnull)
|
||||||
table->DumpCellMap();
|
table->DumpCellMap();
|
||||||
|
#endif
|
||||||
mInnerTableFrame->RecalcLayoutData();
|
mInnerTableFrame->RecalcLayoutData();
|
||||||
|
#ifdef NOISY_MARGINS
|
||||||
mInnerTableFrame->ListColumnLayoutData(stdout,1);
|
mInnerTableFrame->ListColumnLayoutData(stdout,1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
mInnerTableFrame->SetReflowPass(nsTableFrame::kPASS_SECOND);
|
mInnerTableFrame->SetReflowPass(nsTableFrame::kPASS_SECOND);
|
||||||
// assign table width info only if the inner table frame is a first-in-flow
|
// assign table width info only if the inner table frame is a first-in-flow
|
||||||
@@ -945,7 +946,7 @@ void nsTableOuterFrame::CreateChildFrames(nsIPresContext* aPresContext)
|
|||||||
nsIStyleContextPtr kidStyleContext =
|
nsIStyleContextPtr kidStyleContext =
|
||||||
aPresContext->ResolveStyleContextFor(mContent, this);
|
aPresContext->ResolveStyleContextFor(mContent, this);
|
||||||
NS_ASSERTION(kidStyleContext.IsNotNull(), "bad style context for kid.");
|
NS_ASSERTION(kidStyleContext.IsNotNull(), "bad style context for kid.");
|
||||||
mInnerTableFrame->SetStyleContext(kidStyleContext);
|
mInnerTableFrame->SetStyleContext(aPresContext,kidStyleContext);
|
||||||
mChildCount++;
|
mChildCount++;
|
||||||
// Link child frame into the list of children
|
// Link child frame into the list of children
|
||||||
mFirstChild = mInnerTableFrame;
|
mFirstChild = mInnerTableFrame;
|
||||||
@@ -974,7 +975,7 @@ void nsTableOuterFrame::CreateChildFrames(nsIPresContext* aPresContext)
|
|||||||
NS_ASSERTION(captionStyleContext.IsNotNull(), "bad style context for caption.");
|
NS_ASSERTION(captionStyleContext.IsNotNull(), "bad style context for caption.");
|
||||||
nsStyleText* captionStyle =
|
nsStyleText* captionStyle =
|
||||||
(nsStyleText*)captionStyleContext->GetData(kStyleTextSID);
|
(nsStyleText*)captionStyleContext->GetData(kStyleTextSID);
|
||||||
captionFrame->SetStyleContext(captionStyleContext);
|
captionFrame->SetStyleContext(aPresContext,captionStyleContext);
|
||||||
mChildCount++;
|
mChildCount++;
|
||||||
// Link child frame into the list of children
|
// Link child frame into the list of children
|
||||||
if ((eStyleUnit_Enumerated == captionStyle->mVerticalAlign.GetUnit()) &&
|
if ((eStyleUnit_Enumerated == captionStyle->mVerticalAlign.GetUnit()) &&
|
||||||
@@ -1244,7 +1245,7 @@ void nsTableOuterFrame::PrepareContinuingFrame(nsIPresContext* aPresContext,
|
|||||||
// XXX presumptive
|
// XXX presumptive
|
||||||
nsIStyleContextPtr styleContext =
|
nsIStyleContextPtr styleContext =
|
||||||
aPresContext->ResolveStyleContextFor(mContent, aParent);
|
aPresContext->ResolveStyleContextFor(mContent, aParent);
|
||||||
aContFrame->SetStyleContext(styleContext);
|
aContFrame->SetStyleContext(aPresContext,styleContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_METHOD nsTableOuterFrame::VerifyTree() const
|
NS_METHOD nsTableOuterFrame::VerifyTree() const
|
||||||
@@ -1363,7 +1364,7 @@ void nsTableOuterFrame::CreateInnerTableFrame(nsIPresContext* aPresContext)
|
|||||||
// Resolve style and set the style context
|
// Resolve style and set the style context
|
||||||
nsIStyleContextPtr styleContext =
|
nsIStyleContextPtr styleContext =
|
||||||
aPresContext->ResolveStyleContextFor(mContent, this);
|
aPresContext->ResolveStyleContextFor(mContent, this);
|
||||||
mInnerTableFrame->SetStyleContext(styleContext);
|
mInnerTableFrame->SetStyleContext(aPresContext,styleContext);
|
||||||
} else {
|
} else {
|
||||||
nsTableOuterFrame* prevOuterTable = (nsTableOuterFrame*)mPrevInFlow;
|
nsTableOuterFrame* prevOuterTable = (nsTableOuterFrame*)mPrevInFlow;
|
||||||
|
|
||||||
|
|||||||
@@ -811,7 +811,7 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext,
|
|||||||
kidDel = cell->GetDelegate(aPresContext);
|
kidDel = cell->GetDelegate(aPresContext);
|
||||||
kidFrame = kidDel->CreateFrame(aPresContext, cell, kidIndex, this);
|
kidFrame = kidDel->CreateFrame(aPresContext, cell, kidIndex, this);
|
||||||
NS_RELEASE(kidDel);
|
NS_RELEASE(kidDel);
|
||||||
kidFrame->SetStyleContext(kidStyleContext);
|
kidFrame->SetStyleContext(aPresContext,kidStyleContext);
|
||||||
} else {
|
} else {
|
||||||
kidPrevInFlow->CreateContinuingFrame(aPresContext, this, kidFrame);
|
kidPrevInFlow->CreateContinuingFrame(aPresContext, this, kidFrame);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -743,7 +743,7 @@ nsTableRowGroupFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
|
|||||||
kidDel = kid->GetDelegate(aPresContext);
|
kidDel = kid->GetDelegate(aPresContext);
|
||||||
kidFrame = kidDel->CreateFrame(aPresContext, kid, kidIndex, this);
|
kidFrame = kidDel->CreateFrame(aPresContext, kid, kidIndex, this);
|
||||||
NS_RELEASE(kidDel);
|
NS_RELEASE(kidDel);
|
||||||
kidFrame->SetStyleContext(kidSC);
|
kidFrame->SetStyleContext(aPresContext,kidSC);
|
||||||
} else {
|
} else {
|
||||||
kidPrevInFlow->CreateContinuingFrame(aPresContext, this, kidFrame);
|
kidPrevInFlow->CreateContinuingFrame(aPresContext, this, kidFrame);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user