From ddf9bac57774ce6cfec491b749e6272870298066 Mon Sep 17 00:00:00 2001 From: "karnaze@netscape.com" Date: Thu, 5 Oct 2000 23:49:25 +0000 Subject: [PATCH] bug 49490 - turn off collapsing borders, rules. Fix reflow state to not account for vertical borders or padding on rows. a=buster, r=dcone. --- layout/generic/nsHTMLReflowState.cpp | 8 +++++--- layout/html/base/src/nsHTMLReflowState.cpp | 8 +++++--- layout/html/table/src/nsTableCellFrame.cpp | 5 +++++ layout/html/table/src/nsTableFrame.cpp | 4 +++- layout/tables/nsTableCellFrame.cpp | 5 +++++ layout/tables/nsTableFrame.cpp | 4 +++- 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/layout/generic/nsHTMLReflowState.cpp b/layout/generic/nsHTMLReflowState.cpp index ada34bc3d3a7..d0b575b04b39 100644 --- a/layout/generic/nsHTMLReflowState.cpp +++ b/layout/generic/nsHTMLReflowState.cpp @@ -1708,10 +1708,12 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext, } else if (NS_CSS_FRAME_TYPE_INTERNAL_TABLE == mFrameType) { // Internal table elements. The rules vary depending on the type. // Calculate the computed width + PRBool rowOrRowGroup = PR_FALSE; if ((NS_STYLE_DISPLAY_TABLE_ROW == mStyleDisplay->mDisplay) || (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == mStyleDisplay->mDisplay)) { // 'width' property doesn't apply to table rows and row groups widthUnit = eStyleUnit_Auto; + rowOrRowGroup = PR_TRUE; } if (eStyleUnit_Inherit == widthUnit) { @@ -1719,9 +1721,9 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext, } else if (eStyleUnit_Auto == widthUnit) { mComputedWidth = availableWidth; - if (mComputedWidth != NS_UNCONSTRAINEDSIZE) { - // Internal table elements don't have margins, but they have border - // and padding + if ((mComputedWidth != NS_UNCONSTRAINEDSIZE) && !rowOrRowGroup){ + // Internal table elements don't have margins. Only tables and + // cells have border and padding mComputedWidth -= mComputedBorderPadding.left + mComputedBorderPadding.right; } diff --git a/layout/html/base/src/nsHTMLReflowState.cpp b/layout/html/base/src/nsHTMLReflowState.cpp index ada34bc3d3a7..d0b575b04b39 100644 --- a/layout/html/base/src/nsHTMLReflowState.cpp +++ b/layout/html/base/src/nsHTMLReflowState.cpp @@ -1708,10 +1708,12 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext, } else if (NS_CSS_FRAME_TYPE_INTERNAL_TABLE == mFrameType) { // Internal table elements. The rules vary depending on the type. // Calculate the computed width + PRBool rowOrRowGroup = PR_FALSE; if ((NS_STYLE_DISPLAY_TABLE_ROW == mStyleDisplay->mDisplay) || (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == mStyleDisplay->mDisplay)) { // 'width' property doesn't apply to table rows and row groups widthUnit = eStyleUnit_Auto; + rowOrRowGroup = PR_TRUE; } if (eStyleUnit_Inherit == widthUnit) { @@ -1719,9 +1721,9 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext, } else if (eStyleUnit_Auto == widthUnit) { mComputedWidth = availableWidth; - if (mComputedWidth != NS_UNCONSTRAINEDSIZE) { - // Internal table elements don't have margins, but they have border - // and padding + if ((mComputedWidth != NS_UNCONSTRAINEDSIZE) && !rowOrRowGroup){ + // Internal table elements don't have margins. Only tables and + // cells have border and padding mComputedWidth -= mComputedBorderPadding.left + mComputedBorderPadding.right; } diff --git a/layout/html/table/src/nsTableCellFrame.cpp b/layout/html/table/src/nsTableCellFrame.cpp index 0bd87d59c294..d37cb8db708e 100644 --- a/layout/html/table/src/nsTableCellFrame.cpp +++ b/layout/html/table/src/nsTableCellFrame.cpp @@ -937,6 +937,10 @@ void nsTableCellFrame::MapHTMLBorderStyle(nsIPresContext* aPresContext, nsTableFrame* aTableFrame) { //adjust the border style based on the table rules attribute + + /* The RULES code below has been disabled because collapsing borders have been disabled + and RULES depend on collapsing borders + const nsStyleTable* tableStyle; aTableFrame->GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle); @@ -964,6 +968,7 @@ void nsTableCellFrame::MapHTMLBorderStyle(nsIPresContext* aPresContext, // "GROUPS" will be handled in nsTableFrame::ProcessGroupRules break; } + */ } diff --git a/layout/html/table/src/nsTableFrame.cpp b/layout/html/table/src/nsTableFrame.cpp index 2dc4419c94ef..fb4d6d0b3be9 100644 --- a/layout/html/table/src/nsTableFrame.cpp +++ b/layout/html/table/src/nsTableFrame.cpp @@ -4034,9 +4034,11 @@ void nsTableFrame::GetTableBorderForRowGroup(nsTableRowGroupFrame* aRowGroupFram PRUint8 nsTableFrame::GetBorderCollapseStyle() { + /* the following has been commented out to turn off collapsing borders const nsStyleTable* tableStyle; GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle); - return tableStyle->mBorderCollapse; + return tableStyle->mBorderCollapse;*/ + return NS_STYLE_BORDER_SEPARATE; } diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index 0bd87d59c294..d37cb8db708e 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -937,6 +937,10 @@ void nsTableCellFrame::MapHTMLBorderStyle(nsIPresContext* aPresContext, nsTableFrame* aTableFrame) { //adjust the border style based on the table rules attribute + + /* The RULES code below has been disabled because collapsing borders have been disabled + and RULES depend on collapsing borders + const nsStyleTable* tableStyle; aTableFrame->GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle); @@ -964,6 +968,7 @@ void nsTableCellFrame::MapHTMLBorderStyle(nsIPresContext* aPresContext, // "GROUPS" will be handled in nsTableFrame::ProcessGroupRules break; } + */ } diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 2dc4419c94ef..fb4d6d0b3be9 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -4034,9 +4034,11 @@ void nsTableFrame::GetTableBorderForRowGroup(nsTableRowGroupFrame* aRowGroupFram PRUint8 nsTableFrame::GetBorderCollapseStyle() { + /* the following has been commented out to turn off collapsing borders const nsStyleTable* tableStyle; GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle); - return tableStyle->mBorderCollapse; + return tableStyle->mBorderCollapse;*/ + return NS_STYLE_BORDER_SEPARATE; }