From f6d394fcc0fe6ec1de0dec0ee777024ce8a3032f Mon Sep 17 00:00:00 2001 From: "buster@netscape.com" Date: Wed, 4 Nov 1998 19:33:27 +0000 Subject: [PATCH] in default 2-pass layout, tables with auto width and with all columns coord width now act like auto width tables, not like specified width (which you might logically expect since all column widths are specified, but sadly that's not the way Nav or IE interprets this case. ) nsTableFrame's use of IsPseudoFrame has been removed. --- .../table/src/BasicTableLayoutStrategy.cpp | 33 ++++++-------- layout/html/table/src/nsTableFrame.cpp | 44 ++++--------------- layout/tables/BasicTableLayoutStrategy.cpp | 33 ++++++-------- layout/tables/nsTableFrame.cpp | 44 ++++--------------- 4 files changed, 44 insertions(+), 110 deletions(-) diff --git a/layout/html/table/src/BasicTableLayoutStrategy.cpp b/layout/html/table/src/BasicTableLayoutStrategy.cpp index 59236994bfde..94229dd2786a 100644 --- a/layout/html/table/src/BasicTableLayoutStrategy.cpp +++ b/layout/html/table/src/BasicTableLayoutStrategy.cpp @@ -2035,26 +2035,19 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( const nsHTMLReflowSt } // second, fix up tables where column width attributes give us a table that is too wide or too narrow - // IFF the table is NOT (auto-width && all columns have fixed width) - PRInt32 numFixedColumns=0; - PRInt32 *fixedColumns=nsnull; - mTableFrame->GetColumnsByType(eStyleUnit_Coord, numFixedColumns, fixedColumns); - if (!((PR_TRUE==aTableIsAutoWidth) && (numFixedColumns==mNumCols))) - { - nscoord computedWidth=0; - for (PRInt32 i=0; iGetColumnWidth(i) + colInset; - } - if (computedWidthaMaxWidth) - { // then shrink the table width because its too wide - AdjustTableThatIsTooWide(computedWidth, aMaxWidth, PR_FALSE); - } + nscoord computedWidth=0; + for (PRInt32 i=0; iGetColumnWidth(i) + colInset; + } + if (computedWidthaMaxWidth) + { // then shrink the table width because its too wide + AdjustTableThatIsTooWide(computedWidth, aMaxWidth, PR_FALSE); } diff --git a/layout/html/table/src/nsTableFrame.cpp b/layout/html/table/src/nsTableFrame.cpp index 3e654786f56e..c34b264b5590 100644 --- a/layout/html/table/src/nsTableFrame.cpp +++ b/layout/html/table/src/nsTableFrame.cpp @@ -3602,28 +3602,6 @@ PRBool nsTableFrame::IsNested(const nsHTMLReflowState& aReflowState, nsStylePosi return result; } -static PRBool -IsPseudoFrame(nsIFrame* aFrame) -{ - nsIContent* content; - nsIFrame* parentFrame; - PRBool result = PR_FALSE; - - aFrame->GetContent(content); - aFrame->GetGeometricParent(parentFrame); - if (nsnull != parentFrame) { - nsIContent* parentContent; - - parentFrame->GetContent(parentContent); - if (parentContent == content) { - result = PR_TRUE; - } - NS_RELEASE(parentContent); - } - - NS_RELEASE(content); - return result; -} /* helper method for getting the width of the table's containing block */ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowState) @@ -3645,22 +3623,18 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta if (NS_OK==rv) { // we found a block, see if it's really a table cell (which means we're a nested table) PRBool skipThisBlock=PR_FALSE; - // XXX FIX ME... - if (IsPseudoFrame(block)) + const nsReflowState* parentRS = rs->parentReflowState; + if (nsnull!=parentRS) { - const nsReflowState* parentRS = rs->parentReflowState; + parentRS = parentRS->parentReflowState; if (nsnull!=parentRS) { - parentRS = parentRS->parentReflowState; - if (nsnull!=parentRS) - { - nsIFrame* cell = nsnull; - rv = parentRS->frame->QueryInterface(kTableCellFrameCID, (void**) &cell); - if (rv == NS_OK) { - if (PR_TRUE==gsDebugNT) - printf("%p: found a block pframe %p in a cell, skipping it.\n", aReflowState.frame, block); - skipThisBlock = PR_TRUE; - } + nsIFrame* cell = nsnull; + rv = parentRS->frame->QueryInterface(kTableCellFrameCID, (void**) &cell); + if (rv == NS_OK) { + if (PR_TRUE==gsDebugNT) + printf("%p: found a block pframe %p in a cell, skipping it.\n", aReflowState.frame, block); + skipThisBlock = PR_TRUE; } } } diff --git a/layout/tables/BasicTableLayoutStrategy.cpp b/layout/tables/BasicTableLayoutStrategy.cpp index 59236994bfde..94229dd2786a 100644 --- a/layout/tables/BasicTableLayoutStrategy.cpp +++ b/layout/tables/BasicTableLayoutStrategy.cpp @@ -2035,26 +2035,19 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( const nsHTMLReflowSt } // second, fix up tables where column width attributes give us a table that is too wide or too narrow - // IFF the table is NOT (auto-width && all columns have fixed width) - PRInt32 numFixedColumns=0; - PRInt32 *fixedColumns=nsnull; - mTableFrame->GetColumnsByType(eStyleUnit_Coord, numFixedColumns, fixedColumns); - if (!((PR_TRUE==aTableIsAutoWidth) && (numFixedColumns==mNumCols))) - { - nscoord computedWidth=0; - for (PRInt32 i=0; iGetColumnWidth(i) + colInset; - } - if (computedWidthaMaxWidth) - { // then shrink the table width because its too wide - AdjustTableThatIsTooWide(computedWidth, aMaxWidth, PR_FALSE); - } + nscoord computedWidth=0; + for (PRInt32 i=0; iGetColumnWidth(i) + colInset; + } + if (computedWidthaMaxWidth) + { // then shrink the table width because its too wide + AdjustTableThatIsTooWide(computedWidth, aMaxWidth, PR_FALSE); } diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 3e654786f56e..c34b264b5590 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -3602,28 +3602,6 @@ PRBool nsTableFrame::IsNested(const nsHTMLReflowState& aReflowState, nsStylePosi return result; } -static PRBool -IsPseudoFrame(nsIFrame* aFrame) -{ - nsIContent* content; - nsIFrame* parentFrame; - PRBool result = PR_FALSE; - - aFrame->GetContent(content); - aFrame->GetGeometricParent(parentFrame); - if (nsnull != parentFrame) { - nsIContent* parentContent; - - parentFrame->GetContent(parentContent); - if (parentContent == content) { - result = PR_TRUE; - } - NS_RELEASE(parentContent); - } - - NS_RELEASE(content); - return result; -} /* helper method for getting the width of the table's containing block */ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowState) @@ -3645,22 +3623,18 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta if (NS_OK==rv) { // we found a block, see if it's really a table cell (which means we're a nested table) PRBool skipThisBlock=PR_FALSE; - // XXX FIX ME... - if (IsPseudoFrame(block)) + const nsReflowState* parentRS = rs->parentReflowState; + if (nsnull!=parentRS) { - const nsReflowState* parentRS = rs->parentReflowState; + parentRS = parentRS->parentReflowState; if (nsnull!=parentRS) { - parentRS = parentRS->parentReflowState; - if (nsnull!=parentRS) - { - nsIFrame* cell = nsnull; - rv = parentRS->frame->QueryInterface(kTableCellFrameCID, (void**) &cell); - if (rv == NS_OK) { - if (PR_TRUE==gsDebugNT) - printf("%p: found a block pframe %p in a cell, skipping it.\n", aReflowState.frame, block); - skipThisBlock = PR_TRUE; - } + nsIFrame* cell = nsnull; + rv = parentRS->frame->QueryInterface(kTableCellFrameCID, (void**) &cell); + if (rv == NS_OK) { + if (PR_TRUE==gsDebugNT) + printf("%p: found a block pframe %p in a cell, skipping it.\n", aReflowState.frame, block); + skipThisBlock = PR_TRUE; } } }