Bug 490220. Make sure to skip over whitespace when looking for a following pseudo-sibling for a frame being removed. r+sr=roc
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -8830,17 +8830,18 @@ nsCSSFrameConstructor::MaybeRecreateCont
}
}
// Might need to reconstruct things if this frame's nextSibling is a table
// pseudo, since removal of this frame might mean that this pseudo needs to
// get merged with the frame's prevSibling.
// XXXbz it would be really nice if we had the prevSibling here too, to check
// whether this is in fact the case...
- nsIFrame* nextSibling = inFlowFrame->GetNextSibling();
+ nsIFrame* nextSibling =
+ FindNextNonWhitespaceSibling(inFlowFrame->GetLastContinuation());
NS_ASSERTION(!IsTablePseudo(inFlowFrame), "Shouldn't happen here");
if (nextSibling && IsTablePseudo(nextSibling)) {
#ifdef DEBUG
if (gNoisyContentUpdates) {
printf("nsCSSFrameConstructor::MaybeRecreateContainerForFrameRemoval: "
"frame=");
nsFrame::ListTag(stdout, aFrame);
printf(" has a table pseudo next sibling of different type\n");
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/dynamic-removal-15.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <script>
+ function doTest() {
+ var n = document.getElementById("t");
+ n.parentNode.removeChild(n);
+ document.documentElement.className = "";
+ }
+ </script>
+ </head>
+ <body style="font-family: monospace" onload="doTest()">
+ <span style="display: table-row">
+ <span style="display: table-cell">Row 1, Col 1</span>
+ <span style="display: table-cell">Row 1, Col 2</span>
+ <span style="display: table-cell">Row 1, Col 3</span>
+ </span>
+ <span style="display: table-row">
+ <span style="display: table-cell">Row 22, Col 1</span>
+ <span style="display: table-cell">Row 22, Col 2</span>
+ <span style="display: table-cell">Row 22, Col 3</span>
+ </span>
+ <span id="t">To be removed</span>
+ <span style="display: table-row">
+ <span style="display: table-cell">Row 333, Col 1</span>
+ <span style="display: table-cell">Row 333, Col 2</span>
+ <span style="display: table-cell">Row 333, Col 3</span>
+ </span>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/dynamic-removal-16.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <script>
+ function doTest() {
+ var t = document.getElementById("t");
+ t.parentNode.removeChild(t);
+ document.documentElement.className = "";
+ }
+ </script>
+ </head>
+ <body style="font-family: monospace" onload="doTest()">
+ <span style="display: table-row-group">
+ <span style="display: table-cell">Row 1, Col 1</span>
+ <span style="display: table-cell">Row 1, Col 2</span>
+ <span style="display: table-cell">Row 1, Col 3</span>
+ </span>
+ <span style="display: table-row-group">
+ <span style="display: table-cell">Row 22, Col 1</span>
+ <span style="display: table-cell">Row 22, Col 2</span>
+ <span style="display: table-cell">Row 22, Col 3</span>
+ </span>
+ <span id="t">To be removed</span>
+ <span style="display: table-row-group">
+ <span style="display: table-cell">Row 333, Col 1</span>
+ <span style="display: table-cell">Row 333, Col 2</span>
+ <span style="display: table-cell">Row 333, Col 3</span>
+ </span>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/dynamic-removal-17.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <script>
+ function doTest() {
+ var n = document.getElementById("t");
+ n.parentNode.removeChild(n);
+ document.documentElement.className = "";
+ }
+ </script>
+ </head>
+ <body style="font-family: monospace" onload="doTest()">
+ <span style="display: table-row-group">
+ <span style="display: table-row">
+ <span style="display: table-cell">Row 1, Col 1</span>
+ <span style="display: table-cell">Row 1, Col 2</span>
+ <span style="display: table-cell">Row 1, Col 3</span>
+ </span>
+ </span>
+ <span style="display: table-cell">Row 22, Col 1</span>
+ <span style="display: table-cell">Row 22, Col 2</span>
+ <span id="t">To be removed</span>
+ <span style="display: table-cell">Row 22, Col 3</span>
+ <span style="display: table-row-group">
+ <span style="display: table-row">
+ <span style="display: table-cell">Row 333, Col 1</span>
+ <span style="display: table-cell">Row 333, Col 2</span>
+ <span style="display: table-cell">Row 333, Col 3</span>
+ </span>
+ </span>
+ </body>
+</html>
--- a/layout/reftests/table-anonymous-boxes/reftest.list
+++ b/layout/reftests/table-anonymous-boxes/reftest.list
@@ -61,16 +61,19 @@ fails == 156888-1.html 156888-1-ref.html
== dynamic-removal-7.html 3x3-ref.html
== dynamic-removal-8.html 3x3-ref.html
== dynamic-removal-9.html white-space-ref.html
== dynamic-removal-10.html white-space-ref.html
== dynamic-removal-11.html white-space-ref.html
== dynamic-removal-12.html white-space-ref.html
== dynamic-removal-13.html 3x3-ref.html
== dynamic-removal-14.html 3x3-ref.html
+== dynamic-removal-15.html 3x3-ref.html
+== dynamic-removal-16.html 3x3-ref.html
+== dynamic-removal-17.html 3x3-ref.html
== dynamic-insert-cell-1.html 3x3-ref.html
== dynamic-switch-block-to-cell-1.html 3x3-ref.html
== dynamic-switch-block-to-cell-2.html 3x3-ref.html
== dynamic-switch-block-to-cell-3.html 3x3-ref.html
== dynamic-switch-block-to-cell-4.html 3x3-ref.html
== dynamic-switch-block-to-cell-5.html 3x3-ref.html
== dynamic-switch-inline-to-cell-1.html 3x3-ref.html
== dynamic-switch-inline-to-cell-2.html 3x3-ref.html