Bug695538 - Make sure that trailing spaces don't get dropped by nsCSSFrameConstructor::CreateNeededTablePseudos in certain cases. r=bz

This commit is contained in:
Kang-Hao (Kenny) Lu 2011-10-20 10:09:33 +02:00
parent e86f414e30
commit 5d17969b84
4 changed files with 48 additions and 3 deletions

View File

@ -9288,9 +9288,15 @@ nsCSSFrameConstructor::CreateNeededTablePseudos(nsFrameConstructorState& aState,
spaceEndIter.item().IsWhitespace(aState)) {
bool trailingSpaces = spaceEndIter.SkipWhitespace(aState);
// See whether we can drop the whitespace
if (trailingSpaces ||
spaceEndIter.item().DesiredParentType() != eTypeBlock) {
// We drop the whitespace if these are not trailing spaces and the next item
// does not want a block parent (see case 2 above)
// if these are trailing spaces and aParentFrame is a tabular container
// according to rule 1.3 of CSS 2.1 Sec 17.2.1. (Being a tabular container
// pretty much means ourParentType != eTypeBlock besides the eTypeColGroup case,
// which won't reach here.)
if ((trailingSpaces && ourParentType != eTypeBlock) ||
(!trailingSpaces && spaceEndIter.item().DesiredParentType() !=
eTypeBlock)) {
bool updateStart = (iter == endIter);
endIter.DeleteItemsTo(spaceEndIter);
NS_ASSERTION(trailingSpaces == endIter.IsDone(), "These should match");

View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<style>
:root {
border-collapse: collapse;
border-spacing: 1px;
}
.cell {
display: table-cell;
border: solid black;
}
.pre {
white-space: pre;
border: solid blue;
}
.table {
display: table;
}
</style>
<span class="pre"> <span cless="table"><span class="cell">A</span>
<span class="cell">B</span></span> </span>

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<style>
:root {
border-collapse: collapse;
border-spacing: 1px;
}
.cell {
display: table-cell;
border: solid black;
}
.pre {
white-space: pre;
border: solid blue;
}
</style>
<span class="pre"> <span class="cell">A</span> <span class="cell">B</span> </span>

View File

@ -35,6 +35,7 @@ random-if(d2d) == 394402-1a.html 394402-1-ref.html # bug 586833
== 443616-1b.html 443616-1-ref.html
== 448111-1.html 448111-1-ref.html
== 490174-1.html 490174-1-ref.html
== 695538-1.html 695538-1-ref.html
== infer-first-row.html 3x3-ref.html
== infer-first-row-and-table.html 3x3-ref.html
== infer-second-row.html 3x3-ref.html