Made table frame construction flexible enough to allow arbitrary content to be mapped

to arbitrary table related display types.
This commit is contained in:
karnaze%netscape.com 1999-01-30 15:52:19 +00:00
Родитель 87e2ee2cc6
Коммит 6256ccca5b
20 изменённых файлов: 2749 добавлений и 887 удалений

Просмотреть файл

@ -227,8 +227,10 @@ nsIAtom* nsHTMLAtoms::suppress;
nsIAtom* nsHTMLAtoms::tabindex;
nsIAtom* nsHTMLAtoms::table;
nsIAtom* nsHTMLAtoms::tablePseudo;
nsIAtom* nsHTMLAtoms::tableCellPseudo;
nsIAtom* nsHTMLAtoms::tableColGroupPseudo;
nsIAtom* nsHTMLAtoms::tableColPseudo;
nsIAtom* nsHTMLAtoms::tableOuterPseudo;
nsIAtom* nsHTMLAtoms::tableRowGroupPseudo;
nsIAtom* nsHTMLAtoms::tableRowPseudo;
nsIAtom* nsHTMLAtoms::tabstop;
@ -477,8 +479,10 @@ void nsHTMLAtoms::AddrefAtoms()
tabindex = NS_NewAtom("TABINDEX");
table = NS_NewAtom("TABLE");
tablePseudo = NS_NewAtom(":TABLE");
tableCellPseudo = NS_NewAtom(":TABLE-CELL");
tableColGroupPseudo = NS_NewAtom(":TABLE-COLUMN-GROUP");
tableColPseudo = NS_NewAtom(":TABLE-COLUMN");
tableOuterPseudo = NS_NewAtom(":TABLE-OUTER");
tableRowGroupPseudo = NS_NewAtom(":TABLE-ROW-GROUP");
tableRowPseudo = NS_NewAtom(":TABLE-ROW");
tabstop = NS_NewAtom("TABSTOP");
@ -718,8 +722,10 @@ void nsHTMLAtoms::ReleaseAtoms()
NS_RELEASE(suppress);
NS_RELEASE(table);
NS_RELEASE(tablePseudo);
NS_RELEASE(tableCellPseudo);
NS_RELEASE(tableColGroupPseudo);
NS_RELEASE(tableColPseudo);
NS_RELEASE(tableOuterPseudo);
NS_RELEASE(tableRowGroupPseudo);
NS_RELEASE(tableRowPseudo);
NS_RELEASE(tabstop);

Просмотреть файл

@ -263,8 +263,10 @@ public:
static nsIAtom* tabindex;
static nsIAtom* table;
static nsIAtom* tablePseudo;
static nsIAtom* tableCellPseudo;
static nsIAtom* tableColGroupPseudo;
static nsIAtom* tableColPseudo;
static nsIAtom* tableOuterPseudo;
static nsIAtom* tableRowGroupPseudo;
static nsIAtom* tableRowPseudo;
static nsIAtom* tabstop;

Просмотреть файл

