зеркало из https://github.com/mozilla/pjs.git
bug 59252 - fixed regression caused by bug 53690. Don't reflow cell's in a fixed layout table unconstrained. a=buster, r=attinasi.
This commit is contained in:
Родитель
20a69a6cc6
Коммит
a4a746eda1
|
@ -1741,7 +1741,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
|
|
||||||
// See if we are supposed to compute our maximum width
|
// See if we are supposed to compute our maximum width
|
||||||
if (aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH) {
|
if (aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH) {
|
||||||
PRBool isAutoOrPctWidth = IsAutoLayout(&aReflowState) &&
|
PRBool isAutoOrPctWidth = IsAutoLayout() &&
|
||||||
((eStyleUnit_Auto == aReflowState.mStylePosition->mWidth.GetUnit() ||
|
((eStyleUnit_Auto == aReflowState.mStylePosition->mWidth.GetUnit() ||
|
||||||
(eStyleUnit_Percent == aReflowState.mStylePosition->mWidth.GetUnit())));
|
(eStyleUnit_Percent == aReflowState.mStylePosition->mWidth.GetUnit())));
|
||||||
|
|
||||||
|
@ -1827,7 +1827,7 @@ NS_METHOD nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
|
||||||
// Compute the insets (sum of border and padding)
|
// Compute the insets (sum of border and padding)
|
||||||
// XXX: since this is pass1 reflow and where we place the rowgroup frames is irrelevant, insets are probably a waste
|
// XXX: since this is pass1 reflow and where we place the rowgroup frames is irrelevant, insets are probably a waste
|
||||||
|
|
||||||
if (IsAutoLayout(&aReflowState)) {
|
if (IsAutoLayout()) {
|
||||||
nsVoidArray rowGroups;
|
nsVoidArray rowGroups;
|
||||||
PRUint32 numRowGroups;
|
PRUint32 numRowGroups;
|
||||||
OrderRowGroups(rowGroups, numRowGroups, nsnull);
|
OrderRowGroups(rowGroups, numRowGroups, nsnull);
|
||||||
|
@ -3059,7 +3059,7 @@ NS_METHOD nsTableFrame::ReflowMappedChildren(nsIPresContext* aPresContext
|
||||||
nscoord cellSpacingY = GetCellSpacingY();
|
nscoord cellSpacingY = GetCellSpacingY();
|
||||||
|
|
||||||
nsReflowReason reason;
|
nsReflowReason reason;
|
||||||
if (!IsAutoLayout(&aReflowState.reflowState)) {
|
if (!IsAutoLayout()) {
|
||||||
reason = aReflowState.reflowState.reason;
|
reason = aReflowState.reflowState.reason;
|
||||||
if (eReflowReason_Incremental==reason) {
|
if (eReflowReason_Incremental==reason) {
|
||||||
reason = eReflowReason_Resize;
|
reason = eReflowReason_Resize;
|
||||||
|
@ -3387,7 +3387,7 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,
|
||||||
if (nsnull == mTableLayoutStrategy) {
|
if (nsnull == mTableLayoutStrategy) {
|
||||||
nsCompatibility mode;
|
nsCompatibility mode;
|
||||||
aPresContext->GetCompatibilityMode(&mode);
|
aPresContext->GetCompatibilityMode(&mode);
|
||||||
if (!IsAutoLayout(&aReflowState))
|
if (!IsAutoLayout())
|
||||||
mTableLayoutStrategy = new FixedTableLayoutStrategy(this);
|
mTableLayoutStrategy = new FixedTableLayoutStrategy(this);
|
||||||
else
|
else
|
||||||
mTableLayoutStrategy = new BasicTableLayoutStrategy(this, eCompatibility_NavQuirks == mode);
|
mTableLayoutStrategy = new BasicTableLayoutStrategy(this, eCompatibility_NavQuirks == mode);
|
||||||
|
@ -3396,7 +3396,7 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
// fixed-layout tables need to reinitialize the layout strategy. When there are scroll bars
|
// fixed-layout tables need to reinitialize the layout strategy. When there are scroll bars
|
||||||
// reflow gets called twice and the 2nd time has the correct space available.
|
// reflow gets called twice and the 2nd time has the correct space available.
|
||||||
else if (!IsAutoLayout(&aReflowState)) {
|
else if (!IsAutoLayout()) {
|
||||||
mTableLayoutStrategy->Initialize(aPresContext, aMaxElementSize, boxWidth, aReflowState);
|
mTableLayoutStrategy->Initialize(aPresContext, aMaxElementSize, boxWidth, aReflowState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4263,20 +4263,15 @@ void nsTableFrame::SetMaxElementSize(nsSize* aMaxElementSize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PRBool nsTableFrame::IsAutoLayout(const nsHTMLReflowState* aReflowState)
|
PRBool
|
||||||
|
nsTableFrame::IsAutoLayout()
|
||||||
{
|
{
|
||||||
const nsStyleTable* tableStyle;
|
const nsStyleTable* tableStyle;
|
||||||
GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle);
|
GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle);
|
||||||
// a fixed table-layout table with an auto width is not considered as such
|
|
||||||
// for purposes of requiring pass1 reflow and assigning a layout strategy
|
|
||||||
if (NS_STYLE_TABLE_LAYOUT_FIXED == tableStyle->mLayoutStrategy) {
|
if (NS_STYLE_TABLE_LAYOUT_FIXED == tableStyle->mLayoutStrategy) {
|
||||||
const nsStylePosition* position;
|
const nsStylePosition* position;
|
||||||
if (aReflowState) {
|
GetStyleData(eStyleStruct_Position, (const nsStyleStruct *&)position);
|
||||||
position = aReflowState->mStylePosition;
|
// a fixed-layout table must have a width
|
||||||
}
|
|
||||||
else {
|
|
||||||
GetStyleData(eStyleStruct_Position, (const nsStyleStruct *&)position);
|
|
||||||
}
|
|
||||||
if (eStyleUnit_Auto != position->mWidth.GetUnit()) {
|
if (eStyleUnit_Auto != position->mWidth.GetUnit()) {
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -807,7 +807,7 @@ public: /* ----- Cell Map public methods ----- */
|
||||||
const nsMargin& aPadding);
|
const nsMargin& aPadding);
|
||||||
|
|
||||||
/** returns PR_TRUE if table layout requires a preliminary pass over the content */
|
/** returns PR_TRUE if table layout requires a preliminary pass over the content */
|
||||||
virtual PRBool IsAutoLayout(const nsHTMLReflowState* aReflowState = nsnull);
|
virtual PRBool IsAutoLayout();
|
||||||
|
|
||||||
// compute the height of the table to be used as the basis for
|
// compute the height of the table to be used as the basis for
|
||||||
// percentage height cells
|
// percentage height cells
|
||||||
|
|
|
@ -839,6 +839,8 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext,
|
||||||
|
|
||||||
PRInt32 prevColIndex; // remember the col index of the previous cell to handle rowspans into this row
|
PRInt32 prevColIndex; // remember the col index of the previous cell to handle rowspans into this row
|
||||||
|
|
||||||
|
nsTableFrame* tableFrame = nsnull;
|
||||||
|
rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
||||||
nsTableIteration dir = (aReflowState.reflowState.availableWidth == NS_UNCONSTRAINEDSIZE)
|
nsTableIteration dir = (aReflowState.reflowState.availableWidth == NS_UNCONSTRAINEDSIZE)
|
||||||
? eTableLTR : eTableDIR;
|
? eTableLTR : eTableDIR;
|
||||||
nsTableIterator iter(aPresContext, *this, dir);
|
nsTableIterator iter(aPresContext, *this, dir);
|
||||||
|
@ -846,14 +848,13 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext,
|
||||||
prevColIndex = -1;
|
prevColIndex = -1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nsTableFrame* tableFrame = nsnull;
|
|
||||||
rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
|
||||||
if (NS_FAILED(rv) || (nsnull == tableFrame)) {
|
if (NS_FAILED(rv) || (nsnull == tableFrame)) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
prevColIndex = tableFrame->GetColCount();
|
prevColIndex = tableFrame->GetColCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PRBool isAutoLayout = tableFrame->IsAutoLayout();
|
||||||
// Reflow each of our existing cell frames
|
// Reflow each of our existing cell frames
|
||||||
nsIFrame* kidFrame = iter.First();
|
nsIFrame* kidFrame = iter.First();
|
||||||
while (nsnull != kidFrame) {
|
while (nsnull != kidFrame) {
|
||||||
|
@ -870,9 +871,9 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reflow the child frame
|
// Reflow the child frame
|
||||||
|
const nsStyleDisplay *kidDisplay;
|
||||||
|
kidFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)kidDisplay));
|
||||||
if (doReflowChild) {
|
if (doReflowChild) {
|
||||||
const nsStyleDisplay *kidDisplay;
|
|
||||||
kidFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)kidDisplay));
|
|
||||||
if (NS_STYLE_DISPLAY_TABLE_CELL == kidDisplay->mDisplay) {
|
if (NS_STYLE_DISPLAY_TABLE_CELL == kidDisplay->mDisplay) {
|
||||||
PRInt32 cellColIndex;
|
PRInt32 cellColIndex;
|
||||||
((nsTableCellFrame *)kidFrame)->GetColIndex(cellColIndex);
|
((nsTableCellFrame *)kidFrame)->GetColIndex(cellColIndex);
|
||||||
|
@ -908,7 +909,7 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext,
|
||||||
// Calculate the available width for the table cell using the known
|
// Calculate the available width for the table cell using the known
|
||||||
// column widths
|
// column widths
|
||||||
nscoord availWidth;
|
nscoord availWidth;
|
||||||
if (!mPrevInFlow && (frameState & NS_FRAME_FIRST_REFLOW)) {
|
if (!mPrevInFlow && isAutoLayout && (frameState & NS_FRAME_FIRST_REFLOW)) {
|
||||||
// This is the initial reflow for the cell and so we do an unconstrained
|
// This is the initial reflow for the cell and so we do an unconstrained
|
||||||
// reflow.
|
// reflow.
|
||||||
// Note: don't assume that we have known column widths. If we don't, then
|
// Note: don't assume that we have known column widths. If we don't, then
|
||||||
|
@ -942,11 +943,9 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext,
|
||||||
nsSize kidAvailSize(availWidth, aReflowState.reflowState.availableHeight);
|
nsSize kidAvailSize(availWidth, aReflowState.reflowState.availableHeight);
|
||||||
|
|
||||||
// If it's a dirty frame, then check whether it's the initial reflow
|
// If it's a dirty frame, then check whether it's the initial reflow
|
||||||
nsReflowReason reason = eReflowReason_Resize;
|
nsReflowReason reason =
|
||||||
if (!mPrevInFlow && (frameState & NS_FRAME_FIRST_REFLOW)) {
|
(frameState & NS_FRAME_FIRST_REFLOW) ? eReflowReason_Initial :eReflowReason_Resize;
|
||||||
// Newly inserted frame
|
if (!mPrevInFlow && isAutoLayout && (frameState & NS_FRAME_FIRST_REFLOW)) {
|
||||||
reason = eReflowReason_Initial;
|
|
||||||
|
|
||||||
// Use an unconstrained width so we can get the child's maximum width
|
// Use an unconstrained width so we can get the child's maximum width
|
||||||
// XXX What about fixed layout tables?
|
// XXX What about fixed layout tables?
|
||||||
kidAvailSize.SizeTo(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
kidAvailSize.SizeTo(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
||||||
|
@ -983,6 +982,8 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext,
|
||||||
if (kidMaxElementSize) {
|
if (kidMaxElementSize) {
|
||||||
((nsTableCellFrame *)kidFrame)->SetPass1MaxElementSize(*kidMaxElementSize);
|
((nsTableCellFrame *)kidFrame)->SetPass1MaxElementSize(*kidMaxElementSize);
|
||||||
}
|
}
|
||||||
|
// XXX if we did an unconstrained reflow, do we need to do another one
|
||||||
|
// there needs to be more test cases to show this
|
||||||
}
|
}
|
||||||
|
|
||||||
// If any of the cells are not complete, then we're not complete
|
// If any of the cells are not complete, then we're not complete
|
||||||
|
@ -1037,6 +1038,12 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext,
|
||||||
kidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
|
kidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (NS_STYLE_DISPLAY_TABLE_CELL == kidDisplay->mDisplay) {
|
||||||
|
// we need to account for the cell's width even if it isn't reflowed
|
||||||
|
nsRect rect;
|
||||||
|
kidFrame->GetRect(rect);
|
||||||
|
aReflowState.x += rect.width;
|
||||||
|
}
|
||||||
|
|
||||||
kidFrame = iter.Next(); // Get the next child
|
kidFrame = iter.Next(); // Get the next child
|
||||||
// if this was the last child, and it had a colspan>1, add in the cellSpacing for the colspan
|
// if this was the last child, and it had a colspan>1, add in the cellSpacing for the colspan
|
||||||
|
@ -1082,7 +1089,7 @@ nsTableRowFrame::InitialReflow(nsIPresContext* aPresContext,
|
||||||
nsSize kidMaxElementSize(0,0);
|
nsSize kidMaxElementSize(0,0);
|
||||||
nscoord x = 0;
|
nscoord x = 0;
|
||||||
nsTableFrame* table = aReflowState.tableFrame;
|
nsTableFrame* table = aReflowState.tableFrame;
|
||||||
PRBool isAutoLayout = table->IsAutoLayout(&aReflowState.reflowState);
|
PRBool isAutoLayout = table->IsAutoLayout();
|
||||||
nscoord cellSpacingX = table->GetCellSpacingX();
|
nscoord cellSpacingX = table->GetCellSpacingX();
|
||||||
|
|
||||||
nsIFrame* kidFrame;
|
nsIFrame* kidFrame;
|
||||||
|
|
|
@ -1741,7 +1741,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
|
|
||||||
// See if we are supposed to compute our maximum width
|
// See if we are supposed to compute our maximum width
|
||||||
if (aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH) {
|
if (aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH) {
|
||||||
PRBool isAutoOrPctWidth = IsAutoLayout(&aReflowState) &&
|
PRBool isAutoOrPctWidth = IsAutoLayout() &&
|
||||||
((eStyleUnit_Auto == aReflowState.mStylePosition->mWidth.GetUnit() ||
|
((eStyleUnit_Auto == aReflowState.mStylePosition->mWidth.GetUnit() ||
|
||||||
(eStyleUnit_Percent == aReflowState.mStylePosition->mWidth.GetUnit())));
|
(eStyleUnit_Percent == aReflowState.mStylePosition->mWidth.GetUnit())));
|
||||||
|
|
||||||
|
@ -1827,7 +1827,7 @@ NS_METHOD nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
|
||||||
// Compute the insets (sum of border and padding)
|
// Compute the insets (sum of border and padding)
|
||||||
// XXX: since this is pass1 reflow and where we place the rowgroup frames is irrelevant, insets are probably a waste
|
// XXX: since this is pass1 reflow and where we place the rowgroup frames is irrelevant, insets are probably a waste
|
||||||
|
|
||||||
if (IsAutoLayout(&aReflowState)) {
|
if (IsAutoLayout()) {
|
||||||
nsVoidArray rowGroups;
|
nsVoidArray rowGroups;
|
||||||
PRUint32 numRowGroups;
|
PRUint32 numRowGroups;
|
||||||
OrderRowGroups(rowGroups, numRowGroups, nsnull);
|
OrderRowGroups(rowGroups, numRowGroups, nsnull);
|
||||||
|
@ -3059,7 +3059,7 @@ NS_METHOD nsTableFrame::ReflowMappedChildren(nsIPresContext* aPresContext
|
||||||
nscoord cellSpacingY = GetCellSpacingY();
|
nscoord cellSpacingY = GetCellSpacingY();
|
||||||
|
|
||||||
nsReflowReason reason;
|
nsReflowReason reason;
|
||||||
if (!IsAutoLayout(&aReflowState.reflowState)) {
|
if (!IsAutoLayout()) {
|
||||||
reason = aReflowState.reflowState.reason;
|
reason = aReflowState.reflowState.reason;
|
||||||
if (eReflowReason_Incremental==reason) {
|
if (eReflowReason_Incremental==reason) {
|
||||||
reason = eReflowReason_Resize;
|
reason = eReflowReason_Resize;
|
||||||
|
@ -3387,7 +3387,7 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,
|
||||||
if (nsnull == mTableLayoutStrategy) {
|
if (nsnull == mTableLayoutStrategy) {
|
||||||
nsCompatibility mode;
|
nsCompatibility mode;
|
||||||
aPresContext->GetCompatibilityMode(&mode);
|
aPresContext->GetCompatibilityMode(&mode);
|
||||||
if (!IsAutoLayout(&aReflowState))
|
if (!IsAutoLayout())
|
||||||
mTableLayoutStrategy = new FixedTableLayoutStrategy(this);
|
mTableLayoutStrategy = new FixedTableLayoutStrategy(this);
|
||||||
else
|
else
|
||||||
mTableLayoutStrategy = new BasicTableLayoutStrategy(this, eCompatibility_NavQuirks == mode);
|
mTableLayoutStrategy = new BasicTableLayoutStrategy(this, eCompatibility_NavQuirks == mode);
|
||||||
|
@ -3396,7 +3396,7 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
// fixed-layout tables need to reinitialize the layout strategy. When there are scroll bars
|
// fixed-layout tables need to reinitialize the layout strategy. When there are scroll bars
|
||||||
// reflow gets called twice and the 2nd time has the correct space available.
|
// reflow gets called twice and the 2nd time has the correct space available.
|
||||||
else if (!IsAutoLayout(&aReflowState)) {
|
else if (!IsAutoLayout()) {
|
||||||
mTableLayoutStrategy->Initialize(aPresContext, aMaxElementSize, boxWidth, aReflowState);
|
mTableLayoutStrategy->Initialize(aPresContext, aMaxElementSize, boxWidth, aReflowState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4263,20 +4263,15 @@ void nsTableFrame::SetMaxElementSize(nsSize* aMaxElementSize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PRBool nsTableFrame::IsAutoLayout(const nsHTMLReflowState* aReflowState)
|
PRBool
|
||||||
|
nsTableFrame::IsAutoLayout()
|
||||||
{
|
{
|
||||||
const nsStyleTable* tableStyle;
|
const nsStyleTable* tableStyle;
|
||||||
GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle);
|
GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle);
|
||||||
// a fixed table-layout table with an auto width is not considered as such
|
|
||||||
// for purposes of requiring pass1 reflow and assigning a layout strategy
|
|
||||||
if (NS_STYLE_TABLE_LAYOUT_FIXED == tableStyle->mLayoutStrategy) {
|
if (NS_STYLE_TABLE_LAYOUT_FIXED == tableStyle->mLayoutStrategy) {
|
||||||
const nsStylePosition* position;
|
const nsStylePosition* position;
|
||||||
if (aReflowState) {
|
GetStyleData(eStyleStruct_Position, (const nsStyleStruct *&)position);
|
||||||
position = aReflowState->mStylePosition;
|
// a fixed-layout table must have a width
|
||||||
}
|
|
||||||
else {
|
|
||||||
GetStyleData(eStyleStruct_Position, (const nsStyleStruct *&)position);
|
|
||||||
}
|
|
||||||
if (eStyleUnit_Auto != position->mWidth.GetUnit()) {
|
if (eStyleUnit_Auto != position->mWidth.GetUnit()) {
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -807,7 +807,7 @@ public: /* ----- Cell Map public methods ----- */
|
||||||
const nsMargin& aPadding);
|
const nsMargin& aPadding);
|
||||||
|
|
||||||
/** returns PR_TRUE if table layout requires a preliminary pass over the content */
|
/** returns PR_TRUE if table layout requires a preliminary pass over the content */
|
||||||
virtual PRBool IsAutoLayout(const nsHTMLReflowState* aReflowState = nsnull);
|
virtual PRBool IsAutoLayout();
|
||||||
|
|
||||||
// compute the height of the table to be used as the basis for
|
// compute the height of the table to be used as the basis for
|
||||||
// percentage height cells
|
// percentage height cells
|
||||||
|
|
|
@ -839,6 +839,8 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext,
|
||||||
|
|
||||||
PRInt32 prevColIndex; // remember the col index of the previous cell to handle rowspans into this row
|
PRInt32 prevColIndex; // remember the col index of the previous cell to handle rowspans into this row
|
||||||
|
|
||||||
|
nsTableFrame* tableFrame = nsnull;
|
||||||
|
rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
||||||
nsTableIteration dir = (aReflowState.reflowState.availableWidth == NS_UNCONSTRAINEDSIZE)
|
nsTableIteration dir = (aReflowState.reflowState.availableWidth == NS_UNCONSTRAINEDSIZE)
|
||||||
? eTableLTR : eTableDIR;
|
? eTableLTR : eTableDIR;
|
||||||
nsTableIterator iter(aPresContext, *this, dir);
|
nsTableIterator iter(aPresContext, *this, dir);
|
||||||
|
@ -846,14 +848,13 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext,
|
||||||
prevColIndex = -1;
|
prevColIndex = -1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nsTableFrame* tableFrame = nsnull;
|
|
||||||
rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
|
||||||
if (NS_FAILED(rv) || (nsnull == tableFrame)) {
|
if (NS_FAILED(rv) || (nsnull == tableFrame)) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
prevColIndex = tableFrame->GetColCount();
|
prevColIndex = tableFrame->GetColCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PRBool isAutoLayout = tableFrame->IsAutoLayout();
|
||||||
// Reflow each of our existing cell frames
|
// Reflow each of our existing cell frames
|
||||||
nsIFrame* kidFrame = iter.First();
|
nsIFrame* kidFrame = iter.First();
|
||||||
while (nsnull != kidFrame) {
|
while (nsnull != kidFrame) {
|
||||||
|
@ -870,9 +871,9 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reflow the child frame
|
// Reflow the child frame
|
||||||
|
const nsStyleDisplay *kidDisplay;
|
||||||
|
kidFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)kidDisplay));
|
||||||
if (doReflowChild) {
|
if (doReflowChild) {
|
||||||
const nsStyleDisplay *kidDisplay;
|
|
||||||
kidFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)kidDisplay));
|
|
||||||
if (NS_STYLE_DISPLAY_TABLE_CELL == kidDisplay->mDisplay) {
|
if (NS_STYLE_DISPLAY_TABLE_CELL == kidDisplay->mDisplay) {
|
||||||
PRInt32 cellColIndex;
|
PRInt32 cellColIndex;
|
||||||
((nsTableCellFrame *)kidFrame)->GetColIndex(cellColIndex);
|
((nsTableCellFrame *)kidFrame)->GetColIndex(cellColIndex);
|
||||||
|
@ -908,7 +909,7 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext,
|
||||||
// Calculate the available width for the table cell using the known
|
// Calculate the available width for the table cell using the known
|
||||||
// column widths
|
// column widths
|
||||||
nscoord availWidth;
|
nscoord availWidth;
|
||||||
if (!mPrevInFlow && (frameState & NS_FRAME_FIRST_REFLOW)) {
|
if (!mPrevInFlow && isAutoLayout && (frameState & NS_FRAME_FIRST_REFLOW)) {
|
||||||
// This is the initial reflow for the cell and so we do an unconstrained
|
// This is the initial reflow for the cell and so we do an unconstrained
|
||||||
// reflow.
|
// reflow.
|
||||||
// Note: don't assume that we have known column widths. If we don't, then
|
// Note: don't assume that we have known column widths. If we don't, then
|
||||||
|
@ -942,11 +943,9 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext,
|
||||||
nsSize kidAvailSize(availWidth, aReflowState.reflowState.availableHeight);
|
nsSize kidAvailSize(availWidth, aReflowState.reflowState.availableHeight);
|
||||||
|
|
||||||
// If it's a dirty frame, then check whether it's the initial reflow
|
// If it's a dirty frame, then check whether it's the initial reflow
|
||||||
nsReflowReason reason = eReflowReason_Resize;
|
nsReflowReason reason =
|
||||||
if (!mPrevInFlow && (frameState & NS_FRAME_FIRST_REFLOW)) {
|
(frameState & NS_FRAME_FIRST_REFLOW) ? eReflowReason_Initial :eReflowReason_Resize;
|
||||||
// Newly inserted frame
|
if (!mPrevInFlow && isAutoLayout && (frameState & NS_FRAME_FIRST_REFLOW)) {
|
||||||
reason = eReflowReason_Initial;
|
|
||||||
|
|
||||||
// Use an unconstrained width so we can get the child's maximum width
|
// Use an unconstrained width so we can get the child's maximum width
|
||||||
// XXX What about fixed layout tables?
|
// XXX What about fixed layout tables?
|
||||||
kidAvailSize.SizeTo(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
kidAvailSize.SizeTo(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
||||||
|
@ -983,6 +982,8 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext,
|
||||||
if (kidMaxElementSize) {
|
if (kidMaxElementSize) {
|
||||||
((nsTableCellFrame *)kidFrame)->SetPass1MaxElementSize(*kidMaxElementSize);
|
((nsTableCellFrame *)kidFrame)->SetPass1MaxElementSize(*kidMaxElementSize);
|
||||||
}
|
}
|
||||||
|
// XXX if we did an unconstrained reflow, do we need to do another one
|
||||||
|
// there needs to be more test cases to show this
|
||||||
}
|
}
|
||||||
|
|
||||||
// If any of the cells are not complete, then we're not complete
|
// If any of the cells are not complete, then we're not complete
|
||||||
|
@ -1037,6 +1038,12 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext,
|
||||||
kidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
|
kidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (NS_STYLE_DISPLAY_TABLE_CELL == kidDisplay->mDisplay) {
|
||||||
|
// we need to account for the cell's width even if it isn't reflowed
|
||||||
|
nsRect rect;
|
||||||
|
kidFrame->GetRect(rect);
|
||||||
|
aReflowState.x += rect.width;
|
||||||
|
}
|
||||||
|
|
||||||
kidFrame = iter.Next(); // Get the next child
|
kidFrame = iter.Next(); // Get the next child
|
||||||
// if this was the last child, and it had a colspan>1, add in the cellSpacing for the colspan
|
// if this was the last child, and it had a colspan>1, add in the cellSpacing for the colspan
|
||||||
|
@ -1082,7 +1089,7 @@ nsTableRowFrame::InitialReflow(nsIPresContext* aPresContext,
|
||||||
nsSize kidMaxElementSize(0,0);
|
nsSize kidMaxElementSize(0,0);
|
||||||
nscoord x = 0;
|
nscoord x = 0;
|
||||||
nsTableFrame* table = aReflowState.tableFrame;
|
nsTableFrame* table = aReflowState.tableFrame;
|
||||||
PRBool isAutoLayout = table->IsAutoLayout(&aReflowState.reflowState);
|
PRBool isAutoLayout = table->IsAutoLayout();
|
||||||
nscoord cellSpacingX = table->GetCellSpacingX();
|
nscoord cellSpacingX = table->GetCellSpacingX();
|
||||||
|
|
||||||
nsIFrame* kidFrame;
|
nsIFrame* kidFrame;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче