зеркало из https://github.com/mozilla/gecko-dev.git
table performance and minor bug fixes.
This commit is contained in:
Родитель
e8b3026775
Коммит
073e82f152
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) && (maxCellHeight<kidSize.height))
|
||||
maxCellHeight = kidSize.height;
|
||||
NS_RELEASE(cell); // cell: ADDREF--
|
||||
|
||||
// SEC: the next line is probably unnecessary
|
||||
// Place the child since some of it's content fit in us.
|
||||
if (PR_TRUE==gsDebug1)
|
||||
printf ("row: placing cell at %d, %d, %d, %d\n",
|
||||
cellXOffset, 0, kidSize.width, kidSize.height);
|
||||
kidFrame->SetRect(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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) && (maxCellHeight<kidSize.height))
|
||||
maxCellHeight = kidSize.height;
|
||||
NS_RELEASE(cell); // cell: ADDREF--
|
||||
|
||||
// SEC: the next line is probably unnecessary
|
||||
// Place the child since some of it's content fit in us.
|
||||
if (PR_TRUE==gsDebug1)
|
||||
printf ("row: placing cell at %d, %d, %d, %d\n",
|
||||
cellXOffset, 0, kidSize.width, kidSize.height);
|
||||
kidFrame->SetRect(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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче