From cbe75d082ce592dd0d35cd57e7b4dfde8135660f 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. git-svn-id: svn://10.0.0.236/trunk@14095 18797224-902f-48f8-a5cc-f745e15eee43 --- .../table/src/BasicTableLayoutStrategy.cpp | 33 ++++++-------- .../layout/html/table/src/nsTableFrame.cpp | 44 ++++--------------- .../tables/BasicTableLayoutStrategy.cpp | 33 ++++++-------- mozilla/layout/tables/nsTableFrame.cpp | 44 ++++--------------- 4 files changed, 44 insertions(+), 110 deletions(-) diff --git a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp index 59236994bfd..94229dd2786 100644 --- a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp +++ b/mozilla/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/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index 3e654786f56..c34b264b559 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/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/mozilla/layout/tables/BasicTableLayoutStrategy.cpp b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp index 59236994bfd..94229dd2786 100644 --- a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp +++ b/mozilla/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/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index 3e654786f56..c34b264b559 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/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; } } }