@ -104,8 +104,9 @@ protected:
GenericElementCollection* mCells;
};
#ifdef XXX_debugging
static
void TempList(nsIDOMHTMLTableElement* aTable) {
void DebugList(nsIDOMHTMLTableElement* aTable) {
nsIHTMLContent* content = nsnull;
nsresult result = aTable->QueryInterface(kIHTMLContentIID, (void**)&content);
if (NS_SUCCEEDED(result) && (nsnull != content)) {
@ -130,6 +131,7 @@ void TempList(nsIDOMHTMLTableElement* aTable) {
NS_RELEASE(content);
}
}
#endif
nsresult
NS_NewHTMLTableRowElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -263,8 +263,10 @@ public:
static nsIAtom* tabindex;
static nsIAtom* table;
static nsIAtom* tablePseudo;
static nsIAtom* tableCellPseudo;
static nsIAtom* tableColGroupPseudo;
static nsIAtom* tableColPseudo;
static nsIAtom* tableOuterPseudo;
static nsIAtom* tableRowGroupPseudo;
static nsIAtom* tableRowPseudo;
static nsIAtom* tabstop;

Просмотреть файл

@ -227,8 +227,10 @@ nsIAtom* nsHTMLAtoms::suppress;
nsIAtom* nsHTMLAtoms::tabindex;
nsIAtom* nsHTMLAtoms::table;
nsIAtom* nsHTMLAtoms::tablePseudo;
nsIAtom* nsHTMLAtoms::tableCellPseudo;
nsIAtom* nsHTMLAtoms::tableColGroupPseudo;
nsIAtom* nsHTMLAtoms::tableColPseudo;
nsIAtom* nsHTMLAtoms::tableOuterPseudo;
nsIAtom* nsHTMLAtoms::tableRowGroupPseudo;
nsIAtom* nsHTMLAtoms::tableRowPseudo;
nsIAtom* nsHTMLAtoms::tabstop;
@ -477,8 +479,10 @@ void nsHTMLAtoms::AddrefAtoms()
tabindex = NS_NewAtom("TABINDEX");
table = NS_NewAtom("TABLE");
tablePseudo = NS_NewAtom(":TABLE");
tableCellPseudo = NS_NewAtom(":TABLE-CELL");
tableColGroupPseudo = NS_NewAtom(":TABLE-COLUMN-GROUP");
tableColPseudo = NS_NewAtom(":TABLE-COLUMN");
tableOuterPseudo = NS_NewAtom(":TABLE-OUTER");
tableRowGroupPseudo = NS_NewAtom(":TABLE-ROW-GROUP");
tableRowPseudo = NS_NewAtom(":TABLE-ROW");
tabstop = NS_NewAtom("TABSTOP");
@ -718,8 +722,10 @@ void nsHTMLAtoms::ReleaseAtoms()
NS_RELEASE(suppress);
NS_RELEASE(table);
NS_RELEASE(tablePseudo);
NS_RELEASE(tableCellPseudo);
NS_RELEASE(tableColGroupPseudo);
NS_RELEASE(tableColPseudo);
NS_RELEASE(tableOuterPseudo);
NS_RELEASE(tableRowGroupPseudo);
NS_RELEASE(tableRowPseudo);
NS_RELEASE(tabstop);

Просмотреть файл

@ -227,8 +227,10 @@ nsIAtom* nsHTMLAtoms::suppress;
nsIAtom* nsHTMLAtoms::tabindex;
nsIAtom* nsHTMLAtoms::table;
nsIAtom* nsHTMLAtoms::tablePseudo;
nsIAtom* nsHTMLAtoms::tableCellPseudo;
nsIAtom* nsHTMLAtoms::tableColGroupPseudo;
nsIAtom* nsHTMLAtoms::tableColPseudo;
nsIAtom* nsHTMLAtoms::tableOuterPseudo;
nsIAtom* nsHTMLAtoms::tableRowGroupPseudo;
nsIAtom* nsHTMLAtoms::tableRowPseudo;
nsIAtom* nsHTMLAtoms::tabstop;
@ -477,8 +479,10 @@ void nsHTMLAtoms::AddrefAtoms()
tabindex = NS_NewAtom("TABINDEX");
table = NS_NewAtom("TABLE");
tablePseudo = NS_NewAtom(":TABLE");
tableCellPseudo = NS_NewAtom(":TABLE-CELL");
tableColGroupPseudo = NS_NewAtom(":TABLE-COLUMN-GROUP");
tableColPseudo = NS_NewAtom(":TABLE-COLUMN");
tableOuterPseudo = NS_NewAtom(":TABLE-OUTER");
tableRowGroupPseudo = NS_NewAtom(":TABLE-ROW-GROUP");
tableRowPseudo = NS_NewAtom(":TABLE-ROW");
tabstop = NS_NewAtom("TABSTOP");
@ -718,8 +722,10 @@ void nsHTMLAtoms::ReleaseAtoms()
NS_RELEASE(suppress);
NS_RELEASE(table);
NS_RELEASE(tablePseudo);
NS_RELEASE(tableCellPseudo);
NS_RELEASE(tableColGroupPseudo);
NS_RELEASE(tableColPseudo);
NS_RELEASE(tableOuterPseudo);
NS_RELEASE(tableRowGroupPseudo);
NS_RELEASE(tableRowPseudo);
NS_RELEASE(tabstop);

Просмотреть файл

@ -263,8 +263,10 @@ public:
static nsIAtom* tabindex;
static nsIAtom* table;
static nsIAtom* tablePseudo;
static nsIAtom* tableCellPseudo;
static nsIAtom* tableColGroupPseudo;
static nsIAtom* tableColPseudo;
static nsIAtom* tableOuterPseudo;
static nsIAtom* tableRowGroupPseudo;
static nsIAtom* tableRowPseudo;
static nsIAtom* tabstop;

Просмотреть файл

@ -104,8 +104,9 @@ protected:
GenericElementCollection* mCells;
};
#ifdef XXX_debugging
static
void TempList(nsIDOMHTMLTableElement* aTable) {
void DebugList(nsIDOMHTMLTableElement* aTable) {
nsIHTMLContent* content = nsnull;
nsresult result = aTable->QueryInterface(kIHTMLContentIID, (void**)&content);
if (NS_SUCCEEDED(result) && (nsnull != content)) {
@ -130,6 +131,7 @@ void TempList(nsIDOMHTMLTableElement* aTable) {
NS_RELEASE(content);
}
}
#endif
nsresult
NS_NewHTMLTableRowElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)

Просмотреть файл

@ -574,6 +574,10 @@ NOFRAMES {
background: inherit;
}
:TABLE-CELL {
display: table-cell;
}
:TABLE-COLUMN {
display: table-column;
}
@ -582,6 +586,10 @@ NOFRAMES {
display: table-column-group;
}
:TABLE-OUTER {
display: table;
}
:TABLE-ROW {
display: table-row;
}
@ -606,8 +614,14 @@ NOFRAMES {
display: block;
}
<<<<<<< ua.css
=======
:MOZ-COMMENT {
display: none;
<<<<<<< ua.css
}>>>>>>> 3.86
=======
}
:DROPDOWN-VISIBLE {
@ -634,3 +648,4 @@ NOFRAMES {
color: white;
border: 1px dotted white;
}
>>>>>>> 3.87

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -63,6 +63,8 @@ static const PRBool gsDebugIR = PR_FALSE;
NS_DEF_PTR(nsIStyleContext);
NS_DEF_PTR(nsIContent);
static NS_DEFINE_IID(kITableRowGroupFrameIID, NS_ITABLEROWGROUPFRAME_IID);
static const PRInt32 kColumnWidthIncrement=100;
/* ----------- CellData ---------- */
@ -3248,6 +3250,7 @@ NS_METHOD nsTableFrame::ReflowMappedChildren(nsIPresContext& aPresContext,
{
// Keep track of the first row group frame: we need this to correctly clear
// the isTopOfPage flag and when pushing frames
// XXX what about header and footer groups?
if (nsnull == firstRowGroupFrame) {
if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == childDisplay->mDisplay) {
firstRowGroupFrame = kidFrame;
@ -3255,7 +3258,7 @@ NS_METHOD nsTableFrame::ReflowMappedChildren(nsIPresContext& aPresContext,
}
nsMargin borderPadding;
GetTableBorderForRowGroup((nsTableRowGroupFrame *)kidFrame, borderPadding);
GetTableBorderForRowGroup(GetRowGroupFrameFor(kidFrame, childDisplay), borderPadding);
const nsStyleSpacing* tableSpacing;
GetStyleData(eStyleStruct_Spacing, ((const nsStyleStruct *&)tableSpacing));
nsMargin padding;
@ -4926,18 +4929,23 @@ nsTableFrame::GetFrameName(nsString& aResult) const
return MakeFrameName("Table", aResult);
}
// This assumes that aFrame is a scroll frame if
// XXX make this a macro if it becomes an issue
// XXX it has the side effect of setting mHasScrollableRowGroup
nsTableRowGroupFrame*
nsTableFrame::GetRowGroupFrameFor(nsIFrame* aFrame, const nsStyleDisplay* aDisplay)
{
if ((NS_STYLE_OVERFLOW_SCROLL == aDisplay->mOverflow) ||
(NS_STYLE_OVERFLOW_AUTO == aDisplay->mOverflow)) {
mHasScrollableRowGroup = PR_TRUE;
nsIFrame* child = nsnull;
aFrame->FirstChild(nsnull, child);
return (nsTableRowGroupFrame*)child;
} else {
return (nsTableRowGroupFrame*)aFrame;
nsIFrame* result = nsnull;
if (IsRowGroup(aDisplay->mDisplay)) {
nsresult rv = aFrame->QueryInterface(kITableRowGroupFrameIID, (void **)&result);
if (NS_SUCCEEDED(rv) && (nsnull != result)) {
;
} else { // it is a scroll frame that contains the row group frame
aFrame->FirstChild(nsnull, result);
mHasScrollableRowGroup = PR_TRUE;
}
}
return (nsTableRowGroupFrame*)result;
}

Просмотреть файл

@ -90,6 +90,21 @@ struct RowGroupReflowState {
/* ----------- nsTableRowGroupFrame ---------- */
nsresult
nsTableRowGroupFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kITableRowGroupIID, NS_ITABLEROWGROUPFRAME_IID);
if (aIID.Equals(kITableRowGroupIID)) {
*aInstancePtr = (void*)this;
return NS_OK;
} else {
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
}
}
NS_METHOD nsTableRowGroupFrame::GetRowCount(PRInt32 &aCount)
{
// init out-param

Просмотреть файл

@ -25,6 +25,10 @@
class nsTableRowFrame;
struct RowGroupReflowState;
#define NS_ITABLEROWGROUPFRAME_IID \
{ 0xe940e7bc, 0xb534, 0x11d2, \
{ 0x95, 0xa2, 0x0, 0x60, 0xb0, 0xc3, 0x44, 0x14 } }
/**
* nsTableRowGroupFrame is the frame that maps row groups
* (HTML tags THEAD, TFOOT, and TBODY). This class cannot be reused
@ -50,6 +54,8 @@ public:
friend nsresult
NS_NewTableRowGroupFrame(nsIFrame*& aResult);
NS_METHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -574,6 +574,10 @@ NOFRAMES {
background: inherit;
}
:TABLE-CELL {
display: table-cell;
}
:TABLE-COLUMN {
display: table-column;
}
@ -582,6 +586,10 @@ NOFRAMES {
display: table-column-group;
}
:TABLE-OUTER {
display: table;
}
:TABLE-ROW {
display: table-row;
}
@ -606,8 +614,14 @@ NOFRAMES {
display: block;
}
<<<<<<< ua.css
=======
:MOZ-COMMENT {
display: none;
<<<<<<< ua.css
}>>>>>>> 3.86
=======
}
:DROPDOWN-VISIBLE {
@ -634,3 +648,4 @@ NOFRAMES {
color: white;
border: 1px dotted white;
}
>>>>>>> 3.87

Просмотреть файл

@ -63,6 +63,8 @@ static const PRBool gsDebugIR = PR_FALSE;
NS_DEF_PTR(nsIStyleContext);
NS_DEF_PTR(nsIContent);
static NS_DEFINE_IID(kITableRowGroupFrameIID, NS_ITABLEROWGROUPFRAME_IID);
static const PRInt32 kColumnWidthIncrement=100;
/* ----------- CellData ---------- */
@ -3248,6 +3250,7 @@ NS_METHOD nsTableFrame::ReflowMappedChildren(nsIPresContext& aPresContext,
{
// Keep track of the first row group frame: we need this to correctly clear
// the isTopOfPage flag and when pushing frames
// XXX what about header and footer groups?
if (nsnull == firstRowGroupFrame) {
if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == childDisplay->mDisplay) {
firstRowGroupFrame = kidFrame;
@ -3255,7 +3258,7 @@ NS_METHOD nsTableFrame::ReflowMappedChildren(nsIPresContext& aPresContext,
}
nsMargin borderPadding;
GetTableBorderForRowGroup((nsTableRowGroupFrame *)kidFrame, borderPadding);
GetTableBorderForRowGroup(GetRowGroupFrameFor(kidFrame, childDisplay), borderPadding);
const nsStyleSpacing* tableSpacing;
GetStyleData(eStyleStruct_Spacing, ((const nsStyleStruct *&)tableSpacing));
nsMargin padding;
@ -4926,18 +4929,23 @@ nsTableFrame::GetFrameName(nsString& aResult) const
return MakeFrameName("Table", aResult);
}
// This assumes that aFrame is a scroll frame if
// XXX make this a macro if it becomes an issue
// XXX it has the side effect of setting mHasScrollableRowGroup
nsTableRowGroupFrame*
nsTableFrame::GetRowGroupFrameFor(nsIFrame* aFrame, const nsStyleDisplay* aDisplay)
{
if ((NS_STYLE_OVERFLOW_SCROLL == aDisplay->mOverflow) ||
(NS_STYLE_OVERFLOW_AUTO == aDisplay->mOverflow)) {
mHasScrollableRowGroup = PR_TRUE;
nsIFrame* child = nsnull;
aFrame->FirstChild(nsnull, child);
return (nsTableRowGroupFrame*)child;
} else {
return (nsTableRowGroupFrame*)aFrame;
nsIFrame* result = nsnull;
if (IsRowGroup(aDisplay->mDisplay)) {
nsresult rv = aFrame->QueryInterface(kITableRowGroupFrameIID, (void **)&result);
if (NS_SUCCEEDED(rv) && (nsnull != result)) {
;
} else { // it is a scroll frame that contains the row group frame
aFrame->FirstChild(nsnull, result);
mHasScrollableRowGroup = PR_TRUE;
}
}
return (nsTableRowGroupFrame*)result;
}

Просмотреть файл

@ -90,6 +90,21 @@ struct RowGroupReflowState {
/* ----------- nsTableRowGroupFrame ---------- */
nsresult
nsTableRowGroupFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kITableRowGroupIID, NS_ITABLEROWGROUPFRAME_IID);
if (aIID.Equals(kITableRowGroupIID)) {
*aInstancePtr = (void*)this;
return NS_OK;
} else {
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
}
}
NS_METHOD nsTableRowGroupFrame::GetRowCount(PRInt32 &aCount)
{
// init out-param

Просмотреть файл

@ -25,6 +25,10 @@
class nsTableRowFrame;
struct RowGroupReflowState;
#define NS_ITABLEROWGROUPFRAME_IID \
{ 0xe940e7bc, 0xb534, 0x11d2, \
{ 0x95, 0xa2, 0x0, 0x60, 0xb0, 0xc3, 0x44, 0x14 } }
/**
* nsTableRowGroupFrame is the frame that maps row groups
* (HTML tags THEAD, TFOOT, and TBODY). This class cannot be reused
@ -50,6 +54,8 @@ public:
friend nsresult
NS_NewTableRowGroupFrame(nsIFrame*& aResult);
NS_METHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);

Просмотреть файл

@ -170,5 +170,47 @@ column widths and collapsing borders.</CAPTION>
<CAPTION ALIGN=BOTTOM>Table 5 has a scrolling tbody.</CAPTION>
</table>
<BR>
This is a table formed from a list with display of table-row and
list items with display of table-cell.
<DIV style="background-color: orange; width: 230px;">
<UL style="display: table-row;">
<LI style="display: table-cell;">ONE</LI>
<LI style="display: table-cell;">TWO</LI>
<LI style="display: table-cell;">THREE</LI>
<LI style="display: table-cell;">FOUR</LI>
<LI style="display: table-cell;">FIVE</LI>
</UL>
</DIV>
<BR>
This is a table formed from a list with display of table-row-group and
list items with display of table-cell.
<BR>
<DIV style="background-color: orange; width: 100px;">
<UL style="display:table-row-group">
<LI style="display:table-cell;">ONE</LI>
<LI style="display:table-cell;">TWO</LI>
<LI style="display:table-cell;">THREE</LI>
<LI style="display:table-cell;">FOUR</LI>
<LI style="display:table-cell;">FIVE</LI>
<LI style="display:table-cell;">SIX</LI>
</UL>
</DIV>
<BR>
This is like the previous table plus the list's overflow property set
<DIV style="background-color:orange; width:50px; height: 50px;">
<UL style="display:table-row-group; overflow:auto; height: 50px;">
<LI style="display:table-cell;">ONE</LI>
<LI style="display:table-cell;">TWO</LI>
<LI style="display:table-cell;">THREE</LI>
<LI style="display:table-cell;">FOUR</LI>
<LI style="display:table-cell;">FIVE</LI>
<LI style="display:table-cell;">SIX</LI>
</UL>
</DIV>
<BR>
</BODY>
</HTML>