diff --git a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp
index 6e263133e4e..c585bbc8baf 100644
--- a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp
+++ b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp
@@ -35,11 +35,9 @@ NS_DEF_PTR(nsIStyleContext);
#ifdef NS_DEBUG
static PRBool gsDebug = PR_FALSE;
static PRBool gsDebugCLD = PR_FALSE;
-static PRBool gsTiming = PR_FALSE;
#else
static const PRBool gsDebug = PR_FALSE;
static const PRBool gsDebugCLD = PR_FALSE;
-static const PRBool gsTiming = PR_FALSE;
#endif
/* ---------- ProportionalColumnLayoutStruct ---------- */
@@ -216,10 +214,10 @@ if there is space left over
// Step 1 - assign the width of all fixed-width columns,
// and calculate min/max table width
PRBool BasicTableLayoutStrategy::AssignFixedColumnWidths(nsIPresContext* aPresContext,
- PRInt32 maxWidth,
- PRInt32 &aTotalFixedWidth,
- PRInt32 &aMinTableWidth,
- PRInt32 &aMaxTableWidth)
+ nscoord aMaxWidth,
+ nscoord &aTotalFixedWidth,
+ nscoord &aMinTableWidth,
+ nscoord &aMaxTableWidth)
{
#ifdef DEBUG
nsIFrame *tablePIF=nsnull;
@@ -351,10 +349,13 @@ PRBool BasicTableLayoutStrategy::AssignFixedColumnWidths(nsIPresContext* aPresCo
nscoord cellMinWidth = cellMinSize->width/colSpan;
nscoord cellDesiredWidth = cellDesiredSize->width/colSpan;
- if (NS_UNCONSTRAINEDSIZE!=cellMinWidth)
- cellMinWidth += margin.left + margin.right;
- if (NS_UNCONSTRAINEDSIZE!=cellDesiredWidth)
- cellDesiredWidth += margin.left + margin.right;
+ if (aMaxWidth!=cellDesiredSize->width)
+ {
+ if (NS_UNCONSTRAINEDSIZE!=cellMinWidth)
+ cellMinWidth += margin.left + margin.right;
+ if (NS_UNCONSTRAINEDSIZE!=cellDesiredWidth)
+ cellDesiredWidth += margin.left + margin.right;
+ }
if (minColWidth < cellMinWidth)
minColWidth = cellMinWidth;
@@ -739,7 +740,7 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(nsIPresContext* aPresCo
maxColWidth = cellDesiredWidth;
// effectiveColumnWidth is the width as if no cells with colspans existed
if ((1==colSpan) && (effectiveColumnWidths[colIndex] < maxColWidth))
- effectiveColumnWidths[colIndex] = cellDesiredWidth;
+ effectiveColumnWidths[colIndex] = maxColWidth;
if (gsDebug==PR_TRUE)
printf (" after cell %d, minColWidth=%d maxColWidth=%d effColWidth[%d]=%d\n",
cellIndex, minColWidth, maxColWidth,
@@ -956,7 +957,7 @@ void BasicTableLayoutStrategy::DistributeExcessSpace(nscoord aTableFixedWidth,
{
// there's at least one auto-width column, so give it (them) the extra space
// proportionately distributed extra space, based on the column's desired size
- nscoord totalWidthOfAutoColumns = 0;
+ nscoord totalEffectiveWidthOfAutoColumns = 0;
if (gsDebug==PR_TRUE)
printf(" aTableFixedWidth specified as %d, expanding columns by excess = %d\n", aTableFixedWidth, excess);
// 1. first, get the total width of the auto columns
@@ -964,24 +965,20 @@ void BasicTableLayoutStrategy::DistributeExcessSpace(nscoord aTableFixedWidth,
for (i = 0; iGetColumnWidth(autoColumns[i]);
+ totalEffectiveWidthOfAutoColumns += mTableFrame->GetColumnWidth(autoColumns[i]);
}
// 2. next, compute the proportion to be added to each column, and add it
for (i = 0; iGetColumnWidth(autoColumns[i]);
+ nscoord oldColWidth = mTableFrame->GetColumnWidth(autoColumns[i]);
float percent;
- if (0!=totalWidthOfAutoColumns)
- percent = (float)oldColWidth/(float)totalWidthOfAutoColumns;
+ if (0!=totalEffectiveWidthOfAutoColumns)
+ percent = ((float)(aColWidths[autoColumns[i]]))/((float)totalEffectiveWidthOfAutoColumns);
else
- percent = (float)1/(float)numAutoColumns;
+ percent = ((float)1)/((float)numAutoColumns);
nscoord excessForThisColumn = (nscoord)(excess*percent);
nscoord colWidth = excessForThisColumn+oldColWidth;
if (gsDebug==PR_TRUE)
diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.cpp b/mozilla/layout/html/table/src/nsTableCellFrame.cpp
index f46b8e7cab2..72ffeafca3e 100644
--- a/mozilla/layout/html/table/src/nsTableCellFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableCellFrame.cpp
@@ -59,6 +59,7 @@ nsTableCellFrame::nsTableCellFrame(nsIContent* aContent,
mRowSpan=1;
mColSpan=1;
mColIndex=0;
+ mPriorAvailWidth=0;
}
nsTableCellFrame::~nsTableCellFrame()
@@ -284,6 +285,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
availSize.width, availSize.height);
nsReflowMetrics kidSize(pMaxElementSize);
kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0;
+ SetPriorAvailWidth(aReflowState.maxSize.width);
nsReflowState kidReflowState(mFirstChild, aReflowState, availSize);
mFirstChild->WillReflow(*aPresContext);
mFirstChild->MoveTo(leftInset, topInset);
@@ -322,7 +324,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
// first, compute the height
// the height can be set w/o being restricted by aMaxSize.height
nscoord cellHeight = kidSize.height;
- if (NS_UNCONSTRAINEDSIZE!=cellHeight)
+ if (NS_UNCONSTRAINEDSIZE!=aReflowState.maxSize.height)
{
cellHeight += topInset + bottomInset;
}
@@ -331,8 +333,13 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
this, cellHeight, kidSize.height, topInset, bottomInset);
// next determine the cell's width
nscoord cellWidth = kidSize.width; // at this point, we've factored in the cell's style attributes
- if (NS_UNCONSTRAINEDSIZE!=cellWidth)
+ // if we're really in a constrained situation, factor in insets
+ if (NS_UNCONSTRAINEDSIZE!=aReflowState.maxSize.width)
+ {
+ NS_ASSERTION(NS_UNCONSTRAINEDSIZE!=cellWidth, "child says it has unconstrained width in a constrained case");
cellWidth += leftInset + rightInset;
+ }
+
// Nav4 hack for 0 width cells. If the cell has any content, it must have a desired width of at least 1
/*
if (0==cellWidth)
@@ -363,9 +370,9 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
if (nsnull!=aDesiredSize.maxElementSize)
{
*aDesiredSize.maxElementSize = *pMaxElementSize;
- if (NS_UNCONSTRAINEDSIZE != aDesiredSize.maxElementSize->height)
+ if (NS_UNCONSTRAINEDSIZE!=aReflowState.maxSize.height)
aDesiredSize.maxElementSize->height += topInset + bottomInset;
- if (NS_UNCONSTRAINEDSIZE != aDesiredSize.maxElementSize->width)
+ if (NS_UNCONSTRAINEDSIZE!=aReflowState.maxSize.width)
aDesiredSize.maxElementSize->width += leftInset + rightInset;
}
diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.h b/mozilla/layout/html/table/src/nsTableCellFrame.h
index 7576367f8dc..1d86f6be1c6 100644
--- a/mozilla/layout/html/table/src/nsTableCellFrame.h
+++ b/mozilla/layout/html/table/src/nsTableCellFrame.h
@@ -80,6 +80,10 @@ public:
virtual void SetColIndex (int aColIndex);
+ virtual nscoord GetPriorAvailWidth();
+
+ virtual void SetPriorAvailWidth(nscoord aPriorAvailWidth);
+
virtual ~nsTableCellFrame();
// Get the TableFrame that contains this cell frame
@@ -121,6 +125,9 @@ protected:
/** the starting column for this cell */
int mColIndex;
+ /** the available width we were given in our previous reflow */
+ nscoord mPriorAvailWidth;
+
nsCellLayoutData *mCellLayoutData;
};
@@ -156,4 +163,10 @@ inline nsCellLayoutData * nsTableCellFrame::GetCellLayoutData()
inline void nsTableCellFrame::SetCellLayoutData(nsCellLayoutData *aData)
{ mCellLayoutData = aData;}
+inline nscoord nsTableCellFrame::GetPriorAvailWidth()
+{ return mPriorAvailWidth;}
+
+inline void nsTableCellFrame::SetPriorAvailWidth(nscoord aPriorAvailWidth)
+{ mPriorAvailWidth = aPriorAvailWidth;}
+
#endif
diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp
index 5367bb69648..b7c15a64651 100644
--- a/mozilla/layout/html/table/src/nsTableFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableFrame.cpp
@@ -38,7 +38,6 @@
#include "nsStyleConsts.h"
#include "nsCellLayoutData.h"
#include "nsVoidArray.h"
-#include "prinrval.h"
#include "nsIPtr.h"
#include "nsIView.h"
#include "nsHTMLAtoms.h"
@@ -48,7 +47,6 @@
#ifdef NS_DEBUG
static PRBool gsDebug = PR_FALSE;
static PRBool gsDebugCLD = PR_FALSE;
-static PRBool gsTiming = PR_FALSE;
static PRBool gsDebugNT = PR_FALSE;
//#define NOISY
//#define NOISY_FLOW
@@ -56,7 +54,6 @@ static PRBool gsDebugNT = PR_FALSE;
#else
static const PRBool gsDebug = PR_FALSE;
static const PRBool gsDebugCLD = PR_FALSE;
-static const PRBool gsTiming = PR_FALSE;
static const PRBool gsDebugNT = PR_FALSE;
#endif
@@ -1085,11 +1082,6 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
aStatus = NS_FRAME_COMPLETE;
- PRIntervalTime startTime;
- if (gsTiming) {
- startTime = PR_IntervalNow();
- }
-
if (eReflowReason_Incremental == aReflowState.reason) {
nsIFrame* target;
aReflowState.reflowCommand->GetTarget(target);
@@ -1142,12 +1134,6 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
reflowState.maxSize.width = mRect.width;
aStatus = ResizeReflowPass2(aPresContext, aDesiredSize, reflowState, 0, 0);
- if (gsTiming) {
- PRIntervalTime endTime = PR_IntervalNow();
- printf("Table reflow took %ld ticks for frame %d\n",
- endTime-startTime, this);/* XXX need to use LL_* macros! */
- }
-
mPass = kPASS_UNDEFINED;
}
else
@@ -2921,40 +2907,6 @@ nsresult nsTableFrame::NewFrame(nsIFrame** aInstancePtrResult,
/* helper method for getting the width of the table's containing block */
nscoord nsTableFrame::GetTableContainerWidth(const nsReflowState& aReflowState)
{
-//STEVES_WAY is out of synch, because it doesn't handle nested table case.
-#ifdef STEVES_WAY // from BasicTableLayoutStrategy::TableIsAutoWidth()
- // get the parent's width (available only from parent frames that claim they can provide it)
- // note that we start with our parent's parent (the outer table frame's parent)
- nscoord parentWidth = 0;
- NS_ASSERTION(nsnull!=aReflowState.parentReflowState, "bad outer table reflow state.");
- NS_ASSERTION(nsnull!=aReflowState.parentReflowState->parentReflowState, "bad table parent reflow state.");
- if ((nsnull!=aReflowState.parentReflowState) &&
- (nsnull!=aReflowState.parentReflowState->parentReflowState))
- {
- const nsReflowState *parentReflowState = aReflowState.parentReflowState->parentReflowState;
- nsIFrame *parentFrame=parentReflowState->frame;
- NS_ASSERTION(nsnull!=parentFrame, "bad parent frame in reflow state struct.");
- while(nsnull!=parentFrame)
- {
- PRBool isPercentageBase=PR_FALSE;
- parentFrame->IsPercentageBase(isPercentageBase);
- if (PR_TRUE==isPercentageBase)
- { // found the ancestor who claims to be the container to base my percentage width on
- parentWidth = parentReflowState->maxSize.width;
- if (PR_TRUE==gsDebug) printf(" ** width for parent frame %p = %d\n", parentFrame, parentWidth);
- break;
- }
- parentReflowState = parentReflowState->parentReflowState; // get next ancestor
- if (nsnull!=parentReflowState)
- parentFrame = parentReflowState->frame;
- else
- parentFrame = nsnull; // terminates loop.
- // TODO: do we need a backstop in case there are no IsPercentageBase==true frames?
- }
- }
-
-#else
-
nscoord parentWidth = aReflowState.maxSize.width;
// Walk up the reflow state chain until we find a block
@@ -3008,7 +2960,9 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsReflowState& aReflowState)
const nsStyleSpacing* spacing;
nsIFrame* cell = nsnull;
rs->frame->QueryInterface(kTableCellFrameCID, (void**) &cell);
- if (nsnull != cell) {
+ // if the cell has a specified width, use it
+ if (nsnull != cell)
+ {
// Compute and subtract out the insets (sum of border and padding) for the table
cell->GetStyleData(eStyleStruct_Position, ((nsStyleStruct *&)tablePosition));
if (eStyleUnit_Coord == tablePosition->mWidth.GetUnit())
@@ -3116,7 +3070,6 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsReflowState& aReflowState)
rs = rs->parentReflowState;
}
-#endif
return parentWidth;
}
diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp
index 95de24f9ebd..b0da43844df 100644
--- a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp
@@ -32,14 +32,17 @@
#include "nsVoidArray.h"
#include "nsIReflowCommand.h"
#include "nsIPtr.h"
+#include "prinrval.h"
#ifdef NS_DEBUG
static PRBool gsDebug = PR_FALSE;
+static PRBool gsTiming = PR_FALSE;
//#define NOISY
//#define NOISY_FLOW
#define NOISY_MARGINS
#else
static const PRBool gsDebug = PR_FALSE;
+static const PRBool gsTiming = PR_FALSE;
#endif
static NS_DEFINE_IID(kITableContentIID, NS_ITABLECONTENT_IID);
@@ -334,6 +337,11 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
printf("%p: nsTableOuterFrame::Reflow : maxSize=%d,%d\n",
this, aReflowState.maxSize.width, aReflowState.maxSize.height);
+ PRIntervalTime startTime;
+ if (gsTiming) {
+ startTime = PR_IntervalNow();
+ }
+
#ifdef NS_DEBUG
// replace with a check that does not assume linear placement of children
// PreReflowCheck();
@@ -380,14 +388,13 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
aStatus = NS_FRAME_COMPLETE;
return NS_OK;
}
-
+
// lay out inner table, if required
+ nsReflowState innerTableReflowState(mInnerTableFrame, aReflowState, aReflowState.maxSize);
if (PR_FALSE==mInnerTableFrame->IsFirstPassValid())
{
// we treat the table as if we've never seen the layout data before
-
mInnerTableFrame->SetReflowPass(nsTableFrame::kPASS_FIRST);
- nsReflowState innerTableReflowState(mInnerTableFrame, aReflowState, aReflowState.maxSize);
aStatus = mInnerTableFrame->ResizeReflowPass1(aPresContext, aDesiredSize,
innerTableReflowState, aStatus);
}
@@ -399,8 +406,8 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
if (nsnull==prevInFlow)
{
// assign column widths, and assign aMaxElementSize->width
- mInnerTableFrame->BalanceColumnWidths(aPresContext, aReflowState,
- aReflowState.maxSize,
+ mInnerTableFrame->BalanceColumnWidths(aPresContext, innerTableReflowState,
+ innerTableReflowState.maxSize,
aDesiredSize.maxElementSize);
// assign table width
mInnerTableFrame->SetTableWidth(aPresContext);
@@ -415,7 +422,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
// Reflow the child frames
PRBool reflowMappedOK = PR_TRUE;
if (nsnull != mFirstChild) {
- reflowMappedOK = ReflowMappedChildren(aPresContext, state, aDesiredSize.maxElementSize);
+ reflowMappedOK = ReflowMappedChildren(aPresContext, state, nsnull);
if (PR_FALSE == reflowMappedOK) {
aStatus = NS_FRAME_NOT_COMPLETE;
}
@@ -492,6 +499,13 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
// PostReflowCheck(status);
#endif
+ if (gsTiming) {
+ PRIntervalTime endTime = PR_IntervalNow();
+ printf("Table reflow took %ld ticks for frame %d\n",
+ endTime-startTime, this);/* XXX need to use LL_* macros! */
+ }
+
+
return NS_OK;
}
diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.cpp b/mozilla/layout/html/table/src/nsTableRowFrame.cpp
index 2855efee51d..1a1192f96aa 100644
--- a/mozilla/layout/html/table/src/nsTableRowFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableRowFrame.cpp
@@ -256,7 +256,7 @@ void nsTableRowFrame::PlaceChild(nsIPresContext* aPresContext,
nsIFrame* aKidFrame,
const nsRect& aKidRect,
nsSize* aMaxElementSize,
- nsSize& aKidMaxElementSize)
+ nsSize* aKidMaxElementSize)
{
if (PR_TRUE==gsDebug1)
printf ("row: placing cell at %d, %d, %d, %d\n",
@@ -272,10 +272,10 @@ void nsTableRowFrame::PlaceChild(nsIPresContext* aPresContext,
PRInt32 rowSpan = ((nsTableCellFrame*)aKidFrame)->GetRowSpan();
if (nsnull != aMaxElementSize)
{
- aMaxElementSize->width += aKidMaxElementSize.width;
- if ((mMinRowSpan==rowSpan) && (aKidMaxElementSize.height>aMaxElementSize->height))
+ aMaxElementSize->width += aKidMaxElementSize->width;
+ if ((mMinRowSpan==rowSpan) && (aKidMaxElementSize->height>aMaxElementSize->height))
{
- aMaxElementSize->height = aKidMaxElementSize.height;
+ aMaxElementSize->height = aKidMaxElementSize->height;
}
}
@@ -394,26 +394,35 @@ PRBool nsTableRowFrame::ReflowMappedChildren(nsIPresContext* aPresContext,
for (PRInt32 numColSpan=0; numColSpanGetColumnWidth(cellStartingCol+numColSpan);
kidAvailSize.width = availWidth;
-
- // Reflow the child
- kidFrame->WillReflow(*aPresContext);
- kidFrame->MoveTo(x, kidMargin.top);
-
- nsReflowState kidReflowState(kidFrame, aState.reflowState, kidAvailSize,
- eReflowReason_Resize);
- status = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
-
- if (gsDebug1)
+ if (availWidth != ((nsTableCellFrame *)kidFrame)->GetPriorAvailWidth())
{
- if (nsnull!=pKidMaxElementSize)
- printf("reflow of cell returned result = %s with desired=%d,%d, min = %d,%d\n",
- NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete",
- desiredSize.width, desiredSize.height,
- pKidMaxElementSize->width, pKidMaxElementSize->height);
- else
- printf("reflow of cell returned result = %s with desired=%d,%d, min = nsnull\n",
- NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete",
- desiredSize.width, desiredSize.height);
+ // Reflow the child
+ kidFrame->WillReflow(*aPresContext);
+ kidFrame->MoveTo(x, kidMargin.top);
+ nsReflowState kidReflowState(kidFrame, aState.reflowState, kidAvailSize,
+ eReflowReason_Resize);
+ status = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
+
+ if (gsDebug1)
+ {
+ if (nsnull!=pKidMaxElementSize)
+ printf("reflow of cell returned result = %s with desired=%d,%d, min = %d,%d\n",
+ NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete",
+ desiredSize.width, desiredSize.height,
+ pKidMaxElementSize->width, pKidMaxElementSize->height);
+ else
+ printf("reflow of cell returned result = %s with desired=%d,%d, min = nsnull\n",
+ NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete",
+ desiredSize.width, desiredSize.height);
+ }
+ }
+ else
+ {
+ nsRect cellRect;
+ kidFrame->GetRect(cellRect);
+ desiredSize.width = cellRect.width;
+ desiredSize.height = cellRect.height;
+ status = NS_FRAME_COMPLETE; // XXX: in paginated world, this doesn't work!
}
// Did the child fit?
@@ -472,7 +481,7 @@ PRBool nsTableRowFrame::ReflowMappedChildren(nsIPresContext* aPresContext,
nsRect kidRect (x, kidMargin.top, cellWidth, cellHeight);
PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize,
- kidMaxElementSize);
+ pKidMaxElementSize);
childCount++;
// Remember where we just were in case we end up pushing children
@@ -720,7 +729,7 @@ PRBool nsTableRowFrame::PullUpChildren(nsIPresContext* aPresContext,
aState.x += aState.tableFrame->GetColumnWidth(colIndex);
// Place the child
nsRect kidRect (aState.x, 0, desiredSize.width, desiredSize.height);
- PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, *pKidMaxElementSize);
+ PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, pKidMaxElementSize);
// Remove the frame from its current parent
kidFrame->GetNextSibling(nextInFlow->mFirstChild);
@@ -974,20 +983,17 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext,
status = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
nsCellLayoutData *kidLayoutData = new nsCellLayoutData((nsTableCellFrame *)kidFrame, &desiredSize, pKidMaxElementSize);
((nsTableCellFrame *)kidFrame)->SetCellLayoutData(kidLayoutData);
- if (nsnull!=pKidMaxElementSize)
+ if (gsDebug1)
{
- if (gsDebug1)
- {
- if (nsnull!=pKidMaxElementSize)
- printf("reflow of cell returned result = %s with desired=%d,%d, min = %d,%d\n",
- NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete",
- desiredSize.width, desiredSize.height,
- pKidMaxElementSize->width, pKidMaxElementSize->height);
- else
- printf("reflow of cell returned result = %s with desired=%d,%d, min = nsnull\n",
- NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete",
- desiredSize.width, desiredSize.height);
- }
+ if (nsnull!=pKidMaxElementSize)
+ printf("reflow of cell returned result = %s with desired=%d,%d, min = %d,%d\n",
+ NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete",
+ desiredSize.width, desiredSize.height,
+ pKidMaxElementSize->width, pKidMaxElementSize->height);
+ else
+ printf("reflow of cell returned result = %s with desired=%d,%d, min = nsnull\n",
+ NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete",
+ desiredSize.width, desiredSize.height);
}
NS_RELEASE(cell); // cell: REFCNT--
@@ -1006,7 +1012,7 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext,
// Place the child
nsRect kidRect (x, topMargin, desiredSize.width, desiredSize.height);
- PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, *pKidMaxElementSize);
+ PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, pKidMaxElementSize);
prevKidFrame = kidFrame;
kidIndex++;
@@ -1211,7 +1217,7 @@ nsresult nsTableRowFrame::IncrementalReflow(nsIPresContext* aPresContext,
nsRect kidRect (x, kidMargin.top, cellWidth, cellHeight);
PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize,
- kidMaxElementSize);
+ &kidMaxElementSize);
// Now iterate over the remaining cells, and update our max cell
// height and our running x-offset
@@ -1284,7 +1290,6 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext,
if (eReflowReason_Incremental == aReflowState.reason) {
aStatus = IncrementalReflow(aPresContext, state, aReflowState,
aDesiredSize.maxElementSize);
-
} else {
// Initialize out parameter
if (nsnull != aDesiredSize.maxElementSize) {
diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.h b/mozilla/layout/html/table/src/nsTableRowFrame.h
index f7e39253db0..366240eadae 100644
--- a/mozilla/layout/html/table/src/nsTableRowFrame.h
+++ b/mozilla/layout/html/table/src/nsTableRowFrame.h
@@ -148,7 +148,7 @@ protected:
nsIFrame* aKidFrame,
const nsRect& aKidRect,
nsSize* aMaxElementSize,
- nsSize& aKidMaxElementSize);
+ nsSize* aKidMaxElementSize);
nsresult IncrementalReflow(nsIPresContext* aPresContext,
RowReflowState& aState,
diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp
index 6e263133e4e..c585bbc8baf 100644
--- a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp
+++ b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp
@@ -35,11 +35,9 @@ NS_DEF_PTR(nsIStyleContext);
#ifdef NS_DEBUG
static PRBool gsDebug = PR_FALSE;
static PRBool gsDebugCLD = PR_FALSE;
-static PRBool gsTiming = PR_FALSE;
#else
static const PRBool gsDebug = PR_FALSE;
static const PRBool gsDebugCLD = PR_FALSE;
-static const PRBool gsTiming = PR_FALSE;
#endif
/* ---------- ProportionalColumnLayoutStruct ---------- */
@@ -216,10 +214,10 @@ if there is space left over
// Step 1 - assign the width of all fixed-width columns,
// and calculate min/max table width
PRBool BasicTableLayoutStrategy::AssignFixedColumnWidths(nsIPresContext* aPresContext,
- PRInt32 maxWidth,
- PRInt32 &aTotalFixedWidth,
- PRInt32 &aMinTableWidth,
- PRInt32 &aMaxTableWidth)
+ nscoord aMaxWidth,
+ nscoord &aTotalFixedWidth,
+ nscoord &aMinTableWidth,
+ nscoord &aMaxTableWidth)
{
#ifdef DEBUG
nsIFrame *tablePIF=nsnull;
@@ -351,10 +349,13 @@ PRBool BasicTableLayoutStrategy::AssignFixedColumnWidths(nsIPresContext* aPresCo
nscoord cellMinWidth = cellMinSize->width/colSpan;
nscoord cellDesiredWidth = cellDesiredSize->width/colSpan;
- if (NS_UNCONSTRAINEDSIZE!=cellMinWidth)
- cellMinWidth += margin.left + margin.right;
- if (NS_UNCONSTRAINEDSIZE!=cellDesiredWidth)
- cellDesiredWidth += margin.left + margin.right;
+ if (aMaxWidth!=cellDesiredSize->width)
+ {
+ if (NS_UNCONSTRAINEDSIZE!=cellMinWidth)
+ cellMinWidth += margin.left + margin.right;
+ if (NS_UNCONSTRAINEDSIZE!=cellDesiredWidth)
+ cellDesiredWidth += margin.left + margin.right;
+ }
if (minColWidth < cellMinWidth)
minColWidth = cellMinWidth;
@@ -739,7 +740,7 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(nsIPresContext* aPresCo
maxColWidth = cellDesiredWidth;
// effectiveColumnWidth is the width as if no cells with colspans existed
if ((1==colSpan) && (effectiveColumnWidths[colIndex] < maxColWidth))
- effectiveColumnWidths[colIndex] = cellDesiredWidth;
+ effectiveColumnWidths[colIndex] = maxColWidth;
if (gsDebug==PR_TRUE)
printf (" after cell %d, minColWidth=%d maxColWidth=%d effColWidth[%d]=%d\n",
cellIndex, minColWidth, maxColWidth,
@@ -956,7 +957,7 @@ void BasicTableLayoutStrategy::DistributeExcessSpace(nscoord aTableFixedWidth,
{
// there's at least one auto-width column, so give it (them) the extra space
// proportionately distributed extra space, based on the column's desired size
- nscoord totalWidthOfAutoColumns = 0;
+ nscoord totalEffectiveWidthOfAutoColumns = 0;
if (gsDebug==PR_TRUE)
printf(" aTableFixedWidth specified as %d, expanding columns by excess = %d\n", aTableFixedWidth, excess);
// 1. first, get the total width of the auto columns
@@ -964,24 +965,20 @@ void BasicTableLayoutStrategy::DistributeExcessSpace(nscoord aTableFixedWidth,
for (i = 0; iGetColumnWidth(autoColumns[i]);
+ totalEffectiveWidthOfAutoColumns += mTableFrame->GetColumnWidth(autoColumns[i]);
}
// 2. next, compute the proportion to be added to each column, and add it
for (i = 0; iGetColumnWidth(autoColumns[i]);
+ nscoord oldColWidth = mTableFrame->GetColumnWidth(autoColumns[i]);
float percent;
- if (0!=totalWidthOfAutoColumns)
- percent = (float)oldColWidth/(float)totalWidthOfAutoColumns;
+ if (0!=totalEffectiveWidthOfAutoColumns)
+ percent = ((float)(aColWidths[autoColumns[i]]))/((float)totalEffectiveWidthOfAutoColumns);
else
- percent = (float)1/(float)numAutoColumns;
+ percent = ((float)1)/((float)numAutoColumns);
nscoord excessForThisColumn = (nscoord)(excess*percent);
nscoord colWidth = excessForThisColumn+oldColWidth;
if (gsDebug==PR_TRUE)
diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp
index f46b8e7cab2..72ffeafca3e 100644
--- a/mozilla/layout/tables/nsTableCellFrame.cpp
+++ b/mozilla/layout/tables/nsTableCellFrame.cpp
@@ -59,6 +59,7 @@ nsTableCellFrame::nsTableCellFrame(nsIContent* aContent,
mRowSpan=1;
mColSpan=1;
mColIndex=0;
+ mPriorAvailWidth=0;
}
nsTableCellFrame::~nsTableCellFrame()
@@ -284,6 +285,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
availSize.width, availSize.height);
nsReflowMetrics kidSize(pMaxElementSize);
kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0;
+ SetPriorAvailWidth(aReflowState.maxSize.width);
nsReflowState kidReflowState(mFirstChild, aReflowState, availSize);
mFirstChild->WillReflow(*aPresContext);
mFirstChild->MoveTo(leftInset, topInset);
@@ -322,7 +324,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
// first, compute the height
// the height can be set w/o being restricted by aMaxSize.height
nscoord cellHeight = kidSize.height;
- if (NS_UNCONSTRAINEDSIZE!=cellHeight)
+ if (NS_UNCONSTRAINEDSIZE!=aReflowState.maxSize.height)
{
cellHeight += topInset + bottomInset;
}
@@ -331,8 +333,13 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
this, cellHeight, kidSize.height, topInset, bottomInset);
// next determine the cell's width
nscoord cellWidth = kidSize.width; // at this point, we've factored in the cell's style attributes
- if (NS_UNCONSTRAINEDSIZE!=cellWidth)
+ // if we're really in a constrained situation, factor in insets
+ if (NS_UNCONSTRAINEDSIZE!=aReflowState.maxSize.width)
+ {
+ NS_ASSERTION(NS_UNCONSTRAINEDSIZE!=cellWidth, "child says it has unconstrained width in a constrained case");
cellWidth += leftInset + rightInset;
+ }
+
// Nav4 hack for 0 width cells. If the cell has any content, it must have a desired width of at least 1
/*
if (0==cellWidth)
@@ -363,9 +370,9 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
if (nsnull!=aDesiredSize.maxElementSize)
{
*aDesiredSize.maxElementSize = *pMaxElementSize;
- if (NS_UNCONSTRAINEDSIZE != aDesiredSize.maxElementSize->height)
+ if (NS_UNCONSTRAINEDSIZE!=aReflowState.maxSize.height)
aDesiredSize.maxElementSize->height += topInset + bottomInset;
- if (NS_UNCONSTRAINEDSIZE != aDesiredSize.maxElementSize->width)
+ if (NS_UNCONSTRAINEDSIZE!=aReflowState.maxSize.width)
aDesiredSize.maxElementSize->width += leftInset + rightInset;
}
diff --git a/mozilla/layout/tables/nsTableCellFrame.h b/mozilla/layout/tables/nsTableCellFrame.h
index 7576367f8dc..1d86f6be1c6 100644
--- a/mozilla/layout/tables/nsTableCellFrame.h
+++ b/mozilla/layout/tables/nsTableCellFrame.h
@@ -80,6 +80,10 @@ public:
virtual void SetColIndex (int aColIndex);
+ virtual nscoord GetPriorAvailWidth();
+
+ virtual void SetPriorAvailWidth(nscoord aPriorAvailWidth);
+
virtual ~nsTableCellFrame();
// Get the TableFrame that contains this cell frame
@@ -121,6 +125,9 @@ protected:
/** the starting column for this cell */
int mColIndex;
+ /** the available width we were given in our previous reflow */
+ nscoord mPriorAvailWidth;
+
nsCellLayoutData *mCellLayoutData;
};
@@ -156,4 +163,10 @@ inline nsCellLayoutData * nsTableCellFrame::GetCellLayoutData()
inline void nsTableCellFrame::SetCellLayoutData(nsCellLayoutData *aData)
{ mCellLayoutData = aData;}
+inline nscoord nsTableCellFrame::GetPriorAvailWidth()
+{ return mPriorAvailWidth;}
+
+inline void nsTableCellFrame::SetPriorAvailWidth(nscoord aPriorAvailWidth)
+{ mPriorAvailWidth = aPriorAvailWidth;}
+
#endif
diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp
index 5367bb69648..b7c15a64651 100644
--- a/mozilla/layout/tables/nsTableFrame.cpp
+++ b/mozilla/layout/tables/nsTableFrame.cpp
@@ -38,7 +38,6 @@
#include "nsStyleConsts.h"
#include "nsCellLayoutData.h"
#include "nsVoidArray.h"
-#include "prinrval.h"
#include "nsIPtr.h"
#include "nsIView.h"
#include "nsHTMLAtoms.h"
@@ -48,7 +47,6 @@
#ifdef NS_DEBUG
static PRBool gsDebug = PR_FALSE;
static PRBool gsDebugCLD = PR_FALSE;
-static PRBool gsTiming = PR_FALSE;
static PRBool gsDebugNT = PR_FALSE;
//#define NOISY
//#define NOISY_FLOW
@@ -56,7 +54,6 @@ static PRBool gsDebugNT = PR_FALSE;
#else
static const PRBool gsDebug = PR_FALSE;
static const PRBool gsDebugCLD = PR_FALSE;
-static const PRBool gsTiming = PR_FALSE;
static const PRBool gsDebugNT = PR_FALSE;
#endif
@@ -1085,11 +1082,6 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
aStatus = NS_FRAME_COMPLETE;
- PRIntervalTime startTime;
- if (gsTiming) {
- startTime = PR_IntervalNow();
- }
-
if (eReflowReason_Incremental == aReflowState.reason) {
nsIFrame* target;
aReflowState.reflowCommand->GetTarget(target);
@@ -1142,12 +1134,6 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
reflowState.maxSize.width = mRect.width;
aStatus = ResizeReflowPass2(aPresContext, aDesiredSize, reflowState, 0, 0);
- if (gsTiming) {
- PRIntervalTime endTime = PR_IntervalNow();
- printf("Table reflow took %ld ticks for frame %d\n",
- endTime-startTime, this);/* XXX need to use LL_* macros! */
- }
-
mPass = kPASS_UNDEFINED;
}
else
@@ -2921,40 +2907,6 @@ nsresult nsTableFrame::NewFrame(nsIFrame** aInstancePtrResult,
/* helper method for getting the width of the table's containing block */
nscoord nsTableFrame::GetTableContainerWidth(const nsReflowState& aReflowState)
{
-//STEVES_WAY is out of synch, because it doesn't handle nested table case.
-#ifdef STEVES_WAY // from BasicTableLayoutStrategy::TableIsAutoWidth()
- // get the parent's width (available only from parent frames that claim they can provide it)
- // note that we start with our parent's parent (the outer table frame's parent)
- nscoord parentWidth = 0;
- NS_ASSERTION(nsnull!=aReflowState.parentReflowState, "bad outer table reflow state.");
- NS_ASSERTION(nsnull!=aReflowState.parentReflowState->parentReflowState, "bad table parent reflow state.");
- if ((nsnull!=aReflowState.parentReflowState) &&
- (nsnull!=aReflowState.parentReflowState->parentReflowState))
- {
- const nsReflowState *parentReflowState = aReflowState.parentReflowState->parentReflowState;
- nsIFrame *parentFrame=parentReflowState->frame;
- NS_ASSERTION(nsnull!=parentFrame, "bad parent frame in reflow state struct.");
- while(nsnull!=parentFrame)
- {
- PRBool isPercentageBase=PR_FALSE;
- parentFrame->IsPercentageBase(isPercentageBase);
- if (PR_TRUE==isPercentageBase)
- { // found the ancestor who claims to be the container to base my percentage width on
- parentWidth = parentReflowState->maxSize.width;
- if (PR_TRUE==gsDebug) printf(" ** width for parent frame %p = %d\n", parentFrame, parentWidth);
- break;
- }
- parentReflowState = parentReflowState->parentReflowState; // get next ancestor
- if (nsnull!=parentReflowState)
- parentFrame = parentReflowState->frame;
- else
- parentFrame = nsnull; // terminates loop.
- // TODO: do we need a backstop in case there are no IsPercentageBase==true frames?
- }
- }
-
-#else
-
nscoord parentWidth = aReflowState.maxSize.width;
// Walk up the reflow state chain until we find a block
@@ -3008,7 +2960,9 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsReflowState& aReflowState)
const nsStyleSpacing* spacing;
nsIFrame* cell = nsnull;
rs->frame->QueryInterface(kTableCellFrameCID, (void**) &cell);
- if (nsnull != cell) {
+ // if the cell has a specified width, use it
+ if (nsnull != cell)
+ {
// Compute and subtract out the insets (sum of border and padding) for the table
cell->GetStyleData(eStyleStruct_Position, ((nsStyleStruct *&)tablePosition));
if (eStyleUnit_Coord == tablePosition->mWidth.GetUnit())
@@ -3116,7 +3070,6 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsReflowState& aReflowState)
rs = rs->parentReflowState;
}
-#endif
return parentWidth;
}
diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp
index 95de24f9ebd..b0da43844df 100644
--- a/mozilla/layout/tables/nsTableOuterFrame.cpp
+++ b/mozilla/layout/tables/nsTableOuterFrame.cpp
@@ -32,14 +32,17 @@
#include "nsVoidArray.h"
#include "nsIReflowCommand.h"
#include "nsIPtr.h"
+#include "prinrval.h"
#ifdef NS_DEBUG
static PRBool gsDebug = PR_FALSE;
+static PRBool gsTiming = PR_FALSE;
//#define NOISY
//#define NOISY_FLOW
#define NOISY_MARGINS
#else
static const PRBool gsDebug = PR_FALSE;
+static const PRBool gsTiming = PR_FALSE;
#endif
static NS_DEFINE_IID(kITableContentIID, NS_ITABLECONTENT_IID);
@@ -334,6 +337,11 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
printf("%p: nsTableOuterFrame::Reflow : maxSize=%d,%d\n",
this, aReflowState.maxSize.width, aReflowState.maxSize.height);
+ PRIntervalTime startTime;
+ if (gsTiming) {
+ startTime = PR_IntervalNow();
+ }
+
#ifdef NS_DEBUG
// replace with a check that does not assume linear placement of children
// PreReflowCheck();
@@ -380,14 +388,13 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
aStatus = NS_FRAME_COMPLETE;
return NS_OK;
}
-
+
// lay out inner table, if required
+ nsReflowState innerTableReflowState(mInnerTableFrame, aReflowState, aReflowState.maxSize);
if (PR_FALSE==mInnerTableFrame->IsFirstPassValid())
{
// we treat the table as if we've never seen the layout data before
-
mInnerTableFrame->SetReflowPass(nsTableFrame::kPASS_FIRST);
- nsReflowState innerTableReflowState(mInnerTableFrame, aReflowState, aReflowState.maxSize);
aStatus = mInnerTableFrame->ResizeReflowPass1(aPresContext, aDesiredSize,
innerTableReflowState, aStatus);
}
@@ -399,8 +406,8 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
if (nsnull==prevInFlow)
{
// assign column widths, and assign aMaxElementSize->width
- mInnerTableFrame->BalanceColumnWidths(aPresContext, aReflowState,
- aReflowState.maxSize,
+ mInnerTableFrame->BalanceColumnWidths(aPresContext, innerTableReflowState,
+ innerTableReflowState.maxSize,
aDesiredSize.maxElementSize);
// assign table width
mInnerTableFrame->SetTableWidth(aPresContext);
@@ -415,7 +422,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
// Reflow the child frames
PRBool reflowMappedOK = PR_TRUE;
if (nsnull != mFirstChild) {
- reflowMappedOK = ReflowMappedChildren(aPresContext, state, aDesiredSize.maxElementSize);
+ reflowMappedOK = ReflowMappedChildren(aPresContext, state, nsnull);
if (PR_FALSE == reflowMappedOK) {
aStatus = NS_FRAME_NOT_COMPLETE;
}
@@ -492,6 +499,13 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
// PostReflowCheck(status);
#endif
+ if (gsTiming) {
+ PRIntervalTime endTime = PR_IntervalNow();
+ printf("Table reflow took %ld ticks for frame %d\n",
+ endTime-startTime, this);/* XXX need to use LL_* macros! */
+ }
+
+
return NS_OK;
}
diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp
index 2855efee51d..1a1192f96aa 100644
--- a/mozilla/layout/tables/nsTableRowFrame.cpp
+++ b/mozilla/layout/tables/nsTableRowFrame.cpp
@@ -256,7 +256,7 @@ void nsTableRowFrame::PlaceChild(nsIPresContext* aPresContext,
nsIFrame* aKidFrame,
const nsRect& aKidRect,
nsSize* aMaxElementSize,
- nsSize& aKidMaxElementSize)
+ nsSize* aKidMaxElementSize)
{
if (PR_TRUE==gsDebug1)
printf ("row: placing cell at %d, %d, %d, %d\n",
@@ -272,10 +272,10 @@ void nsTableRowFrame::PlaceChild(nsIPresContext* aPresContext,
PRInt32 rowSpan = ((nsTableCellFrame*)aKidFrame)->GetRowSpan();
if (nsnull != aMaxElementSize)
{
- aMaxElementSize->width += aKidMaxElementSize.width;
- if ((mMinRowSpan==rowSpan) && (aKidMaxElementSize.height>aMaxElementSize->height))
+ aMaxElementSize->width += aKidMaxElementSize->width;
+ if ((mMinRowSpan==rowSpan) && (aKidMaxElementSize->height>aMaxElementSize->height))
{
- aMaxElementSize->height = aKidMaxElementSize.height;
+ aMaxElementSize->height = aKidMaxElementSize->height;
}
}
@@ -394,26 +394,35 @@ PRBool nsTableRowFrame::ReflowMappedChildren(nsIPresContext* aPresContext,
for (PRInt32 numColSpan=0; numColSpanGetColumnWidth(cellStartingCol+numColSpan);
kidAvailSize.width = availWidth;
-
- // Reflow the child
- kidFrame->WillReflow(*aPresContext);
- kidFrame->MoveTo(x, kidMargin.top);
-
- nsReflowState kidReflowState(kidFrame, aState.reflowState, kidAvailSize,
- eReflowReason_Resize);
- status = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
-
- if (gsDebug1)
+ if (availWidth != ((nsTableCellFrame *)kidFrame)->GetPriorAvailWidth())
{
- if (nsnull!=pKidMaxElementSize)
- printf("reflow of cell returned result = %s with desired=%d,%d, min = %d,%d\n",
- NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete",
- desiredSize.width, desiredSize.height,
- pKidMaxElementSize->width, pKidMaxElementSize->height);
- else
- printf("reflow of cell returned result = %s with desired=%d,%d, min = nsnull\n",
- NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete",
- desiredSize.width, desiredSize.height);
+ // Reflow the child
+ kidFrame->WillReflow(*aPresContext);
+ kidFrame->MoveTo(x, kidMargin.top);
+ nsReflowState kidReflowState(kidFrame, aState.reflowState, kidAvailSize,
+ eReflowReason_Resize);
+ status = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
+
+ if (gsDebug1)
+ {
+ if (nsnull!=pKidMaxElementSize)
+ printf("reflow of cell returned result = %s with desired=%d,%d, min = %d,%d\n",
+ NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete",
+ desiredSize.width, desiredSize.height,
+ pKidMaxElementSize->width, pKidMaxElementSize->height);
+ else
+ printf("reflow of cell returned result = %s with desired=%d,%d, min = nsnull\n",
+ NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete",
+ desiredSize.width, desiredSize.height);
+ }
+ }
+ else
+ {
+ nsRect cellRect;
+ kidFrame->GetRect(cellRect);
+ desiredSize.width = cellRect.width;
+ desiredSize.height = cellRect.height;
+ status = NS_FRAME_COMPLETE; // XXX: in paginated world, this doesn't work!
}
// Did the child fit?
@@ -472,7 +481,7 @@ PRBool nsTableRowFrame::ReflowMappedChildren(nsIPresContext* aPresContext,
nsRect kidRect (x, kidMargin.top, cellWidth, cellHeight);
PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize,
- kidMaxElementSize);
+ pKidMaxElementSize);
childCount++;
// Remember where we just were in case we end up pushing children
@@ -720,7 +729,7 @@ PRBool nsTableRowFrame::PullUpChildren(nsIPresContext* aPresContext,
aState.x += aState.tableFrame->GetColumnWidth(colIndex);
// Place the child
nsRect kidRect (aState.x, 0, desiredSize.width, desiredSize.height);
- PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, *pKidMaxElementSize);
+ PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, pKidMaxElementSize);
// Remove the frame from its current parent
kidFrame->GetNextSibling(nextInFlow->mFirstChild);
@@ -974,20 +983,17 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext,
status = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
nsCellLayoutData *kidLayoutData = new nsCellLayoutData((nsTableCellFrame *)kidFrame, &desiredSize, pKidMaxElementSize);
((nsTableCellFrame *)kidFrame)->SetCellLayoutData(kidLayoutData);
- if (nsnull!=pKidMaxElementSize)
+ if (gsDebug1)
{
- if (gsDebug1)
- {
- if (nsnull!=pKidMaxElementSize)
- printf("reflow of cell returned result = %s with desired=%d,%d, min = %d,%d\n",
- NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete",
- desiredSize.width, desiredSize.height,
- pKidMaxElementSize->width, pKidMaxElementSize->height);
- else
- printf("reflow of cell returned result = %s with desired=%d,%d, min = nsnull\n",
- NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete",
- desiredSize.width, desiredSize.height);
- }
+ if (nsnull!=pKidMaxElementSize)
+ printf("reflow of cell returned result = %s with desired=%d,%d, min = %d,%d\n",
+ NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete",
+ desiredSize.width, desiredSize.height,
+ pKidMaxElementSize->width, pKidMaxElementSize->height);
+ else
+ printf("reflow of cell returned result = %s with desired=%d,%d, min = nsnull\n",
+ NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete",
+ desiredSize.width, desiredSize.height);
}
NS_RELEASE(cell); // cell: REFCNT--
@@ -1006,7 +1012,7 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext,
// Place the child
nsRect kidRect (x, topMargin, desiredSize.width, desiredSize.height);
- PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, *pKidMaxElementSize);
+ PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, pKidMaxElementSize);
prevKidFrame = kidFrame;
kidIndex++;
@@ -1211,7 +1217,7 @@ nsresult nsTableRowFrame::IncrementalReflow(nsIPresContext* aPresContext,
nsRect kidRect (x, kidMargin.top, cellWidth, cellHeight);
PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize,
- kidMaxElementSize);
+ &kidMaxElementSize);
// Now iterate over the remaining cells, and update our max cell
// height and our running x-offset
@@ -1284,7 +1290,6 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext,
if (eReflowReason_Incremental == aReflowState.reason) {
aStatus = IncrementalReflow(aPresContext, state, aReflowState,
aDesiredSize.maxElementSize);
-
} else {
// Initialize out parameter
if (nsnull != aDesiredSize.maxElementSize) {
diff --git a/mozilla/layout/tables/nsTableRowFrame.h b/mozilla/layout/tables/nsTableRowFrame.h
index f7e39253db0..366240eadae 100644
--- a/mozilla/layout/tables/nsTableRowFrame.h
+++ b/mozilla/layout/tables/nsTableRowFrame.h
@@ -148,7 +148,7 @@ protected:
nsIFrame* aKidFrame,
const nsRect& aKidRect,
nsSize* aMaxElementSize,
- nsSize& aKidMaxElementSize);
+ nsSize* aKidMaxElementSize);
nsresult IncrementalReflow(nsIPresContext* aPresContext,
RowReflowState& aState,