Bug 490220. Make sure to skip over whitespace when looking for a following pseudo-sibling for a frame being removed. r+sr=roc
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 27 Apr 2009 14:20:08 -0700
changeset 27866 696dbbd73355b9b8a14516e756331e0ca8d194a0
parent 27865 607c4ad16edf4a6cec08018bc8c91ffe2f7f3f1c
child 27867 5e3157d1c28ce9d36a8ebb1e915ea708b5bef645
push idunknown
push userunknown
push dateunknown
bugs490220
milestone1.9.2a1pre
Bug 490220. Make sure to skip over whitespace when looking for a following pseudo-sibling for a frame being removed. r+sr=roc
layout/base/nsCSSFrameConstructor.cpp
layout/reftests/table-anonymous-boxes/dynamic-removal-15.html
layout/reftests/table-anonymous-boxes/dynamic-removal-16.html
layout/reftests/table-anonymous-boxes/dynamic-removal-17.html
layout/reftests/table-anonymous-boxes/reftest.list
--- 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