bug 119786 - don't consider a caption and row group frame to be siblings (caption and row group content are siblings). sr=kin, r=bernd.

This commit is contained in:
karnaze%netscape.com 2002-11-12 15:55:39 +00:00
Родитель ca4ad476d2
Коммит a171e78ced
4 изменённых файлов: 71 добавлений и 4 удалений

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

@ -8041,8 +8041,10 @@ FindNextAnonymousSibling(nsIPresShell* aPresShell,
}
#define UNSET_DISPLAY 255
// if the sibling is a col group, col or (row group, caption), then aContent
// must be the same type, otherwise aContent may get the wrong parent.
// This gets called to see if the frames corresponding to aSiblingDisplay and aDisplay
// should be siblings in the frame tree. Although (1) rows and cols, (2) row groups
// and col groups, and (3) row groups and captions are siblings from a content perspective,
// they are not considered siblings in the frame tree.
PRBool
nsCSSFrameConstructor::IsValidSibling(nsIPresShell& aPresShell,
const nsIFrame& aSibling,
@ -8082,6 +8084,13 @@ nsCSSFrameConstructor::IsValidSibling(nsIPresShell& aPresShell,
(NS_STYLE_DISPLAY_TABLE_CAPTION == aDisplay);
}
}
else if (NS_STYLE_DISPLAY_TABLE_CAPTION == aSiblingDisplay) {
// Nothing can be a sibling of a caption since there can only be one caption.
// But this check is necessary since a row group and caption are siblings
// from a content perspective (they share the table content as parent)
return PR_FALSE;
}
return PR_TRUE;
}

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

@ -8041,8 +8041,10 @@ FindNextAnonymousSibling(nsIPresShell* aPresShell,
}
#define UNSET_DISPLAY 255
// if the sibling is a col group, col or (row group, caption), then aContent
// must be the same type, otherwise aContent may get the wrong parent.
// This gets called to see if the frames corresponding to aSiblingDisplay and aDisplay
// should be siblings in the frame tree. Although (1) rows and cols, (2) row groups
// and col groups, and (3) row groups and captions are siblings from a content perspective,
// they are not considered siblings in the frame tree.
PRBool
nsCSSFrameConstructor::IsValidSibling(nsIPresShell& aPresShell,
const nsIFrame& aSibling,
@ -8082,6 +8084,13 @@ nsCSSFrameConstructor::IsValidSibling(nsIPresShell& aPresShell,
(NS_STYLE_DISPLAY_TABLE_CAPTION == aDisplay);
}
}
else if (NS_STYLE_DISPLAY_TABLE_CAPTION == aSiblingDisplay) {
// Nothing can be a sibling of a caption since there can only be one caption.
// But this check is necessary since a row group and caption are siblings
// from a content perspective (they share the table content as parent)
return PR_FALSE;
}
return PR_TRUE;
}

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

@ -0,0 +1,48 @@
<html><head>
<title>table creation</title><style type="text/css">
caption { color: green; background-color: lightyellow; }
</style>
<script type="text/javascript">
function createTable (caption) {
var table = document.createElement('table');
table.border = 1;
document.body.appendChild(table);
if (caption) {
table.createCaption();
table.caption.appendChild(document.createTextNode(caption));
}
table.createTHead();
var row = table.tHead.insertRow(table.tHead.rows.length);
row.insertCell(0).appendChild(document.createTextNode('Header'));
table.appendChild(document.createElement('tbody'));
row = table.tBodies[0].insertRow(table.tBodies[0].rows.length);
row.insertCell(0).appendChild(document.createTextNode('Kibology'));
}
function createTable1 (caption) {
var table = document.createElement('table');
table.border = 1;
if (caption) {
table.createCaption();
table.caption.appendChild(document.createTextNode(caption));
}
table.createTHead();
var row = table.tHead.insertRow(table.tHead.rows.length);
row.insertCell(0).appendChild(document.createTextNode('Header'));
table.appendChild(document.createElement('tbody'));
row = table.tBodies[0].insertRow(table.tBodies[0].rows.length);
row.insertCell(0).appendChild(document.createTextNode('Kibology'));
document.body.appendChild(table);
}</script></head>
<body>
<script type="text/javascript">
createTable('Where is the table?');
document.body.appendChild(document.createElement('hr'));
createTable();
document.body.appendChild(document.createElement('hr'));
createTable1('Here is the table');
</script><table border="1"><thead><tr><td>Header</td></tr></thead><caption>Where is the table?</caption><tbody><tr><td>Kibology</td></tr></tbody></table><hr><table border="1"><thead><tr><td>Header</td></tr></thead><tbody><tr><td>Kibology</td></tr></tbody></table><hr><table border="1"><thead><tr><td>Header</td></tr></thead><caption>Here is the table</caption><tbody><tr><td>Kibology</td></tr></tbody></table>
</body></html>

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

@ -45,6 +45,7 @@ file:///s|/mozilla/layout/html/tests/table/bugs/bug1164.html
file:///s|/mozilla/layout/html/tests/table/bugs/bug1188.html
file:///s|/mozilla/layout/html/tests/table/bugs/bug11944.html
file:///s|/mozilla/layout/html/tests/table/bugs/bug11945.html
file:///s|/mozilla/layout/html/tests/table/bugs/bug119786.html
file:///s|/mozilla/layout/html/tests/table/bugs/bug13196.html
file:///s|/mozilla/layout/html/tests/table/bugs/bug12008.html
file:///s|/mozilla/layout/html/tests/table/bugs/bug120364.html