mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-30 01:59:29 +00:00
Bug 521542. Fix IsValidSibling to not lie when non-table-related siblings are involved. r=bernd
This commit is contained in:
parent
1111376254
commit
de6af72a50
@ -5894,19 +5894,34 @@ nsCSSFrameConstructor::IsValidSibling(nsIFrame* aSibling,
|
||||
(NS_STYLE_DISPLAY_POPUP == aDisplay) ==
|
||||
(NS_STYLE_DISPLAY_POPUP == siblingDisplay);
|
||||
}
|
||||
switch (siblingDisplay) {
|
||||
case NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP:
|
||||
return (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == aDisplay);
|
||||
case NS_STYLE_DISPLAY_TABLE_COLUMN:
|
||||
return (NS_STYLE_DISPLAY_TABLE_COLUMN == aDisplay);
|
||||
case NS_STYLE_DISPLAY_TABLE_CAPTION:
|
||||
return (NS_STYLE_DISPLAY_TABLE_CAPTION == aDisplay);
|
||||
default: // all of the row group types
|
||||
return (NS_STYLE_DISPLAY_TABLE_HEADER_GROUP == aDisplay) ||
|
||||
(NS_STYLE_DISPLAY_TABLE_ROW_GROUP == aDisplay) ||
|
||||
(NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == aDisplay) ||
|
||||
(NS_STYLE_DISPLAY_TABLE_CAPTION == aDisplay);
|
||||
// To have decent performance we want to return false in cases in which
|
||||
// reordering the two siblings has no effect on display. To ensure
|
||||
// correctness, we MUST return false in cases where the two siblings have
|
||||
// the same desired parent type and live on different display lists.
|
||||
// Specificaly, columns and column groups should only consider columns and
|
||||
// column groups as valid siblings. Captions should only consider other
|
||||
// captions. All other things should consider each other as valid
|
||||
// siblings. The restriction in the |if| above on siblingDisplay is ok,
|
||||
// because for correctness the only part that really needs to happen is to
|
||||
// not consider captions, column groups, and row/header/footer groups
|
||||
// siblings of each other. Treating a column or colgroup as a valid
|
||||
// sibling of a non-table-related frame will just mean we end up reframing.
|
||||
if ((siblingDisplay == NS_STYLE_DISPLAY_TABLE_CAPTION) !=
|
||||
(aDisplay == NS_STYLE_DISPLAY_TABLE_CAPTION)) {
|
||||
// One's a caption and the other is not. Not valid siblings.
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
if ((siblingDisplay == NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP ||
|
||||
siblingDisplay == NS_STYLE_DISPLAY_TABLE_COLUMN) !=
|
||||
(aDisplay == NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP ||
|
||||
aDisplay == NS_STYLE_DISPLAY_TABLE_COLUMN)) {
|
||||
// One's a column or column group and the other is not. Not valid
|
||||
// siblings.
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
else if (nsGkAtoms::fieldSetFrame == parentType ||
|
||||
(nsGkAtoms::fieldSetFrame == grandparentType &&
|
||||
|
18
layout/reftests/bugs/521542-1-ref.xhtml
Normal file
18
layout/reftests/bugs/521542-1-ref.xhtml
Normal file
@ -0,0 +1,18 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head></head>
|
||||
|
||||
<body>
|
||||
|
||||
<table id="table">
|
||||
BeginningOfTable
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Cell</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<span></span>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
18
layout/reftests/bugs/521542-1.xhtml
Normal file
18
layout/reftests/bugs/521542-1.xhtml
Normal file
@ -0,0 +1,18 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head></head>
|
||||
|
||||
<body onload="document.getElementById('table').firstChild.data = ' BeginningOfTable ';">
|
||||
|
||||
<table id="table">
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Cell</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<span></span>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1329,6 +1329,7 @@ fails-if(MOZ_WIDGET_TOOLKIT!="cocoa") == 488692-1.html 488692-1-ref.html # needs
|
||||
== 513318-1.xul 513318-1-ref.xul
|
||||
!= 513318-2.xul 513318-2-ref.xul
|
||||
!= 513318-3.xul 513318-3-ref.xul
|
||||
== 521542-1.xhtml 521542-1-ref.xhtml
|
||||
== 520421-1.html 520421-1-ref.html
|
||||
== 520563-1.xhtml 520563-1-ref.xhtml
|
||||
== 521525-1.html 521525-1-ref.html
|
||||
|
Loading…
x
Reference in New Issue
Block a user