mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
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.
This commit is contained in:
parent
c7dbb849e8
commit
95dc9f956f
@ -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; i<mNumCols; i++) {
|
||||
computedWidth += mTableFrame->GetColumnWidth(i) + colInset;
|
||||
}
|
||||
if (computedWidth<aMaxWidth)
|
||||
{ // then widen the table because it's too narrow
|
||||
// do not widen auto-width tables, they shrinkwrap to their content's width
|
||||
if (PR_FALSE==aTableIsAutoWidth)
|
||||
AdjustTableThatIsTooNarrow(computedWidth, aMaxWidth);
|
||||
}
|
||||
else if (computedWidth>aMaxWidth)
|
||||
{ // then shrink the table width because its too wide
|
||||
AdjustTableThatIsTooWide(computedWidth, aMaxWidth, PR_FALSE);
|
||||
}
|
||||
nscoord computedWidth=0;
|
||||
for (PRInt32 i=0; i<mNumCols; i++) {
|
||||
computedWidth += mTableFrame->GetColumnWidth(i) + colInset;
|
||||
}
|
||||
if (computedWidth<aMaxWidth)
|
||||
{ // then widen the table because it's too narrow
|
||||
// do not widen auto-width tables, they shrinkwrap to their content's width
|
||||
if (PR_FALSE==aTableIsAutoWidth)
|
||||
AdjustTableThatIsTooNarrow(computedWidth, aMaxWidth);
|
||||
}
|
||||
else if (computedWidth>aMaxWidth)
|
||||
{ // then shrink the table width because its too wide
|
||||
AdjustTableThatIsTooWide(computedWidth, aMaxWidth, PR_FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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; i<mNumCols; i++) {
|
||||
computedWidth += mTableFrame->GetColumnWidth(i) + colInset;
|
||||
}
|
||||
if (computedWidth<aMaxWidth)
|
||||
{ // then widen the table because it's too narrow
|
||||
// do not widen auto-width tables, they shrinkwrap to their content's width
|
||||
if (PR_FALSE==aTableIsAutoWidth)
|
||||
AdjustTableThatIsTooNarrow(computedWidth, aMaxWidth);
|
||||
}
|
||||
else if (computedWidth>aMaxWidth)
|
||||
{ // then shrink the table width because its too wide
|
||||
AdjustTableThatIsTooWide(computedWidth, aMaxWidth, PR_FALSE);
|
||||
}
|
||||
nscoord computedWidth=0;
|
||||
for (PRInt32 i=0; i<mNumCols; i++) {
|
||||
computedWidth += mTableFrame->GetColumnWidth(i) + colInset;
|
||||
}
|
||||
if (computedWidth<aMaxWidth)
|
||||
{ // then widen the table because it's too narrow
|
||||
// do not widen auto-width tables, they shrinkwrap to their content's width
|
||||
if (PR_FALSE==aTableIsAutoWidth)
|
||||
AdjustTableThatIsTooNarrow(computedWidth, aMaxWidth);
|
||||
}
|
||||
else if (computedWidth>aMaxWidth)
|
||||
{ // then shrink the table width because its too wide
|
||||
AdjustTableThatIsTooWide(computedWidth, aMaxWidth, PR_FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user