mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
any table with a nonsense rowspan lays out better
This commit is contained in:
parent
fde82a1240
commit
911380aeb5
@ -235,13 +235,13 @@ PRInt32 nsTableRowFrame::GetMaxColumns() const
|
||||
/* GetMinRowSpan is needed for deviant cases where every cell in a row has a rowspan > 1.
|
||||
* It sets mMinRowSpan, which is used in FixMinCellHeight and PlaceChild
|
||||
*/
|
||||
void nsTableRowFrame::GetMinRowSpan()
|
||||
void nsTableRowFrame::GetMinRowSpan(nsTableFrame *aTableFrame)
|
||||
{
|
||||
PRInt32 minRowSpan=-1;
|
||||
nsIFrame *frame=mFirstChild;
|
||||
while (nsnull!=frame)
|
||||
{
|
||||
PRInt32 rowSpan = ((nsTableCellFrame *)frame)->GetRowSpan();
|
||||
PRInt32 rowSpan = aTableFrame->GetEffectiveRowSpan(mRowIndex, ((nsTableCellFrame *)frame));
|
||||
if (-1==minRowSpan)
|
||||
minRowSpan = rowSpan;
|
||||
else if (minRowSpan>rowSpan)
|
||||
@ -251,12 +251,12 @@ void nsTableRowFrame::GetMinRowSpan()
|
||||
mMinRowSpan = minRowSpan;
|
||||
}
|
||||
|
||||
void nsTableRowFrame::FixMinCellHeight()
|
||||
void nsTableRowFrame::FixMinCellHeight(nsTableFrame *aTableFrame)
|
||||
{
|
||||
nsIFrame *frame=mFirstChild;
|
||||
while (nsnull!=frame)
|
||||
{
|
||||
PRInt32 rowSpan = ((nsTableCellFrame *)frame)->GetRowSpan();
|
||||
PRInt32 rowSpan = aTableFrame->GetEffectiveRowSpan(mRowIndex, ((nsTableCellFrame *)frame));
|
||||
if (mMinRowSpan==rowSpan)
|
||||
{
|
||||
nsRect rect;
|
||||
@ -289,7 +289,8 @@ void nsTableRowFrame::PlaceChild(nsIPresContext& aPresContext,
|
||||
aState.x += aKidRect.width;
|
||||
|
||||
// Update the maximum element size
|
||||
PRInt32 rowSpan = ((nsTableCellFrame*)aKidFrame)->GetRowSpan();
|
||||
PRInt32 rowSpan = aState.tableFrame->GetEffectiveRowSpan(mRowIndex,
|
||||
((nsTableCellFrame*)aKidFrame));
|
||||
if (nsnull != aMaxElementSize)
|
||||
{
|
||||
aMaxElementSize->width += aKidMaxElementSize->width;
|
||||
@ -645,7 +646,7 @@ nsresult nsTableRowFrame::RecoverState(nsIPresContext& aPresContext,
|
||||
if (kidMargin.bottom > aMaxCellBottomMargin)
|
||||
aMaxCellBottomMargin = kidMargin.bottom;
|
||||
|
||||
PRInt32 rowSpan = ((nsTableCellFrame*)frame)->GetRowSpan();
|
||||
PRInt32 rowSpan = aState.tableFrame->GetEffectiveRowSpan(mRowIndex, ((nsTableCellFrame *)frame));
|
||||
if (mMinRowSpan == rowSpan) {
|
||||
// Get the cell's desired height the last time it was reflowed
|
||||
nsSize desiredSize = ((nsTableCellFrame *)frame)->GetDesiredSize();
|
||||
@ -875,8 +876,8 @@ nsTableRowFrame::Reflow(nsIPresContext& aPresContext,
|
||||
case eReflowReason_Initial:
|
||||
NS_ASSERTION(nsnull == mFirstChild, "unexpected reflow reason");
|
||||
result = InitialReflow(aPresContext, state, aDesiredSize);
|
||||
GetMinRowSpan();
|
||||
FixMinCellHeight();
|
||||
GetMinRowSpan(tableFrame);
|
||||
FixMinCellHeight(tableFrame);
|
||||
break;
|
||||
|
||||
case eReflowReason_Resize:
|
||||
|
@ -123,9 +123,9 @@ protected:
|
||||
|
||||
// row-specific methods
|
||||
|
||||
void GetMinRowSpan();
|
||||
void GetMinRowSpan(nsTableFrame *aTableFrame);
|
||||
|
||||
void FixMinCellHeight();
|
||||
void FixMinCellHeight(nsTableFrame *aTableFrame);
|
||||
|
||||
nsresult RecoverState(nsIPresContext& aPresContext,
|
||||
RowReflowState& aState,
|
||||
|
@ -847,7 +847,9 @@ void nsTableRowGroupFrame::ShrinkWrapChildren(nsIPresContext* aPresContext,
|
||||
nscoord topInnerMargin = 0;
|
||||
nscoord bottomInnerMargin = 0;
|
||||
PRInt32 numRows;
|
||||
ChildCount(numRows);
|
||||
ChildCount(numRows); //XXX: this doesn't work if we allow non-table row content.
|
||||
// we actually need to go through our content and count the
|
||||
// children that are display type == table row
|
||||
PRInt32 *rowHeights = new PRInt32[numRows];
|
||||
nsCRT::memset (rowHeights, 0, numRows*sizeof(PRInt32));
|
||||
|
||||
|
@ -235,13 +235,13 @@ PRInt32 nsTableRowFrame::GetMaxColumns() const
|
||||
/* GetMinRowSpan is needed for deviant cases where every cell in a row has a rowspan > 1.
|
||||
* It sets mMinRowSpan, which is used in FixMinCellHeight and PlaceChild
|
||||
*/
|
||||
void nsTableRowFrame::GetMinRowSpan()
|
||||
void nsTableRowFrame::GetMinRowSpan(nsTableFrame *aTableFrame)
|
||||
{
|
||||
PRInt32 minRowSpan=-1;
|
||||
nsIFrame *frame=mFirstChild;
|
||||
while (nsnull!=frame)
|
||||
{
|
||||
PRInt32 rowSpan = ((nsTableCellFrame *)frame)->GetRowSpan();
|
||||
PRInt32 rowSpan = aTableFrame->GetEffectiveRowSpan(mRowIndex, ((nsTableCellFrame *)frame));
|
||||
if (-1==minRowSpan)
|
||||
minRowSpan = rowSpan;
|
||||
else if (minRowSpan>rowSpan)
|
||||
@ -251,12 +251,12 @@ void nsTableRowFrame::GetMinRowSpan()
|
||||
mMinRowSpan = minRowSpan;
|
||||
}
|
||||
|
||||
void nsTableRowFrame::FixMinCellHeight()
|
||||
void nsTableRowFrame::FixMinCellHeight(nsTableFrame *aTableFrame)
|
||||
{
|
||||
nsIFrame *frame=mFirstChild;
|
||||
while (nsnull!=frame)
|
||||
{
|
||||
PRInt32 rowSpan = ((nsTableCellFrame *)frame)->GetRowSpan();
|
||||
PRInt32 rowSpan = aTableFrame->GetEffectiveRowSpan(mRowIndex, ((nsTableCellFrame *)frame));
|
||||
if (mMinRowSpan==rowSpan)
|
||||
{
|
||||
nsRect rect;
|
||||
@ -289,7 +289,8 @@ void nsTableRowFrame::PlaceChild(nsIPresContext& aPresContext,
|
||||
aState.x += aKidRect.width;
|
||||
|
||||
// Update the maximum element size
|
||||
PRInt32 rowSpan = ((nsTableCellFrame*)aKidFrame)->GetRowSpan();
|
||||
PRInt32 rowSpan = aState.tableFrame->GetEffectiveRowSpan(mRowIndex,
|
||||
((nsTableCellFrame*)aKidFrame));
|
||||
if (nsnull != aMaxElementSize)
|
||||
{
|
||||
aMaxElementSize->width += aKidMaxElementSize->width;
|
||||
@ -645,7 +646,7 @@ nsresult nsTableRowFrame::RecoverState(nsIPresContext& aPresContext,
|
||||
if (kidMargin.bottom > aMaxCellBottomMargin)
|
||||
aMaxCellBottomMargin = kidMargin.bottom;
|
||||
|
||||
PRInt32 rowSpan = ((nsTableCellFrame*)frame)->GetRowSpan();
|
||||
PRInt32 rowSpan = aState.tableFrame->GetEffectiveRowSpan(mRowIndex, ((nsTableCellFrame *)frame));
|
||||
if (mMinRowSpan == rowSpan) {
|
||||
// Get the cell's desired height the last time it was reflowed
|
||||
nsSize desiredSize = ((nsTableCellFrame *)frame)->GetDesiredSize();
|
||||
@ -875,8 +876,8 @@ nsTableRowFrame::Reflow(nsIPresContext& aPresContext,
|
||||
case eReflowReason_Initial:
|
||||
NS_ASSERTION(nsnull == mFirstChild, "unexpected reflow reason");
|
||||
result = InitialReflow(aPresContext, state, aDesiredSize);
|
||||
GetMinRowSpan();
|
||||
FixMinCellHeight();
|
||||
GetMinRowSpan(tableFrame);
|
||||
FixMinCellHeight(tableFrame);
|
||||
break;
|
||||
|
||||
case eReflowReason_Resize:
|
||||
|
@ -123,9 +123,9 @@ protected:
|
||||
|
||||
// row-specific methods
|
||||
|
||||
void GetMinRowSpan();
|
||||
void GetMinRowSpan(nsTableFrame *aTableFrame);
|
||||
|
||||
void FixMinCellHeight();
|
||||
void FixMinCellHeight(nsTableFrame *aTableFrame);
|
||||
|
||||
nsresult RecoverState(nsIPresContext& aPresContext,
|
||||
RowReflowState& aState,
|
||||
|
@ -847,7 +847,9 @@ void nsTableRowGroupFrame::ShrinkWrapChildren(nsIPresContext* aPresContext,
|
||||
nscoord topInnerMargin = 0;
|
||||
nscoord bottomInnerMargin = 0;
|
||||
PRInt32 numRows;
|
||||
ChildCount(numRows);
|
||||
ChildCount(numRows); //XXX: this doesn't work if we allow non-table row content.
|
||||
// we actually need to go through our content and count the
|
||||
// children that are display type == table row
|
||||
PRInt32 *rowHeights = new PRInt32[numRows];
|
||||
nsCRT::memset (rowHeights, 0, numRows*sizeof(PRInt32));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user