bug 139524 - handle style of col's with spans. sr=kin, r=bernd

This commit is contained in:
karnaze%netscape.com 2002-09-15 03:45:10 +00:00
Родитель 92d5f18935
Коммит f54367c783
9 изменённых файлов: 143 добавлений и 30 удалений

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

@ -584,6 +584,11 @@ nsFrameItems::AddChild(nsIFrame* aChild)
lastChild->SetNextSibling(aChild);
lastChild = aChild;
}
// if aChild has siblings, lastChild needs to be the last one
nsIFrame* sib;
for (lastChild->GetNextSibling(&sib); sib; sib->GetNextSibling(&sib)) {
lastChild = sib;
}
}
// -----------------------------------------------------------
@ -2813,16 +2818,15 @@ nsCSSFrameConstructor::ConstructTableColFrame(nsIPresShell* aPresShel
if (cgContent) {
cgContent->GetSpan(&span);
nsIFrame* lastCol = aNewFrame;
nsCOMPtr<nsIStyleContext> styleContext;
for (PRInt32 spanX = 1; spanX < span; spanX++) {
nsCOMPtr<nsIStyleContext> styleContext;
aPresContext->ResolvePseudoStyleContextFor(aContent, nsHTMLAtoms::tableColPseudo, aStyleContext,
getter_AddRefs(styleContext));
// The same content node should always resolve to the same style context.
if (1 == spanX)
aNewFrame->GetStyleContext(getter_AddRefs(styleContext));
nsIFrame* newCol;
rv = aTableCreator.CreateTableColFrame(&newCol); if (NS_FAILED(rv)) return rv;
InitAndRestoreFrame(aPresContext, aState, aContent, parentFrame, styleContext, nsnull, newCol);
if (aIsPseudoParent) {
aPresContext->ReParentStyleContext(newCol, aStyleContext);
}
InitAndRestoreFrame(aPresContext, aState, aContent, parentFrame,
styleContext, nsnull, newCol);
((nsTableColFrame*)newCol)->SetType(eColAnonymousCol);
lastCol->SetNextSibling(newCol);
lastCol = newCol;
@ -2833,13 +2837,14 @@ nsCSSFrameConstructor::ConstructTableColFrame(nsIPresShell* aPresShel
nsFrameItems childItems;
nsIFrame* captionFrame;
rv = TableProcessChildren(aPresShell, aPresContext, aState, aContent, aNewFrame,
aTableCreator, childItems, captionFrame); if (NS_FAILED(rv)) return rv;
aTableCreator, childItems, captionFrame);
if (NS_FAILED(rv)) return rv;
aNewFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
if (aIsPseudoParent) {
aState.mPseudoFrames.mColGroup.mChildList.AddChild(aNewFrame);
}
}
return rv;
}
@ -3217,7 +3222,7 @@ nsCSSFrameConstructor::TableProcessChild(nsIPresShell* aPresShell,
// for every table related frame except captions and ones with pseudo parents,
// link into the child list
if (childFrame && !childIsCaption && !isPseudoParent) {
if (childFrame && !childIsCaption && !isPseudoParent) {
aChildItems.AddChild(childFrame);
}
return rv;

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

@ -231,13 +231,10 @@ tr {
display: table-row;
}
/* The :-moz-table-column pseudo-element is for extra columns at the end
of a table. */
col, *|*:-moz-table-column {
display: table-column;
border: inherit;
width: inherit;
height: inherit;
background: inherit;
border: inherit;
}
colgroup, *|*:-moz-table-column-group {

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

@ -584,6 +584,11 @@ nsFrameItems::AddChild(nsIFrame* aChild)
lastChild->SetNextSibling(aChild);
lastChild = aChild;
}
// if aChild has siblings, lastChild needs to be the last one
nsIFrame* sib;
for (lastChild->GetNextSibling(&sib); sib; sib->GetNextSibling(&sib)) {
lastChild = sib;
}
}
// -----------------------------------------------------------
@ -2813,16 +2818,15 @@ nsCSSFrameConstructor::ConstructTableColFrame(nsIPresShell* aPresShel
if (cgContent) {
cgContent->GetSpan(&span);
nsIFrame* lastCol = aNewFrame;
nsCOMPtr<nsIStyleContext> styleContext;
for (PRInt32 spanX = 1; spanX < span; spanX++) {
nsCOMPtr<nsIStyleContext> styleContext;
aPresContext->ResolvePseudoStyleContextFor(aContent, nsHTMLAtoms::tableColPseudo, aStyleContext,
getter_AddRefs(styleContext));
// The same content node should always resolve to the same style context.
if (1 == spanX)
aNewFrame->GetStyleContext(getter_AddRefs(styleContext));
nsIFrame* newCol;
rv = aTableCreator.CreateTableColFrame(&newCol); if (NS_FAILED(rv)) return rv;
InitAndRestoreFrame(aPresContext, aState, aContent, parentFrame, styleContext, nsnull, newCol);
if (aIsPseudoParent) {
aPresContext->ReParentStyleContext(newCol, aStyleContext);
}
InitAndRestoreFrame(aPresContext, aState, aContent, parentFrame,
styleContext, nsnull, newCol);
((nsTableColFrame*)newCol)->SetType(eColAnonymousCol);
lastCol->SetNextSibling(newCol);
lastCol = newCol;
@ -2833,13 +2837,14 @@ nsCSSFrameConstructor::ConstructTableColFrame(nsIPresShell* aPresShel
nsFrameItems childItems;
nsIFrame* captionFrame;
rv = TableProcessChildren(aPresShell, aPresContext, aState, aContent, aNewFrame,
aTableCreator, childItems, captionFrame); if (NS_FAILED(rv)) return rv;
aTableCreator, childItems, captionFrame);
if (NS_FAILED(rv)) return rv;
aNewFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
if (aIsPseudoParent) {
aState.mPseudoFrames.mColGroup.mChildList.AddChild(aNewFrame);
}
}
return rv;
}
@ -3217,7 +3222,7 @@ nsCSSFrameConstructor::TableProcessChild(nsIPresShell* aPresShell,
// for every table related frame except captions and ones with pseudo parents,
// link into the child list
if (childFrame && !childIsCaption && !isPseudoParent) {
if (childFrame && !childIsCaption && !isPseudoParent) {
aChildItems.AddChild(childFrame);
}
return rv;

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

@ -0,0 +1,18 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>testcase: col with multilength width and span</TITLE>
</HEAD>
<BODY>
<TABLE width="100%" summary="Navigation">
<COL span="3" width="*">
<TBODY>
<TR>
<TD bgcolor="#00FFFF">06</TD>
<TD bgcolor="#FFFF00">05</TD>
<TD bgcolor="#FF00FF">04</TD>
</TR>
</TBODY>
</TABLE>
</BODY>
</HTML>

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

@ -0,0 +1,49 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<title>SPAN attribute in COL element being ignored.</title>
<style type="text/css">
pre {font:1em monospace; margin-left:15px; color:#000066;}
td {border:thin solid black;}
.aside {font-style:italic;}
</style>
</head>
<body>
<h3>SPAN attribute of COL element being ignored in Mozilla 1.0 rc1</h3>
<p class="aside">(Note: this is a regression bug - I don't know when it appeared, but I remember the SPAN attribute on COL elements worked fine sometime before Mozilla 0.9.6)</p>
<p>The following TABLE has a COLGROUP structure of:</p>
<pre>&lt;colgroup&gt;
&lt;col width="100" span="2"&gt;
&lt;col width="200"&gt;
&lt;/colgroup&gt;
</pre>
<p>So the first two colums should both be 100px wide, and the third should be 200px wide.</p>
<p>However, the first column is 100px, the second is 200px, and the third is the default width.</p>
<p>So it would appear that the SPAN attribute is being ignored.</p>
<table>
<colgroup>
<col width="100" span="2">
<col width="200">
</colgroup>
<tr>
<td>col 1</td>
<td>col 2</td>
<td>col 3</td>
</tr>
</table>
</body>
</html>

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

@ -0,0 +1,20 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>testcase: col with multilength width and span</TITLE>
</HEAD>
<BODY>
<TABLE width="100%" summary="Navigation">
<colgroup>
<COL span="3" width="*">
</colgroup>
<TBODY>
<TR>
<TD bgcolor="#00FFFF">06</TD>
<TD bgcolor="#FFFF00">05</TD>
<TD bgcolor="#FF00FF">04</TD>
</TR>
</TBODY>
</TABLE>
</BODY>
</HTML>

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

@ -0,0 +1,18 @@
<html><head>
<title>Table col span test</title></head>
<body>
<table border="1">
<col width="50" span="2">
<col width="100" span="2">
<tbody><tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
</tbody></table>
</body></html>

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

@ -86,3 +86,7 @@ file:///s|/mozilla/layout/html/tests/table/bugs/bug137388-1.html
file:///s|/mozilla/layout/html/tests/table/bugs/bug137388-2.html
file:///s|/mozilla/layout/html/tests/table/bugs/bug137388-3.html
file:///s|/mozilla/layout/html/tests/table/bugs/bug138725.html
file:///s|/mozilla/layout/html/tests/table/bugs/bug139524-1.html
file:///s|/mozilla/layout/html/tests/table/bugs/bug139524-2.html
file:///s|/mozilla/layout/html/tests/table/bugs/bug139524-3.html
file:///s|/mozilla/layout/html/tests/table/bugs/bug139524-4.html

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

@ -231,13 +231,10 @@ tr {
display: table-row;
}
/* The :-moz-table-column pseudo-element is for extra columns at the end
of a table. */
col, *|*:-moz-table-column {
display: table-column;
border: inherit;
width: inherit;
height: inherit;
background: inherit;
border: inherit;
}
colgroup, *|*:-moz-table-column-group {