diff --git a/content/base/src/nsStyleContext.cpp b/content/base/src/nsStyleContext.cpp index f994d8d8b1f3..86ce15070d31 100644 --- a/content/base/src/nsStyleContext.cpp +++ b/content/base/src/nsStyleContext.cpp @@ -465,7 +465,7 @@ void StyleContextImpl::HackStyleFor(nsIPresContext* aPresContext, mMolecule.borderStyle[0] = mMolecule.borderStyle[1] = mMolecule.borderStyle[2] = mMolecule.borderStyle[3] = NS_STYLE_BORDER_STYLE_SOLID; mMolecule.fixedWidth = -1; - mMolecule.proportionalWidth = 100; + mMolecule.proportionalWidth = -1; nsString align("ALIGN"); nsString value; if (eContentAttr_HasValue == aContent->GetAttribute(align, value)) { @@ -478,15 +478,15 @@ void StyleContextImpl::HackStyleFor(nsIPresContext* aPresContext, } else if (buf.EqualsIgnoreCase("CAPTION")) { // CAPTION mMolecule.verticalAlign = NS_STYLE_VERTICAL_ALIGN_TOP; } else if (buf.EqualsIgnoreCase("TBODY")) { // TBODY - mMolecule.padding.top = NS_POINTS_TO_TWIPS_INT(1); - mMolecule.padding.bottom = NS_POINTS_TO_TWIPS_INT(1); - mMolecule.padding.right = NS_POINTS_TO_TWIPS_INT(1); - mMolecule.padding.left = NS_POINTS_TO_TWIPS_INT(1); + mMolecule.padding.top = NS_POINTS_TO_TWIPS_INT(0); + mMolecule.padding.bottom = NS_POINTS_TO_TWIPS_INT(0); + mMolecule.padding.right = NS_POINTS_TO_TWIPS_INT(0); + mMolecule.padding.left = NS_POINTS_TO_TWIPS_INT(0); } else if (buf.EqualsIgnoreCase("TR")) { // TROW - mMolecule.padding.top = NS_POINTS_TO_TWIPS_INT(1); - mMolecule.padding.bottom = NS_POINTS_TO_TWIPS_INT(1); - mMolecule.padding.right = NS_POINTS_TO_TWIPS_INT(1); - mMolecule.padding.left = NS_POINTS_TO_TWIPS_INT(1); + mMolecule.padding.top = NS_POINTS_TO_TWIPS_INT(0); + mMolecule.padding.bottom = NS_POINTS_TO_TWIPS_INT(0); + mMolecule.padding.right = NS_POINTS_TO_TWIPS_INT(0); + mMolecule.padding.left = NS_POINTS_TO_TWIPS_INT(0); } else if (buf.EqualsIgnoreCase("TD")) { // TD float p2t = aPresContext->GetPixelsToTwips(); diff --git a/layout/base/src/nsStyleContext.cpp b/layout/base/src/nsStyleContext.cpp index f994d8d8b1f3..86ce15070d31 100644 --- a/layout/base/src/nsStyleContext.cpp +++ b/layout/base/src/nsStyleContext.cpp @@ -465,7 +465,7 @@ void StyleContextImpl::HackStyleFor(nsIPresContext* aPresContext, mMolecule.borderStyle[0] = mMolecule.borderStyle[1] = mMolecule.borderStyle[2] = mMolecule.borderStyle[3] = NS_STYLE_BORDER_STYLE_SOLID; mMolecule.fixedWidth = -1; - mMolecule.proportionalWidth = 100; + mMolecule.proportionalWidth = -1; nsString align("ALIGN"); nsString value; if (eContentAttr_HasValue == aContent->GetAttribute(align, value)) { @@ -478,15 +478,15 @@ void StyleContextImpl::HackStyleFor(nsIPresContext* aPresContext, } else if (buf.EqualsIgnoreCase("CAPTION")) { // CAPTION mMolecule.verticalAlign = NS_STYLE_VERTICAL_ALIGN_TOP; } else if (buf.EqualsIgnoreCase("TBODY")) { // TBODY - mMolecule.padding.top = NS_POINTS_TO_TWIPS_INT(1); - mMolecule.padding.bottom = NS_POINTS_TO_TWIPS_INT(1); - mMolecule.padding.right = NS_POINTS_TO_TWIPS_INT(1); - mMolecule.padding.left = NS_POINTS_TO_TWIPS_INT(1); + mMolecule.padding.top = NS_POINTS_TO_TWIPS_INT(0); + mMolecule.padding.bottom = NS_POINTS_TO_TWIPS_INT(0); + mMolecule.padding.right = NS_POINTS_TO_TWIPS_INT(0); + mMolecule.padding.left = NS_POINTS_TO_TWIPS_INT(0); } else if (buf.EqualsIgnoreCase("TR")) { // TROW - mMolecule.padding.top = NS_POINTS_TO_TWIPS_INT(1); - mMolecule.padding.bottom = NS_POINTS_TO_TWIPS_INT(1); - mMolecule.padding.right = NS_POINTS_TO_TWIPS_INT(1); - mMolecule.padding.left = NS_POINTS_TO_TWIPS_INT(1); + mMolecule.padding.top = NS_POINTS_TO_TWIPS_INT(0); + mMolecule.padding.bottom = NS_POINTS_TO_TWIPS_INT(0); + mMolecule.padding.right = NS_POINTS_TO_TWIPS_INT(0); + mMolecule.padding.left = NS_POINTS_TO_TWIPS_INT(0); } else if (buf.EqualsIgnoreCase("TD")) { // TD float p2t = aPresContext->GetPixelsToTwips(); diff --git a/layout/html/table/src/nsTableCellFrame.cpp b/layout/html/table/src/nsTableCellFrame.cpp index 213e08a502c1..2c0f26544011 100644 --- a/layout/html/table/src/nsTableCellFrame.cpp +++ b/layout/html/table/src/nsTableCellFrame.cpp @@ -217,7 +217,6 @@ NS_METHOD nsTableCellFrame::ResizeReflow(nsIPresContext* aPresContext, availSize.width -= leftInset+rightInset; if (NS_UNCONSTRAINEDSIZE!=availSize.height) availSize.height -= topInset+bottomInset; - //was: availSize.SizeBy(-(leftInset+rightInset), -(topInset+bottomInset)); mLastContentIsComplete = PR_TRUE; @@ -279,7 +278,11 @@ NS_METHOD nsTableCellFrame::ResizeReflow(nsIPresContext* aPresContext, aDesiredSize.descent = bottomInset; if (nsnull!=aMaxElementSize) + { *aMaxElementSize = *pMaxElementSize; + aMaxElementSize->height += topInset + bottomInset; + aMaxElementSize->width += leftInset + rightInset; + } if (gsDebug==PR_TRUE) printf(" nsTableCellFrame::ResizeReflow returning aDesiredSize=%d,%d\n", diff --git a/layout/html/table/src/nsTableFrame.cpp b/layout/html/table/src/nsTableFrame.cpp index 5e2bf28ceade..535d859da019 100644 --- a/layout/html/table/src/nsTableFrame.cpp +++ b/layout/html/table/src/nsTableFrame.cpp @@ -589,9 +589,13 @@ nsIFrame::ReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresCont // SEC: TODO: when content is appended or deleted, be sure to clear out the frame hierarchy!!!! - nsIFrame* kidFrame; + // get next frame, creating one if needed + nsIFrame* kidFrame=nsnull; + if (nsnull!=prevKidFrame) + prevKidFrame->GetNextSibling(kidFrame); // no need to check for an error, just see if it returned null... + else + ChildAt(0, kidFrame); - ChildAt(kidIndex, kidFrame); // if this is the first time, allocate the caption frame if (nsnull==kidFrame) { @@ -828,6 +832,9 @@ void nsTableFrame::PlaceChild(nsIPresContext* aPresContext, nsSize* aMaxElementSize, nsSize& aKidMaxElementSize) { + if (PR_TRUE==gsDebug) + printf ("table: placing row group at %d, %d, %d, %d\n", + aKidRect.x, aKidRect.y, aKidRect.width, aKidRect.height); // Place and size the child aKidFrame->SetRect(aKidRect); @@ -1660,7 +1667,7 @@ PRBool nsTableFrame::BalanceProportionalColumnsForSpecifiedWidthTable(nsIPresCon if (gsDebug) printf (" * min table does not fit, calling SetColumnsToMinWidth\n"); result = SetColumnsToMinWidth(aPresContext); } - else if (aMaxTableWidth < aMaxWidth) + else if (aMaxTableWidth <= aMaxWidth) { // the max width of the table fits comfortably in the available space if (gsDebug) printf (" * table desired size fits, calling BalanceColumnsTableFits\n"); result = BalanceColumnsTableFits(aPresContext, aTableStyleMol, aAvailWidth); @@ -1693,7 +1700,7 @@ PRBool nsTableFrame::BalanceProportionalColumnsForAutoWidthTable( nsIPresContext if (gsDebug) printf (" * min table does not fit, calling SetColumnsToMinWidth\n"); result = SetColumnsToMinWidth(aPresContext); } - else if (aMaxTableWidth < aMaxWidth) + else if (aMaxTableWidth <= aMaxWidth) { // the max width of the table fits comfortably in the available space if (gsDebug) printf (" * table desired size fits, calling BalanceColumnsTableFits\n"); result = BalanceColumnsTableFits(aPresContext, aTableStyleMol, aAvailWidth); diff --git a/layout/html/table/src/nsTableOuterFrame.cpp b/layout/html/table/src/nsTableOuterFrame.cpp index 001bf4b9d7f8..385d46b6e1e4 100644 --- a/layout/html/table/src/nsTableOuterFrame.cpp +++ b/layout/html/table/src/nsTableOuterFrame.cpp @@ -366,7 +366,8 @@ void nsTableOuterFrame::PlaceChild( OuterTableReflowState& aState, nsSize* aMaxElementSize, nsSize& aKidMaxElementSize) { - if (PR_TRUE==gsDebug) printf ("place child: %p with aKidRect %d %d %d %d\n", + if (PR_TRUE==gsDebug) + printf ("outer table place child: %p with aKidRect %d %d %d %d\n", aKidFrame, aKidRect.x, aKidRect.y, aKidRect.width, aKidRect.height); // Place and size the child diff --git a/layout/html/table/src/nsTableRowFrame.cpp b/layout/html/table/src/nsTableRowFrame.cpp index e493d706124b..3dfc1a640d1c 100644 --- a/layout/html/table/src/nsTableRowFrame.cpp +++ b/layout/html/table/src/nsTableRowFrame.cpp @@ -146,6 +146,7 @@ nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext, PreReflowCheck(); #endif + //nsresult result = NS_OK; PRInt32 maxCellHeight = 0; ResetMaxChildHeight(); @@ -153,8 +154,6 @@ nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext, mFirstContentOffset = mLastContentOffset = 0; - nsIContent* c = mContent; - nsSize availSize(aMaxSize); nsSize maxSize(0, 0); nsSize kidMaxSize(0,0); @@ -164,7 +163,7 @@ nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext, nscoord maxAscent = 0; nscoord maxDescent = 0; PRInt32 kidIndex = 0; - PRInt32 lastIndex = c->ChildCount(); + PRInt32 lastIndex = mContent->ChildCount(); nsIFrame* prevKidFrame = nsnull;/* XXX incremental reflow! */ // Row doesn't factor in insets, the cells do that @@ -174,34 +173,33 @@ nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext, mContentParent->GetContentParent((nsIFrame*&)tableFrame); for (;;) { - nsIContent* kid = c->ChildAt(kidIndex); // kid: REFCNT++ - if (nsnull == kid) { + nsTableCell* cell = (nsTableCell *)(mContent->ChildAt(kidIndex)); // cell: REFCNT++ + if (nsnull == cell) { aStatus = frComplete; break; } - // get frame, creating one if needed - nsIFrame* kidFrame; - - ChildAt(kidIndex, kidFrame); + // get next frame, creating one if needed + nsIFrame* kidFrame=nsnull; + if (nsnull!=prevKidFrame) + prevKidFrame->GetNextSibling(kidFrame); // no need to check for an error, just see if it returned null... + else + ChildAt(0, kidFrame); if (nsnull==kidFrame) { nsIContentDelegate* kidDel; - kidDel = kid->GetDelegate(aPresContext); - kidFrame = kidDel->CreateFrame(aPresContext, kid, kidIndex, this); + kidDel = cell->GetDelegate(aPresContext); + kidFrame = kidDel->CreateFrame(aPresContext, cell, kidIndex, this); mChildCount++; NS_RELEASE(kidDel); // Resolve style nsIStyleContext* kidStyleContext = - aPresContext->ResolveStyleContextFor(kid, this); + aPresContext->ResolveStyleContextFor(cell, this); NS_ASSERTION(nsnull!=kidStyleContext, "bad style context for kid."); kidFrame->SetStyleContext(kidStyleContext); NS_RELEASE(kidStyleContext); } - nsTableCell* cell; - - kidFrame->GetContent((nsIContent*&)cell); // cell: ADDREF++ // Try to reflow the child into the available space. if (NS_UNCONSTRAINEDSIZE == availSize.width) { // Each cell is given the entire row width to try to lay out into @@ -239,10 +237,12 @@ nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext, PRInt32 rowSpan = cell->GetRowSpan(); if ((1==rowSpan) && (maxCellHeightSetRect(nsRect(cellXOffset, 0, kidSize.width, kidSize.height)); if (kidSize.width > maxSize.width) { maxSize.width = kidSize.width; @@ -286,7 +286,7 @@ nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext, mLastContentIsComplete = PR_FALSE; break; } - NS_RELEASE(kid); // kid: REFCNT-- + NS_RELEASE(cell); // kid: REFCNT-- } if (nsnull != prevKidFrame) { diff --git a/layout/html/table/src/nsTableRowGroupFrame.cpp b/layout/html/table/src/nsTableRowGroupFrame.cpp index 58a4db802d18..3bfe3881cea4 100644 --- a/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -184,6 +184,10 @@ void nsTableRowGroupFrame::PlaceChild( nsIPresContext* aPresContext, nsSize* aMaxElementSize, nsSize& aKidMaxElementSize) { + if (PR_TRUE==gsDebug1) + printf ("rowgroup: placing row at %d, %d, %d, %d\n", + aKidRect.x, aKidRect.y, aKidRect.width, aKidRect.height); + // Place and size the child aKidFrame->SetRect(aKidRect); @@ -715,7 +719,7 @@ nsTableRowGroupFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, nscoord topMargin = GetTopMarginFor(aPresContext, aState, kidMol); nscoord bottomMargin = kidMol->margin.bottom; - nsIFrame* kidFrame; + nsIFrame* kidFrame; // Create a child frame if (nsnull == kidPrevInFlow) { diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp index f994d8d8b1f3..86ce15070d31 100644 --- a/layout/style/nsStyleContext.cpp +++ b/layout/style/nsStyleContext.cpp @@ -465,7 +465,7 @@ void StyleContextImpl::HackStyleFor(nsIPresContext* aPresContext, mMolecule.borderStyle[0] = mMolecule.borderStyle[1] = mMolecule.borderStyle[2] = mMolecule.borderStyle[3] = NS_STYLE_BORDER_STYLE_SOLID; mMolecule.fixedWidth = -1; - mMolecule.proportionalWidth = 100; + mMolecule.proportionalWidth = -1; nsString align("ALIGN"); nsString value; if (eContentAttr_HasValue == aContent->GetAttribute(align, value)) { @@ -478,15 +478,15 @@ void StyleContextImpl::HackStyleFor(nsIPresContext* aPresContext, } else if (buf.EqualsIgnoreCase("CAPTION")) { // CAPTION mMolecule.verticalAlign = NS_STYLE_VERTICAL_ALIGN_TOP; } else if (buf.EqualsIgnoreCase("TBODY")) { // TBODY - mMolecule.padding.top = NS_POINTS_TO_TWIPS_INT(1); - mMolecule.padding.bottom = NS_POINTS_TO_TWIPS_INT(1); - mMolecule.padding.right = NS_POINTS_TO_TWIPS_INT(1); - mMolecule.padding.left = NS_POINTS_TO_TWIPS_INT(1); + mMolecule.padding.top = NS_POINTS_TO_TWIPS_INT(0); + mMolecule.padding.bottom = NS_POINTS_TO_TWIPS_INT(0); + mMolecule.padding.right = NS_POINTS_TO_TWIPS_INT(0); + mMolecule.padding.left = NS_POINTS_TO_TWIPS_INT(0); } else if (buf.EqualsIgnoreCase("TR")) { // TROW - mMolecule.padding.top = NS_POINTS_TO_TWIPS_INT(1); - mMolecule.padding.bottom = NS_POINTS_TO_TWIPS_INT(1); - mMolecule.padding.right = NS_POINTS_TO_TWIPS_INT(1); - mMolecule.padding.left = NS_POINTS_TO_TWIPS_INT(1); + mMolecule.padding.top = NS_POINTS_TO_TWIPS_INT(0); + mMolecule.padding.bottom = NS_POINTS_TO_TWIPS_INT(0); + mMolecule.padding.right = NS_POINTS_TO_TWIPS_INT(0); + mMolecule.padding.left = NS_POINTS_TO_TWIPS_INT(0); } else if (buf.EqualsIgnoreCase("TD")) { // TD float p2t = aPresContext->GetPixelsToTwips(); diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index 213e08a502c1..2c0f26544011 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -217,7 +217,6 @@ NS_METHOD nsTableCellFrame::ResizeReflow(nsIPresContext* aPresContext, availSize.width -= leftInset+rightInset; if (NS_UNCONSTRAINEDSIZE!=availSize.height) availSize.height -= topInset+bottomInset; - //was: availSize.SizeBy(-(leftInset+rightInset), -(topInset+bottomInset)); mLastContentIsComplete = PR_TRUE; @@ -279,7 +278,11 @@ NS_METHOD nsTableCellFrame::ResizeReflow(nsIPresContext* aPresContext, aDesiredSize.descent = bottomInset; if (nsnull!=aMaxElementSize) + { *aMaxElementSize = *pMaxElementSize; + aMaxElementSize->height += topInset + bottomInset; + aMaxElementSize->width += leftInset + rightInset; + } if (gsDebug==PR_TRUE) printf(" nsTableCellFrame::ResizeReflow returning aDesiredSize=%d,%d\n", diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 5e2bf28ceade..535d859da019 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -589,9 +589,13 @@ nsIFrame::ReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresCont // SEC: TODO: when content is appended or deleted, be sure to clear out the frame hierarchy!!!! - nsIFrame* kidFrame; + // get next frame, creating one if needed + nsIFrame* kidFrame=nsnull; + if (nsnull!=prevKidFrame) + prevKidFrame->GetNextSibling(kidFrame); // no need to check for an error, just see if it returned null... + else + ChildAt(0, kidFrame); - ChildAt(kidIndex, kidFrame); // if this is the first time, allocate the caption frame if (nsnull==kidFrame) { @@ -828,6 +832,9 @@ void nsTableFrame::PlaceChild(nsIPresContext* aPresContext, nsSize* aMaxElementSize, nsSize& aKidMaxElementSize) { + if (PR_TRUE==gsDebug) + printf ("table: placing row group at %d, %d, %d, %d\n", + aKidRect.x, aKidRect.y, aKidRect.width, aKidRect.height); // Place and size the child aKidFrame->SetRect(aKidRect); @@ -1660,7 +1667,7 @@ PRBool nsTableFrame::BalanceProportionalColumnsForSpecifiedWidthTable(nsIPresCon if (gsDebug) printf (" * min table does not fit, calling SetColumnsToMinWidth\n"); result = SetColumnsToMinWidth(aPresContext); } - else if (aMaxTableWidth < aMaxWidth) + else if (aMaxTableWidth <= aMaxWidth) { // the max width of the table fits comfortably in the available space if (gsDebug) printf (" * table desired size fits, calling BalanceColumnsTableFits\n"); result = BalanceColumnsTableFits(aPresContext, aTableStyleMol, aAvailWidth); @@ -1693,7 +1700,7 @@ PRBool nsTableFrame::BalanceProportionalColumnsForAutoWidthTable( nsIPresContext if (gsDebug) printf (" * min table does not fit, calling SetColumnsToMinWidth\n"); result = SetColumnsToMinWidth(aPresContext); } - else if (aMaxTableWidth < aMaxWidth) + else if (aMaxTableWidth <= aMaxWidth) { // the max width of the table fits comfortably in the available space if (gsDebug) printf (" * table desired size fits, calling BalanceColumnsTableFits\n"); result = BalanceColumnsTableFits(aPresContext, aTableStyleMol, aAvailWidth); diff --git a/layout/tables/nsTableOuterFrame.cpp b/layout/tables/nsTableOuterFrame.cpp index 001bf4b9d7f8..385d46b6e1e4 100644 --- a/layout/tables/nsTableOuterFrame.cpp +++ b/layout/tables/nsTableOuterFrame.cpp @@ -366,7 +366,8 @@ void nsTableOuterFrame::PlaceChild( OuterTableReflowState& aState, nsSize* aMaxElementSize, nsSize& aKidMaxElementSize) { - if (PR_TRUE==gsDebug) printf ("place child: %p with aKidRect %d %d %d %d\n", + if (PR_TRUE==gsDebug) + printf ("outer table place child: %p with aKidRect %d %d %d %d\n", aKidFrame, aKidRect.x, aKidRect.y, aKidRect.width, aKidRect.height); // Place and size the child diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index e493d706124b..3dfc1a640d1c 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -146,6 +146,7 @@ nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext, PreReflowCheck(); #endif + //nsresult result = NS_OK; PRInt32 maxCellHeight = 0; ResetMaxChildHeight(); @@ -153,8 +154,6 @@ nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext, mFirstContentOffset = mLastContentOffset = 0; - nsIContent* c = mContent; - nsSize availSize(aMaxSize); nsSize maxSize(0, 0); nsSize kidMaxSize(0,0); @@ -164,7 +163,7 @@ nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext, nscoord maxAscent = 0; nscoord maxDescent = 0; PRInt32 kidIndex = 0; - PRInt32 lastIndex = c->ChildCount(); + PRInt32 lastIndex = mContent->ChildCount(); nsIFrame* prevKidFrame = nsnull;/* XXX incremental reflow! */ // Row doesn't factor in insets, the cells do that @@ -174,34 +173,33 @@ nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext, mContentParent->GetContentParent((nsIFrame*&)tableFrame); for (;;) { - nsIContent* kid = c->ChildAt(kidIndex); // kid: REFCNT++ - if (nsnull == kid) { + nsTableCell* cell = (nsTableCell *)(mContent->ChildAt(kidIndex)); // cell: REFCNT++ + if (nsnull == cell) { aStatus = frComplete; break; } - // get frame, creating one if needed - nsIFrame* kidFrame; - - ChildAt(kidIndex, kidFrame); + // get next frame, creating one if needed + nsIFrame* kidFrame=nsnull; + if (nsnull!=prevKidFrame) + prevKidFrame->GetNextSibling(kidFrame); // no need to check for an error, just see if it returned null... + else + ChildAt(0, kidFrame); if (nsnull==kidFrame) { nsIContentDelegate* kidDel; - kidDel = kid->GetDelegate(aPresContext); - kidFrame = kidDel->CreateFrame(aPresContext, kid, kidIndex, this); + kidDel = cell->GetDelegate(aPresContext); + kidFrame = kidDel->CreateFrame(aPresContext, cell, kidIndex, this); mChildCount++; NS_RELEASE(kidDel); // Resolve style nsIStyleContext* kidStyleContext = - aPresContext->ResolveStyleContextFor(kid, this); + aPresContext->ResolveStyleContextFor(cell, this); NS_ASSERTION(nsnull!=kidStyleContext, "bad style context for kid."); kidFrame->SetStyleContext(kidStyleContext); NS_RELEASE(kidStyleContext); } - nsTableCell* cell; - - kidFrame->GetContent((nsIContent*&)cell); // cell: ADDREF++ // Try to reflow the child into the available space. if (NS_UNCONSTRAINEDSIZE == availSize.width) { // Each cell is given the entire row width to try to lay out into @@ -239,10 +237,12 @@ nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext, PRInt32 rowSpan = cell->GetRowSpan(); if ((1==rowSpan) && (maxCellHeightSetRect(nsRect(cellXOffset, 0, kidSize.width, kidSize.height)); if (kidSize.width > maxSize.width) { maxSize.width = kidSize.width; @@ -286,7 +286,7 @@ nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext, mLastContentIsComplete = PR_FALSE; break; } - NS_RELEASE(kid); // kid: REFCNT-- + NS_RELEASE(cell); // kid: REFCNT-- } if (nsnull != prevKidFrame) { diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index 58a4db802d18..3bfe3881cea4 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -184,6 +184,10 @@ void nsTableRowGroupFrame::PlaceChild( nsIPresContext* aPresContext, nsSize* aMaxElementSize, nsSize& aKidMaxElementSize) { + if (PR_TRUE==gsDebug1) + printf ("rowgroup: placing row at %d, %d, %d, %d\n", + aKidRect.x, aKidRect.y, aKidRect.width, aKidRect.height); + // Place and size the child aKidFrame->SetRect(aKidRect); @@ -715,7 +719,7 @@ nsTableRowGroupFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, nscoord topMargin = GetTopMarginFor(aPresContext, aState, kidMol); nscoord bottomMargin = kidMol->margin.bottom; - nsIFrame* kidFrame; + nsIFrame* kidFrame; // Create a child frame if (nsnull == kidPrevInFlow) {