From d35a765d2c75fcb91041f4be17f7ff3b3a7ad0bb Mon Sep 17 00:00:00 2001 From: "buster%netscape.com" Date: Wed, 16 Dec 1998 06:33:15 +0000 Subject: [PATCH] clean up, removed some obsolete methods --- layout/html/table/src/nsTableCellFrame.cpp | 215 --------------------- layout/html/table/src/nsTableCellFrame.h | 24 +-- layout/tables/nsTableCellFrame.cpp | 215 --------------------- layout/tables/nsTableCellFrame.h | 24 +-- 4 files changed, 2 insertions(+), 476 deletions(-) diff --git a/layout/html/table/src/nsTableCellFrame.cpp b/layout/html/table/src/nsTableCellFrame.cpp index 7aaa57dd5535..3e6a773072e9 100644 --- a/layout/html/table/src/nsTableCellFrame.cpp +++ b/layout/html/table/src/nsTableCellFrame.cpp @@ -801,221 +801,6 @@ PRUint8 nsTableCellFrame::GetOpposingEdge(PRUint8 aEdge) } -/* -* -* Determine border style for two cells. -* - 1.If the adjacent elements are of the same type, the wider of the two borders is used. - "Wider" takes into account the border-style of 'none', so a "1px solid" border - will take precedence over a "20px none" border. - - 2.If there are two or more with the same width, but different style, - then the one with a style near the start of the following list will be drawn: - - 'blank', 'double', 'solid', 'dashed', 'dotted', 'ridge', 'groove', 'none' - - 3.If the borders are of the same width, the border on the element occurring first is used. - - First is defined as aStyle for this method. - - NOTE: This assumes left-to-right, top-to-bottom bias. -- gpk - -* -*/ - - -nsIFrame* nsTableCellFrame::CompareCellBorders(nsIFrame* aFrame1, - PRUint8 aEdge1, - nsIFrame* aFrame2, - PRUint8 aEdge2) -{ - PRInt32 width1 = GetBorderWidth(aFrame1,aEdge1); - PRInt32 width2 = GetBorderWidth(aFrame2,aEdge2); - - nsIFrame* result = nsnull; - - if (width1 > width2) - result = aFrame1; - else if (width1 < width2) - result = aFrame2; - else // width1 == width2 - { - const nsStyleSpacing* border1; - const nsStyleSpacing* border2; - aFrame1->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)border1); - aFrame2->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)border2); - if (border1->GetBorderStyle(aEdge1) >= border2->GetBorderStyle(aEdge2)) - result = aFrame1; - else - result = aFrame2; - } - return result; -} - - -/** - * Given a List of cell layout data, compare the edges to see which has the - * border with the highest precidence. - * - **/ - -nsIFrame* nsTableCellFrame::FindHighestPrecedentBorder(nsVoidArray* aList, - PRUint8 aEdge) -{ - nsIFrame* result = nsnull; - PRInt32 index = 0; - PRInt32 count = 0; - - - NS_ASSERTION(aList,"a List must be valid"); - count = aList->Count(); - if (count) - { - nsIFrame* frame1; - nsIFrame* frame2; - - frame1 = (nsIFrame*)(aList->ElementAt(index++)); - while (index < count) - { - frame2 = (nsIFrame*)(aList->ElementAt(index++)); - if (GetMargin(frame2,aEdge) == 0) { - frame1 = CompareCellBorders(frame1, aEdge, frame2, aEdge); - } - } - if ((nsnull != frame1) && (GetMargin(frame1, aEdge) != 0)) - result = frame1; - } - return result; -} - - - - -nsIFrame* nsTableCellFrame::FindInnerBorder(nsVoidArray* aList, PRUint8 aEdge) -{ - nsIFrame* result = nsnull; - PRUint8 opposite = GetOpposingEdge(aEdge); - - if (GetMargin(this, aEdge) == 0) - { - nsIFrame* altFrame = FindHighestPrecedentBorder(aList,opposite); - if (nsnull != altFrame) - result = CompareCellBorders(this, aEdge, altFrame, opposite); - else - result = this; - } - - return result; -} - - -/* -* -* FindRelevantBorder recursively searches up the frame hierarchy for the border -* style that is applicable to the cell. If at any point the frame has a margin -* or the parent frame has padding, then the outer frame for this object takes -* presendence over the inner frame. - -1.Borders on 'table' elements take precedence over borders on any other table elements. -2.Borders on 'row-groups' take precedence over borders on 'rows', - and likewise borders on 'column-groups' take precedence over borders on 'columns'. -3.Borders on any other type of table element take precedence over 'table-cell' elements. - -* -* NOTE: This method assumes that the table cell potentially shares a border. -* It should not be called for internal cells -* -* NOTE: COLUMNS AND COLGROUPS NEED TO BE FIGURED INTO THE ALGORITHM -- GPK!!! -* -* -*/ -nsIFrame* nsTableCellFrame::FindOuterBorder( nsTableFrame* aTableFrame, - PRUint8 aEdge) -{ - nsIFrame* frame = this; // By default, return our frame - PRBool done = PR_FALSE; - - - // The table frame is the outer most frame we test against - while (done == PR_FALSE) - { - done = PR_TRUE; // where done unless the frame's margin is zero - // and the parent's padding is zero - - nscoord margin = GetMargin(frame,aEdge); - - // if the margin for this style is zero then check to see if the paddding - // for the parent frame is also zero - if (margin == 0) - { - nsIFrame* parentFrame; - - frame->GetGeometricParent(parentFrame); - - // if the padding for the parent style is zero just - // recursively call this routine - PRInt32 padding = GetPadding(parentFrame,aEdge); - if ((nsnull != parentFrame) && (padding == 0)) - { - frame = parentFrame; - // If this frame represents the table frame then - // the table style is used - done = PRBool(frame != (nsIFrame*)aTableFrame); - continue; - } - - } - } - return frame; -} - - - -/* - - Border Resolution - 1.Borders on 'table' elements take precedence over borders on any other table elements. - 2.Borders on 'row-groups' take precedence over borders on 'rows', and likewise borders on 'column-groups' take - precedence over borders on 'columns'. - 3.Borders on any other type of table element take precedence over 'table-cell' elements. - 4.If the adjacent elements are of the same type, the wider of the two borders is used. "Wider" takes into account - the border-style of 'none', so a "1px solid" border will take precedence over a "20px none" border. - 5.If the borders are of the same width, the border on the element occurring first is used. - - - How to compare - 1.Those of the one or two cells that have an edge here. - Less than two can occur at the edge of the table, but also - at the edges of "holes" (unoccupied grid cells). - 2.Those of the columns that have an edge here. - 3.Those of the column groups that have an edge here. - 4.Those of the rows that have an edge here. - 5.Those of the row groups that have an edge here. - 6.Those of the table, if this is the edge of the table. - -* -* @param aIsFirst -- TRUE if this is the first cell in the row -* @param aIsLast -- TRUE if this is the last cell in the row -* @param aIsTop -- TRUE if this is the top cell in the column -* @param aIsBottom -- TRUE if this is the last cell in the column -*/ - -nsIFrame* nsTableCellFrame::FindBorderFrame(nsTableFrame* aTableFrame, - nsVoidArray* aList, - PRUint8 aEdge) -{ - nsIFrame* frame = nsnull; - - if (aList && aList->Count() == 0) - frame = FindOuterBorder(aTableFrame, aEdge); - else - frame = FindInnerBorder(aList, aEdge); - - if (! frame) - frame = this; - - return frame; -} /** diff --git a/layout/html/table/src/nsTableCellFrame.h b/layout/html/table/src/nsTableCellFrame.h index c6ebf792dcb9..6bd3e74f2880 100644 --- a/layout/html/table/src/nsTableCellFrame.h +++ b/layout/html/table/src/nsTableCellFrame.h @@ -141,27 +141,6 @@ private: PRUint8 GetOpposingEdge(PRUint8 aEdge); - nsIFrame* CompareCellBorders(nsIFrame* aFrame1, - PRUint8 aEdge1, - nsIFrame* aFrame2, - PRUint8 aEdge2); - - - nsIFrame* FindHighestPrecedentBorder(nsVoidArray* aList, - PRUint8 aEdge); - - - - nsIFrame* FindInnerBorder( nsVoidArray* aList, - PRUint8 aEdge); - - nsIFrame* FindOuterBorder( nsTableFrame* aTableFrame, - PRUint8 aEdge); - - nsIFrame* FindBorderFrame(nsTableFrame* aTableFrame, - nsVoidArray* aCellList, - PRUint8 aEdge); - void CalculateBorders(nsTableFrame* aTableFrame, nsVoidArray* aBoundaryCells[4]); @@ -273,8 +252,7 @@ inline void nsTableCellFrame::SetPass1MaxElementSize(const nsSize & aMaxElementS inline void nsTableCellFrame::CalculateBorders(nsTableFrame* aTableFrame, nsVoidArray* aBoundaryCells[4]) { - for (PRInt32 edge = 0; edge < 4; edge++) - mBorderFrame[edge] = FindBorderFrame(aTableFrame, aBoundaryCells[edge], edge); + } inline NS_METHOD nsTableCellFrame::GetMargin(nsMargin& aMargin) diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index 7aaa57dd5535..3e6a773072e9 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -801,221 +801,6 @@ PRUint8 nsTableCellFrame::GetOpposingEdge(PRUint8 aEdge) } -/* -* -* Determine border style for two cells. -* - 1.If the adjacent elements are of the same type, the wider of the two borders is used. - "Wider" takes into account the border-style of 'none', so a "1px solid" border - will take precedence over a "20px none" border. - - 2.If there are two or more with the same width, but different style, - then the one with a style near the start of the following list will be drawn: - - 'blank', 'double', 'solid', 'dashed', 'dotted', 'ridge', 'groove', 'none' - - 3.If the borders are of the same width, the border on the element occurring first is used. - - First is defined as aStyle for this method. - - NOTE: This assumes left-to-right, top-to-bottom bias. -- gpk - -* -*/ - - -nsIFrame* nsTableCellFrame::CompareCellBorders(nsIFrame* aFrame1, - PRUint8 aEdge1, - nsIFrame* aFrame2, - PRUint8 aEdge2) -{ - PRInt32 width1 = GetBorderWidth(aFrame1,aEdge1); - PRInt32 width2 = GetBorderWidth(aFrame2,aEdge2); - - nsIFrame* result = nsnull; - - if (width1 > width2) - result = aFrame1; - else if (width1 < width2) - result = aFrame2; - else // width1 == width2 - { - const nsStyleSpacing* border1; - const nsStyleSpacing* border2; - aFrame1->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)border1); - aFrame2->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)border2); - if (border1->GetBorderStyle(aEdge1) >= border2->GetBorderStyle(aEdge2)) - result = aFrame1; - else - result = aFrame2; - } - return result; -} - - -/** - * Given a List of cell layout data, compare the edges to see which has the - * border with the highest precidence. - * - **/ - -nsIFrame* nsTableCellFrame::FindHighestPrecedentBorder(nsVoidArray* aList, - PRUint8 aEdge) -{ - nsIFrame* result = nsnull; - PRInt32 index = 0; - PRInt32 count = 0; - - - NS_ASSERTION(aList,"a List must be valid"); - count = aList->Count(); - if (count) - { - nsIFrame* frame1; - nsIFrame* frame2; - - frame1 = (nsIFrame*)(aList->ElementAt(index++)); - while (index < count) - { - frame2 = (nsIFrame*)(aList->ElementAt(index++)); - if (GetMargin(frame2,aEdge) == 0) { - frame1 = CompareCellBorders(frame1, aEdge, frame2, aEdge); - } - } - if ((nsnull != frame1) && (GetMargin(frame1, aEdge) != 0)) - result = frame1; - } - return result; -} - - - - -nsIFrame* nsTableCellFrame::FindInnerBorder(nsVoidArray* aList, PRUint8 aEdge) -{ - nsIFrame* result = nsnull; - PRUint8 opposite = GetOpposingEdge(aEdge); - - if (GetMargin(this, aEdge) == 0) - { - nsIFrame* altFrame = FindHighestPrecedentBorder(aList,opposite); - if (nsnull != altFrame) - result = CompareCellBorders(this, aEdge, altFrame, opposite); - else - result = this; - } - - return result; -} - - -/* -* -* FindRelevantBorder recursively searches up the frame hierarchy for the border -* style that is applicable to the cell. If at any point the frame has a margin -* or the parent frame has padding, then the outer frame for this object takes -* presendence over the inner frame. - -1.Borders on 'table' elements take precedence over borders on any other table elements. -2.Borders on 'row-groups' take precedence over borders on 'rows', - and likewise borders on 'column-groups' take precedence over borders on 'columns'. -3.Borders on any other type of table element take precedence over 'table-cell' elements. - -* -* NOTE: This method assumes that the table cell potentially shares a border. -* It should not be called for internal cells -* -* NOTE: COLUMNS AND COLGROUPS NEED TO BE FIGURED INTO THE ALGORITHM -- GPK!!! -* -* -*/ -nsIFrame* nsTableCellFrame::FindOuterBorder( nsTableFrame* aTableFrame, - PRUint8 aEdge) -{ - nsIFrame* frame = this; // By default, return our frame - PRBool done = PR_FALSE; - - - // The table frame is the outer most frame we test against - while (done == PR_FALSE) - { - done = PR_TRUE; // where done unless the frame's margin is zero - // and the parent's padding is zero - - nscoord margin = GetMargin(frame,aEdge); - - // if the margin for this style is zero then check to see if the paddding - // for the parent frame is also zero - if (margin == 0) - { - nsIFrame* parentFrame; - - frame->GetGeometricParent(parentFrame); - - // if the padding for the parent style is zero just - // recursively call this routine - PRInt32 padding = GetPadding(parentFrame,aEdge); - if ((nsnull != parentFrame) && (padding == 0)) - { - frame = parentFrame; - // If this frame represents the table frame then - // the table style is used - done = PRBool(frame != (nsIFrame*)aTableFrame); - continue; - } - - } - } - return frame; -} - - - -/* - - Border Resolution - 1.Borders on 'table' elements take precedence over borders on any other table elements. - 2.Borders on 'row-groups' take precedence over borders on 'rows', and likewise borders on 'column-groups' take - precedence over borders on 'columns'. - 3.Borders on any other type of table element take precedence over 'table-cell' elements. - 4.If the adjacent elements are of the same type, the wider of the two borders is used. "Wider" takes into account - the border-style of 'none', so a "1px solid" border will take precedence over a "20px none" border. - 5.If the borders are of the same width, the border on the element occurring first is used. - - - How to compare - 1.Those of the one or two cells that have an edge here. - Less than two can occur at the edge of the table, but also - at the edges of "holes" (unoccupied grid cells). - 2.Those of the columns that have an edge here. - 3.Those of the column groups that have an edge here. - 4.Those of the rows that have an edge here. - 5.Those of the row groups that have an edge here. - 6.Those of the table, if this is the edge of the table. - -* -* @param aIsFirst -- TRUE if this is the first cell in the row -* @param aIsLast -- TRUE if this is the last cell in the row -* @param aIsTop -- TRUE if this is the top cell in the column -* @param aIsBottom -- TRUE if this is the last cell in the column -*/ - -nsIFrame* nsTableCellFrame::FindBorderFrame(nsTableFrame* aTableFrame, - nsVoidArray* aList, - PRUint8 aEdge) -{ - nsIFrame* frame = nsnull; - - if (aList && aList->Count() == 0) - frame = FindOuterBorder(aTableFrame, aEdge); - else - frame = FindInnerBorder(aList, aEdge); - - if (! frame) - frame = this; - - return frame; -} /** diff --git a/layout/tables/nsTableCellFrame.h b/layout/tables/nsTableCellFrame.h index c6ebf792dcb9..6bd3e74f2880 100644 --- a/layout/tables/nsTableCellFrame.h +++ b/layout/tables/nsTableCellFrame.h @@ -141,27 +141,6 @@ private: PRUint8 GetOpposingEdge(PRUint8 aEdge); - nsIFrame* CompareCellBorders(nsIFrame* aFrame1, - PRUint8 aEdge1, - nsIFrame* aFrame2, - PRUint8 aEdge2); - - - nsIFrame* FindHighestPrecedentBorder(nsVoidArray* aList, - PRUint8 aEdge); - - - - nsIFrame* FindInnerBorder( nsVoidArray* aList, - PRUint8 aEdge); - - nsIFrame* FindOuterBorder( nsTableFrame* aTableFrame, - PRUint8 aEdge); - - nsIFrame* FindBorderFrame(nsTableFrame* aTableFrame, - nsVoidArray* aCellList, - PRUint8 aEdge); - void CalculateBorders(nsTableFrame* aTableFrame, nsVoidArray* aBoundaryCells[4]); @@ -273,8 +252,7 @@ inline void nsTableCellFrame::SetPass1MaxElementSize(const nsSize & aMaxElementS inline void nsTableCellFrame::CalculateBorders(nsTableFrame* aTableFrame, nsVoidArray* aBoundaryCells[4]) { - for (PRInt32 edge = 0; edge < 4; edge++) - mBorderFrame[edge] = FindBorderFrame(aTableFrame, aBoundaryCells[edge], edge); + } inline NS_METHOD nsTableCellFrame::GetMargin(nsMargin& aMargin)