minor interface cleanup

This commit is contained in:
buster@netscape.com
1998-10-02 20:36:35 +00:00
parent 00fd82459f
commit 11cb76362f
8 changed files with 70 additions and 48 deletions

View File

@@ -417,9 +417,8 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
if (0!=pMaxElementSize->width)
aDesiredSize.maxElementSize->width += leftInset + rightInset;
}
// remember my desired size for this reflow
SetDesiredSize(aDesiredSize);
if (nsnull!=aDesiredSize.maxElementSize)
SetMaxElementSize(*(aDesiredSize.maxElementSize));
if (PR_TRUE==gsDebug || PR_TRUE==gsDebugNT)
printf(" %p cellFrame returning aDesiredSize=%d,%d\n",

View File

@@ -109,17 +109,6 @@ public:
/** set the desired size returned by this frame during its last reflow */
virtual void SetDesiredSize(const nsHTMLReflowMetrics & aDesiredSize);
/** return the MaxElement size returned by this frame during its last reflow
* not counting reflows where MaxElementSize is not requested.
* That is, the cell frame will always remember the last non-null MaxElementSize
*/
virtual nsSize GetMaxElementSize();
/** set the MaxElement size returned by this frame during its last reflow.
* should never be called with a null MaxElementSize
*/
virtual void SetMaxElementSize(const nsSize & aMaxElementSize);
/** return the desired size returned by this frame during its last reflow */
virtual nsSize GetPass1DesiredSize();
@@ -273,15 +262,6 @@ inline void nsTableCellFrame::SetDesiredSize(const nsHTMLReflowMetrics & aDesire
mDesiredSize.height = aDesiredSize.height;
}
inline nsSize nsTableCellFrame::GetMaxElementSize()
{ return mMaxElementSize; }
inline void nsTableCellFrame::SetMaxElementSize(const nsSize & aMaxElementSize)
{
mMaxElementSize.width = aMaxElementSize.width;
mMaxElementSize.height = aMaxElementSize.height;
}
inline nsSize nsTableCellFrame::GetPass1DesiredSize()
{ return mPass1DesiredSize; }

View File

@@ -2143,6 +2143,18 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
result = PR_FALSE;
break;
}
nsReflowState kidReflowState(kidFrame, aState.reflowState, aState.availSize,
eReflowReason_Resize);
kidFrame->WillReflow(*aPresContext);
status = ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState);
// Did the child fit?
if ((kidSize.height > aState.availSize.height) && (nsnull != mFirstChild)) {
// The child is too wide to fit in the available space, and it's
// not our first child
result = PR_FALSE;
break;
}
nsHTMLReflowState kidReflowState(kidFrame, aState.reflowState, aState.availSize,
eReflowReason_Resize);
nsIHTMLReflow* htmlReflow;
@@ -2395,16 +2407,24 @@ nsTableFrame::SetColumnStyleFromCell(nsIPresContext * aPresContext,
(eStyleUnit_Percent==cellPosition->mWidth.GetUnit())) {
// compute the width per column spanned
PRInt32 colSpan = GetEffectiveColSpan(aCellFrame->GetColIndex(), aCellFrame);
if (PR_TRUE==gsDebug)
printf("for col %d with colspan %d\n",aCellFrame->GetColIndex(), colSpan);
for (PRInt32 i=0; i<colSpan; i++)
{
// get the appropriate column frame
nsTableColFrame *colFrame;
GetColumnFrame(i+aCellFrame->GetColIndex(), colFrame);
if (PR_TRUE==gsDebug)
printf(" for col %d\n",i+aCellFrame->GetColIndex());
if (nsTableColFrame::eWIDTH_SOURCE_CELL != colFrame->GetWidthSource())
{
if (PR_TRUE==gsDebug)
printf(" width not yet set from a cell...\n");
if ((1==colSpan) ||
(nsTableColFrame::eWIDTH_SOURCE_CELL_WITH_SPAN != colFrame->GetWidthSource()))
{
if (PR_TRUE==gsDebug)
printf(" colspan was 1 or width was not set from a span\n");
// get the column style and set the width attribute
nsIStyleContext *colSC;
colFrame->GetStyleContext(aPresContext, colSC);
@@ -2415,17 +2435,29 @@ nsTableFrame::SetColumnStyleFromCell(nsIPresContext * aPresContext,
{
nscoord width = cellPosition->mWidth.GetCoordValue();
colPosition->mWidth.SetCoordValue(width/colSpan);
if (PR_TRUE==gsDebug)
printf(" col fixed width set to %d ", (width/colSpan));
}
else
{
float width = cellPosition->mWidth.GetPercentValue();
colPosition->mWidth.SetPercentValue(width/colSpan);
if (PR_TRUE==gsDebug)
printf(" col percent width set to %d ", (width/colSpan));
}
// set the column width-set-type
if (1==colSpan)
{
colFrame->SetWidthSource(nsTableColFrame::eWIDTH_SOURCE_CELL);
if (PR_TRUE==gsDebug)
printf(" source=cell\n");
}
else
{
colFrame->SetWidthSource(nsTableColFrame::eWIDTH_SOURCE_CELL_WITH_SPAN);
if (PR_TRUE==gsDebug)
printf(" source=cell_with_span\n");
}
}
}
}

View File

@@ -517,7 +517,7 @@ nsresult nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext,
desiredSize.width = priorSize.width;
desiredSize.height = priorSize.height;
if (nsnull != pKidMaxElementSize)
*pKidMaxElementSize = ((nsTableCellFrame *)kidFrame)->GetMaxElementSize();
*pKidMaxElementSize = ((nsTableCellFrame *)kidFrame)->GetPass1MaxElementSize();
}
// Place the child after taking into account its margin and attributes

View File

@@ -417,9 +417,8 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
if (0!=pMaxElementSize->width)
aDesiredSize.maxElementSize->width += leftInset + rightInset;
}
// remember my desired size for this reflow
SetDesiredSize(aDesiredSize);
if (nsnull!=aDesiredSize.maxElementSize)
SetMaxElementSize(*(aDesiredSize.maxElementSize));
if (PR_TRUE==gsDebug || PR_TRUE==gsDebugNT)
printf(" %p cellFrame returning aDesiredSize=%d,%d\n",

View File

@@ -109,17 +109,6 @@ public:
/** set the desired size returned by this frame during its last reflow */
virtual void SetDesiredSize(const nsHTMLReflowMetrics & aDesiredSize);
/** return the MaxElement size returned by this frame during its last reflow
* not counting reflows where MaxElementSize is not requested.
* That is, the cell frame will always remember the last non-null MaxElementSize
*/
virtual nsSize GetMaxElementSize();
/** set the MaxElement size returned by this frame during its last reflow.
* should never be called with a null MaxElementSize
*/
virtual void SetMaxElementSize(const nsSize & aMaxElementSize);
/** return the desired size returned by this frame during its last reflow */
virtual nsSize GetPass1DesiredSize();
@@ -273,15 +262,6 @@ inline void nsTableCellFrame::SetDesiredSize(const nsHTMLReflowMetrics & aDesire
mDesiredSize.height = aDesiredSize.height;
}
inline nsSize nsTableCellFrame::GetMaxElementSize()
{ return mMaxElementSize; }
inline void nsTableCellFrame::SetMaxElementSize(const nsSize & aMaxElementSize)
{
mMaxElementSize.width = aMaxElementSize.width;
mMaxElementSize.height = aMaxElementSize.height;
}
inline nsSize nsTableCellFrame::GetPass1DesiredSize()
{ return mPass1DesiredSize; }

View File

@@ -2143,6 +2143,18 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
result = PR_FALSE;
break;
}
nsReflowState kidReflowState(kidFrame, aState.reflowState, aState.availSize,
eReflowReason_Resize);
kidFrame->WillReflow(*aPresContext);
status = ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState);
// Did the child fit?
if ((kidSize.height > aState.availSize.height) && (nsnull != mFirstChild)) {
// The child is too wide to fit in the available space, and it's
// not our first child
result = PR_FALSE;
break;
}
nsHTMLReflowState kidReflowState(kidFrame, aState.reflowState, aState.availSize,
eReflowReason_Resize);
nsIHTMLReflow* htmlReflow;
@@ -2395,16 +2407,24 @@ nsTableFrame::SetColumnStyleFromCell(nsIPresContext * aPresContext,
(eStyleUnit_Percent==cellPosition->mWidth.GetUnit())) {
// compute the width per column spanned
PRInt32 colSpan = GetEffectiveColSpan(aCellFrame->GetColIndex(), aCellFrame);
if (PR_TRUE==gsDebug)
printf("for col %d with colspan %d\n",aCellFrame->GetColIndex(), colSpan);
for (PRInt32 i=0; i<colSpan; i++)
{
// get the appropriate column frame
nsTableColFrame *colFrame;
GetColumnFrame(i+aCellFrame->GetColIndex(), colFrame);
if (PR_TRUE==gsDebug)
printf(" for col %d\n",i+aCellFrame->GetColIndex());
if (nsTableColFrame::eWIDTH_SOURCE_CELL != colFrame->GetWidthSource())
{
if (PR_TRUE==gsDebug)
printf(" width not yet set from a cell...\n");
if ((1==colSpan) ||
(nsTableColFrame::eWIDTH_SOURCE_CELL_WITH_SPAN != colFrame->GetWidthSource()))
{
if (PR_TRUE==gsDebug)
printf(" colspan was 1 or width was not set from a span\n");
// get the column style and set the width attribute
nsIStyleContext *colSC;
colFrame->GetStyleContext(aPresContext, colSC);
@@ -2415,17 +2435,29 @@ nsTableFrame::SetColumnStyleFromCell(nsIPresContext * aPresContext,
{
nscoord width = cellPosition->mWidth.GetCoordValue();
colPosition->mWidth.SetCoordValue(width/colSpan);
if (PR_TRUE==gsDebug)
printf(" col fixed width set to %d ", (width/colSpan));
}
else
{
float width = cellPosition->mWidth.GetPercentValue();
colPosition->mWidth.SetPercentValue(width/colSpan);
if (PR_TRUE==gsDebug)
printf(" col percent width set to %d ", (width/colSpan));
}
// set the column width-set-type
if (1==colSpan)
{
colFrame->SetWidthSource(nsTableColFrame::eWIDTH_SOURCE_CELL);
if (PR_TRUE==gsDebug)
printf(" source=cell\n");
}
else
{
colFrame->SetWidthSource(nsTableColFrame::eWIDTH_SOURCE_CELL_WITH_SPAN);
if (PR_TRUE==gsDebug)
printf(" source=cell_with_span\n");
}
}
}
}

View File

@@ -517,7 +517,7 @@ nsresult nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext,
desiredSize.width = priorSize.width;
desiredSize.height = priorSize.height;
if (nsnull != pKidMaxElementSize)
*pKidMaxElementSize = ((nsTableCellFrame *)kidFrame)->GetMaxElementSize();
*pKidMaxElementSize = ((nsTableCellFrame *)kidFrame)->GetPass1MaxElementSize();
}
// Place the child after taking into account its margin and attributes