Bug 148810. Handle dynamic insertion and append better when table pseudo-frames are involved. r=bernd, sr=roc. Also fixes bug 112142, bug 208305, bug 325543, bug 368932, bug 371054, bug 372649, bug 394402, bug 448111.
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 26 Mar 2009 14:08:58 -0400
changeset 26607 6b3cc966ef5268b399bb0b75ef32e953a6e57004
parent 26606 8bfac66fe41a8487b2e5048a3e8b81df7d03fc82
child 26608 1197710c68e7b92e4a047f3401c236f5a3544389
push id6142
push userbzbarsky@mozilla.com
push dateThu, 26 Mar 2009 20:01:54 +0000
treeherdermozilla-central@6b3cc966ef52 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbernd, roc
bugs148810, 112142, 208305, 325543, 368932, 371054, 372649, 394402, 448111
milestone1.9.2a1pre
Bug 148810. Handle dynamic insertion and append better when table pseudo-frames are involved. r=bernd, sr=roc. Also fixes bug 112142, bug 208305, bug 325543, bug 368932, bug 371054, bug 372649, bug 394402, bug 448111.
layout/base/nsCSSFrameConstructor.cpp
layout/reftests/first-line/reftest.list
layout/reftests/table-anonymous-boxes/121142-1-ref.html
layout/reftests/table-anonymous-boxes/121142-1a.html
layout/reftests/table-anonymous-boxes/121142-1b.html
layout/reftests/table-anonymous-boxes/121142-2-ref.html
layout/reftests/table-anonymous-boxes/121142-2.html
layout/reftests/table-anonymous-boxes/208305-2.html
layout/reftests/table-anonymous-boxes/208305-3.html
layout/reftests/table-anonymous-boxes/208305-4.html
layout/reftests/table-anonymous-boxes/325543-1-ref.html
layout/reftests/table-anonymous-boxes/325543-1a.html
layout/reftests/table-anonymous-boxes/325543-1b.html
layout/reftests/table-anonymous-boxes/368932-1-ref.html
layout/reftests/table-anonymous-boxes/368932-1.html
layout/reftests/table-anonymous-boxes/371054-1-ref.html
layout/reftests/table-anonymous-boxes/371054-1.html
layout/reftests/table-anonymous-boxes/372649-1-ref.html
layout/reftests/table-anonymous-boxes/372649-1.html
layout/reftests/table-anonymous-boxes/394402-1-ref.html
layout/reftests/table-anonymous-boxes/394402-1a.html
layout/reftests/table-anonymous-boxes/394402-1b.html
layout/reftests/table-anonymous-boxes/448111-1-ref.html
layout/reftests/table-anonymous-boxes/448111-1.html
layout/reftests/table-anonymous-boxes/blocks-divide-tables-1.html
layout/reftests/table-anonymous-boxes/blocks-divide-tables-2.html
layout/reftests/table-anonymous-boxes/cols-test-1.html
layout/reftests/table-anonymous-boxes/cols-test-2.html
layout/reftests/table-anonymous-boxes/cols-test-3.html
layout/reftests/table-anonymous-boxes/dynamic-insert-cell-1.html
layout/reftests/table-anonymous-boxes/dynamic-removal-14.html
layout/reftests/table-anonymous-boxes/dynamic-switch-block-to-cell-1.html
layout/reftests/table-anonymous-boxes/dynamic-switch-block-to-cell-2.html
layout/reftests/table-anonymous-boxes/dynamic-switch-block-to-cell-3.html
layout/reftests/table-anonymous-boxes/dynamic-switch-block-to-cell-4.html
layout/reftests/table-anonymous-boxes/dynamic-switch-block-to-cell-5.html
layout/reftests/table-anonymous-boxes/dynamic-switch-inline-to-cell-1.html
layout/reftests/table-anonymous-boxes/dynamic-switch-inline-to-cell-2.html
layout/reftests/table-anonymous-boxes/dynamic-switch-inline-to-cell-3.html
layout/reftests/table-anonymous-boxes/dynamic-switch-inline-to-cell-4.html
layout/reftests/table-anonymous-boxes/dynamic-switch-inline-to-cell-5.html
layout/reftests/table-anonymous-boxes/infer-cells-1.html
layout/reftests/table-anonymous-boxes/infer-cells-2.html
layout/reftests/table-anonymous-boxes/infer-cells-3.html
layout/reftests/table-anonymous-boxes/infer-cells-4.html
layout/reftests/table-anonymous-boxes/infer-first-row-and-table.html
layout/reftests/table-anonymous-boxes/infer-first-row.html
layout/reftests/table-anonymous-boxes/infer-rows-inside-rowgroups.html
layout/reftests/table-anonymous-boxes/infer-second-row-and-table.html
layout/reftests/table-anonymous-boxes/infer-second-row.html
layout/reftests/table-anonymous-boxes/infer-table-around-headers-footers-1.html
layout/reftests/table-anonymous-boxes/infer-table-around-headers-footers-2.html
layout/reftests/table-anonymous-boxes/infer-table-around-headers-footers-3.html
layout/reftests/table-anonymous-boxes/infer-table-row-cell.html
layout/reftests/table-anonymous-boxes/infer-table.html
layout/reftests/table-anonymous-boxes/reftest.list
layout/reftests/table-anonymous-boxes/white-space-1.html
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -8741,16 +8741,38 @@ nsCSSFrameConstructor::MaybeRecreateCont
          parent->GetFirstChild(nsGkAtoms::captionList) == inFlowFrame)) {
       // We're the first or last frame in the pseudo.  Need to reframe.
       // Good enough to recreate frames for |parent|'s content
       *aResult = RecreateFramesForContent(parent->GetContent());
       return PR_TRUE;
     }
   }
 
+  // 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();
+  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");
+    }
+#endif
+    // Good enough to recreate frames for aFrame's parent's content; even if
+    // aFrame's parent is a table pseudo, that'll be the right content node.
+    *aResult = RecreateFramesForContent(parent->GetContent());
+    return PR_TRUE;
+  }
+
   // We might still need to reconstruct things if the parent of inFlowFrame is
   // special, since in that case the removal of aFrame might affect the
   // splitting of its parent.
   if (!IsFrameSpecial(parent)) {
     return PR_FALSE;
   }
 
   // If inFlowFrame is an inline, then it cannot possibly have caused the
@@ -10738,29 +10760,52 @@ nsCSSFrameConstructor::WipeContainingBlo
                                            const FrameConstructionItemList& aItems,
                                            PRBool aIsAppend,
                                            nsIFrame* aPrevSibling)
 {
   if (aItems.IsEmpty()) {
     return PR_FALSE;
   }
   
-  // Before we go and append the frames, we must check for two
+  // Before we go and append the frames, we must check for three
   // special situations.
 
   // Situation #1 is a XUL frame that contains frames that are required
   // to be wrapped in blocks.
   if (aFrame->IsBoxFrame() &&
       !(aFrame->GetStateBits() & NS_STATE_BOX_WRAPS_KIDS_IN_BLOCK) &&
       aItems.AnyItemsNeedBlockParent()) {
     RecreateFramesForContent(aFrame->GetContent());
     return PR_TRUE;
   }
 
-  // Situation #2 is an inline frame that will now contain block
+  // Situation #2 is a case when table pseudo-frames don't work out right
+  ParentType parentType = GetParentType(aFrame);
+  // If all the kids want a parent of the type that aFrame is, then we're all
+  // set to go.  Indeed, there won't be any table pseudo-frames created between
+  // aFrame and the kids, so those won't need to be merged with any table
+  // pseudo-frames that might already be kids of aFrame.  If aFrame itself is a
+  // table pseudo-frame, then all the kids in this list would have wanted a
+  // frame of that type wrapping them anyway, so putting them inside it is ok.
+  if (!aItems.AllWantParentType(parentType)) {
+    // We might be able to figure out some sort of optimizations here, but they
+    // would have to depend on having a correct aPrevSibling and a correct next
+    // sibling.  For example, we can probably avoid reframing if none of
+    // aFrame, aPrevSibling, and next sibling are table pseudo-frames.  But it
+    // doesn't seem worth it to worry about that for now, especially since we
+    // in fact do not have a reliable aPrevSibling, nor any next sibling, in
+    // this method.
+
+    // Reframing aFrame->GetContent() is good enough, since the content of
+    // table pseudo-frames is the ancestor content.
+    RecreateFramesForContent(aFrame->GetContent());
+    return PR_TRUE;
+  }
+
+  // Situation #3 is an inline frame that will now contain block
   // frames. This is a no-no and the frame construction logic knows
   // how to fix this.  See defition of IsInlineFrame() for what "an
   // inline" is.  Whether we have "a block" is tested for by
   // AreAllItemsInline.
 
   // We also need to check for an append of content ending in an
   // inline to the block in an {ib} split or an insert of content
   // starting with an inline to the start of that block.  If that
--- a/layout/reftests/first-line/reftest.list
+++ b/layout/reftests/first-line/reftest.list
@@ -18,13 +18,13 @@ fails == out-of-flow-1d.html out-of-flow
 == stress-3.html about:blank # assertion test
 == stress-4.html about:blank # assertion/crash test
 == stress-5.html about:blank # assertion/crash test
 == stress-6.html about:blank # assertion/crash test
 == stress-7.html about:blank # assertion/crash test
 == stress-8.html stress-8-ref.html # assertion/crash test
 == stress-9.html stress-9-ref.html # assertion/crash test
 == stress-10.html about:blank # crash test
-fails == stress-11.xhtml stress-11-ref.xhtml # crash test, fails due to bug 402933
+== stress-11.xhtml stress-11-ref.xhtml
 
 == border-not-apply.html border-not-apply-ref.html
 == 469227-2.html 469227-2-ref.html
 == 469227-3.html 469227-3-ref.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/121142-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+  <body>
+    <table cellspacing="0" cellpadding="0" style="border: none; padding: 0; margin: 0">
+      <tr>
+        <td>Cell 1</td>
+        <td>Cell 2</td>
+      </tr>
+    </table>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/121142-1a.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+  <body>
+    <span style="display:table">
+      <span style="display: table-row-group">
+        <span style="display: table-row">
+          <span style="display: table-cell">
+            Cell 1
+          </span>
+          <script type="text/javascript">document.body.offsetWidth</script>
+          <span style="display: table-cell">
+            Cell 2
+          </span>
+        </span>
+      </span>
+    </span>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/121142-1b.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+  <body>
+    <span style="display:table">
+      <span style="display: table-cell">
+        Cell 1
+      </span>
+      <script type="text/javascript">document.body.offsetWidth</script>
+      <span style="display: table-cell">
+        Cell 2
+      </span>
+    </span>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/121142-2-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+  <body>
+    <table cellspacing="0" cellpadding="0" style="border: none; padding: 0; margin: 0">
+      <tr>
+        <td>Cell 1 Cell 2</td>
+      </tr>
+    </table>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/121142-2.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+  <body>
+    <span style="display:table">
+      Cell 1
+      <script type="text/javascript">document.body.offsetWidth</script>
+      Cell 2
+    </span>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/208305-2.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <style id="s">
+      span { display: block ! important }
+    </style>
+    <script>
+      function doTest() {
+        var s = document.getElementById("s");
+        s.disabled = true;
+        document.documentElement.className = "";
+      }
+    </script>
+  </head>
+  <body onload="doTest()">
+    <span style="display: table-cell">a b</span>
+    <span style="display: table-cell">c d</span>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/208305-3.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <style id="s">
+      span { display: table-cell ! important }
+    </style>
+  </head>
+  <body>
+    <span style="display: block">a b</span>
+    <span style="display: block">c d</span>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/208305-4.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <style id="s">
+      span { display: table-cell ! important }
+    </style>
+    <script>
+      function doTest() {
+        var s = document.getElementById("s");
+        s.disabled = true;
+        document.body.offsetWidth;
+        s.disabled = false;
+        document.documentElement.className = "";
+      }
+    </script>
+  </head>
+  <body onload="doTest()">
+    <span style="display: block">a b</span>
+    <span style="display: block">c d</span>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/325543-1-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+  <body>
+    <div>First line</div>
+    <div>Second line</div>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/325543-1a.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+  <body onload="document.getElementById('t').style.display = 'block'">
+    <!-- Lack of space between the two spans is key -->
+    <span style="display: table-cell">First line</span><span style="display: none" id="t">Second line</span>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/325543-1b.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+  <body onload="document.getElementById('t').style.display = 'block'">
+    <!-- space between the two spans is key -->
+    <span style="display: table-cell">First line</span> <span style="display: none" id="t">Second line</span>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/368932-1-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+    <table><tr><td>cloning material</td></tr></table>
+    <table><tr><td>cloning material</td></tr></table>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/368932-1.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <script type="text/javascript">
+    function doTest() {
+      for (var i = 0; i < 10; ++i) {
+        // clear target element's content
+        document.getElementById("target-table").innerHTML = "";
+        // clone and append new row
+        cloned_row = document.getElementById("row-template").cloneNode(true);
+        document.getElementById("target-table").appendChild(cloned_row);
+        document.body.offsetWidth;
+      }
+    }
+    </script>
+</head>
+<body onload="doTest()">
+    <table><tr id="row-template"><td>cloning material</td></tr></table>
+    <table id="target-table"><tr><td>target table</td></tr></table>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/371054-1-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+  <body>
+    <table style="border-collapse: collapse">
+      <tr style="display: block; border: 5px solid">
+        <td>LongLongLong</td>
+      </tr>
+      <tr style="border: 5px solid" id="t">
+        <td>Short</td>
+      </tr>
+    </table>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/371054-1.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <script>
+      function doTest() {
+        document.getElementById("t").style.display = "table-row";
+      }
+    </script>
+  </head>
+  <body onload="doTest()">
+    <table style="border-collapse: collapse">
+      <tr style="display: block; border: 5px solid">
+        <td>LongLongLong</td>
+      </tr>
+      <tr style="display: none; border: 5px solid" id="t">
+        <td>Short</td>
+      </tr>
+    </table>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/372649-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+#it { display: inline-table; }
+</style>
+</head>
+<body>
+<p>a<span id="it">bc</span>d</p>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/372649-1.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+#it { display: inline-table; }
+</style>
+</head>
+<body>
+<p>a<span id="it">b</span>d</p>
+<script>
+document.body.offsetWidth;
+document.getElementById("it").appendChild(document.createTextNode("c"));
+</script>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/394402-1-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <script>
+      function runTest() {
+        document.getElementById('r').appendChild(document.createTextNode('x'));
+        document.getElementById('r').appendChild(document.createTextNode('x'));
+        document.getElementById('r').appendChild(document.createTextNode('x'));
+        document.body.normalize();
+        document.getElementById('t').style.display = "";
+        document.documentElement.className = "";
+      }
+    </script>
+  </head>
+<body onload="runTest()">
+
+<table style="display: none" border=1 id="t"><tbody><tr id="r"><td id="c">TD</td></tr></tbody></table>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/394402-1a.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <script>
+      function runTest() {
+        document.getElementById('r').appendChild(document.createTextNode('x'));
+        document.getElementById('r').appendChild(document.createTextNode('x'));
+        document.getElementById('r').appendChild(document.createTextNode('x'));
+        document.documentElement.className = "";
+      }
+    </script>
+  </head>
+<body onload="runTest()">
+
+<table border=1 id="t"><tbody><tr id="r"><td id="c">TD</td></tr></tbody></table>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/394402-1b.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <script>
+      function runTest() {
+        document.getElementById('r').appendChild(document.createTextNode('x'));
+        document.getElementById('r').appendChild(document.createTextNode('x'));
+        document.getElementById('r').appendChild(document.createTextNode('x'));
+        document.body.normalize();
+        document.documentElement.className = "";
+      }
+    </script>
+  </head>
+<body onload="runTest()">
+
+<table border=1 id="t"><tbody><tr id="r"><td id="c">TD</td></tr></tbody></table>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/448111-1-ref.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<body>
+  <table border="1"><tr>
+    <td style="float: left; height: 200px">
+    </td>
+    <td style="float: right">
+      Right
+    </td></tr>
+  </table>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/448111-1.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<body>
+  <table border="1"><tr>
+    <td style="float: left; height: 200px">
+	  <script type="text/javascript">v = document.body.offsetHeight;</script>
+    </td>
+    <td style="float: right">
+      Right
+    </td></tr>
+  </table>
+</body>
+</html>
--- a/layout/reftests/table-anonymous-boxes/blocks-divide-tables-1.html
+++ b/layout/reftests/table-anonymous-boxes/blocks-divide-tables-1.html
@@ -1,20 +1,20 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
-    <div style="display: block"> 
-      <div style="display: table-cell">Row 1, Col 1</div>
-      <div style="display: table-cell">Row 1, Col 2</div>
-      <div style="display: table-cell">Row 1, Col 3</div>
-    </div>
-    <div style="display: block"> 
-      <div style="display: table-cell">Row 22, Col 1</div>
-      <div style="display: table-cell">Row 22, Col 2</div>
-      <div style="display: table-cell">Row 22, Col 3</div>
-    </div>
-    <div style="display: block"> 
-      <div style="display: table-cell">Row 333, Col 1</div>
-      <div style="display: table-cell">Row 333, Col 2</div>
-      <div style="display: table-cell">Row 333, Col 3</div>
-    </div>
+    <span style="display: block"> 
+      <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: block"> 
+      <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 style="display: block"> 
+      <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>
--- a/layout/reftests/table-anonymous-boxes/blocks-divide-tables-2.html
+++ b/layout/reftests/table-anonymous-boxes/blocks-divide-tables-2.html
@@ -1,20 +1,20 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
-    <div style="display: table-row"> 
-      <div style="display: table-cell">Row 1, Col 1</div>
-      <div style="display: table-cell">Row 1, Col 2</div>
-      <div style="display: table-cell">Row 1, Col 3</div>
-    </div>
-    <div style="display: block"> 
-      <div style="display: table-cell">Row 22, Col 1</div>
-      <div style="display: table-cell">Row 22, Col 2</div>
-      <div style="display: table-cell">Row 22, Col 3</div>
-    </div>
-    <div style="display: table-row"> 
-      <div style="display: table-cell">Row 333, Col 1</div>
-      <div style="display: table-cell">Row 333, Col 2</div>
-      <div style="display: table-cell">Row 333, Col 3</div>
-    </div>
+    <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: block"> 
+      <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 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>
--- a/layout/reftests/table-anonymous-boxes/cols-test-1.html
+++ b/layout/reftests/table-anonymous-boxes/cols-test-1.html
@@ -1,25 +1,25 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
-    <div style="display:table">
-      <div style="display: table-column; background: yellow"></div>
-      <div style="display: table-cell">Row 1, Col 1</div>
-      <div style="display: table-cell">Row 1, Col 2</div>
-      <div style="display: table-cell">Row 1, Col 3</div>
-      <div style="display: table-column; background: cyan"></div>
-      <div style="display: table-row-group"> 
-        <div style="display: table-row">
-          <div style="display: table-cell">Row 22, Col 1</div>
-          <div style="display: table-cell">Row 22, Col 2</div>
-          <div style="display: table-cell">Row 22, Col 3</div>
-        </div>
-        <div style="display: table-row">
-          <div style="display: table-cell">Row 333, Col 1</div>
-          <div style="display: table-cell">Row 333, Col 2</div>
-          <div style="display: table-cell">Row 333, Col 3</div>
-        </div>
-      </div>
-      <div style="display: table-column; background: lime"></div>
-    </div>
+    <span style="display:table">
+      <span style="display: table-column; background: yellow"></span>
+      <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 style="display: table-column; background: cyan"></span>
+      <span style="display: table-row-group"> 
+        <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 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>
+      <span style="display: table-column; background: lime"></span>
+    </span>
   </body>
 </html>
--- a/layout/reftests/table-anonymous-boxes/cols-test-2.html
+++ b/layout/reftests/table-anonymous-boxes/cols-test-2.html
@@ -1,25 +1,25 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
-    <div style="display:table">
-      <div style="display: table-column; background: yellow"></div>
-      <div style="display: table-column; background: cyan"></div>
-      <div style="display: table-column; background: lime"></div>
-      <div style="display: table-cell">Row 1, Col 1</div>
-      <div style="display: table-cell">Row 1, Col 2</div>
-      <div style="display: table-cell">Row 1, Col 3</div>
-      <div style="display: table-row-group"> 
-        <div style="display: table-row">
-          <div style="display: table-cell">Row 22, Col 1</div>
-          <div style="display: table-cell">Row 22, Col 2</div>
-          <div style="display: table-cell">Row 22, Col 3</div>
-        </div>
-        <div style="display: table-row">
-          <div style="display: table-cell">Row 333, Col 1</div>
-          <div style="display: table-cell">Row 333, Col 2</div>
-          <div style="display: table-cell">Row 333, Col 3</div>
-        </div>
-      </div>
-    </div>
+    <span style="display:table">
+      <span style="display: table-column; background: yellow"></span>
+      <span style="display: table-column; background: cyan"></span>
+      <span style="display: table-column; background: lime"></span>
+      <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 style="display: table-row-group"> 
+        <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 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>
+    </span>
   </body>
 </html>
--- a/layout/reftests/table-anonymous-boxes/cols-test-3.html
+++ b/layout/reftests/table-anonymous-boxes/cols-test-3.html
@@ -1,25 +1,25 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
-    <div style="display:table">
-      <div style="display: table-cell">Row 1, Col 1</div>
-      <div style="display: table-cell">Row 1, Col 2</div>
-      <div style="display: table-cell">Row 1, Col 3</div>
-      <div style="display: table-row-group"> 
-        <div style="display: table-row">
-          <div style="display: table-cell">Row 22, Col 1</div>
-          <div style="display: table-cell">Row 22, Col 2</div>
-          <div style="display: table-cell">Row 22, Col 3</div>
-        </div>
-        <div style="display: table-row">
-          <div style="display: table-cell">Row 333, Col 1</div>
-          <div style="display: table-cell">Row 333, Col 2</div>
-          <div style="display: table-cell">Row 333, Col 3</div>
-        </div>
-      </div>
-      <div style="display: table-column; background: yellow"></div>
-      <div style="display: table-column; background: cyan"></div>
-      <div style="display: table-column; background: lime"></div>
-    </div>
+    <span style="display:table">
+      <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 style="display: table-row-group"> 
+        <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 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>
+      <span style="display: table-column; background: yellow"></span>
+      <span style="display: table-column; background: cyan"></span>
+      <span style="display: table-column; background: lime"></span>
+    </span>
   </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/dynamic-insert-cell-1.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <script>
+      function doTest() {
+        var c = document.createElement("span");
+        c.style.display = "table-cell";
+        c.textContent = "Row 22, Col 1";
+        var t = document.getElementById("t");
+        t.parentNode.insertBefore(c, t);
+        document.documentElement.className = "";
+      }
+    </script>
+  </head>
+  <body style="font-family: monospace" onload="doTest()">
+    <span style="display:table">
+      <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 style="display: table-cell" id="t">Row 22, Col 2</span>
+        <span style="display: table-cell">Row 22, Col 3</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>
+      </span>
+    </span>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/dynamic-removal-14.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <script>
+      function doTest() {
+        document.normalize();
+        var n = document.getElementById("t").nextSibling;
+        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" id="t">
+      <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>This is a test<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-switch-block-to-cell-1.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <script>
+      function doTest() {
+        document.getElementById("t").style.display = "table-cell";
+        document.documentElement.className = "";
+      }
+    </script>
+  </head>
+  <body style="font-family: monospace" onload="doTest()">
+    <span style="display:table">
+      <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 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 style="display: table-row">
+          <span style="display: block" id="t">Row 333, Col 1</span>
+          <span style="display: block">Row 333, Col 2</span>
+          <span style="display: table-cell">Row 333, Col 3</span>
+        </span>
+      </span>
+    </span>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/dynamic-switch-block-to-cell-2.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <script>
+      function doTest() {
+        document.getElementById("t").style.display = "table-cell";
+        document.documentElement.className = "";
+      }
+    </script>
+  </head>
+  <body style="font-family: monospace" onload="doTest()">
+    <span style="display:table">
+      <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 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 style="display: table-row">
+          <span style="display: block">Row 333, Col 1</span>
+          <span style="display: block" id="t">Row 333, Col 2</span>
+          <span style="display: table-cell">Row 333, Col 3</span>
+        </span>
+      </span>
+    </span>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/dynamic-switch-block-to-cell-3.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <script>
+      function doTest() {
+        document.getElementById("t").style.display = "table-cell";
+        document.documentElement.className = "";
+      }
+    </script>
+  </head>
+  <body style="font-family: monospace" onload="doTest()">
+    <span style="display:table">
+      <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 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 style="display: table-row">
+          <span style="display: block">Row 333, Col 1</span>
+          <span style="display: block" id="t">Row 333, Col 2</span>
+          <span style="display: block">Row 333, Col 3</span>
+        </span>
+      </span>
+    </span>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/dynamic-switch-block-to-cell-4.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <script>
+      function doTest() {
+        document.getElementById("t").style.display = "table-cell";
+        document.documentElement.className = "";
+      }
+    </script>
+  </head>
+  <body style="font-family: monospace" onload="doTest()">
+    <span style="display:table">
+      <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 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 style="display: table-row">
+          <span style="display: table-cell">Row 333, Col 1</span>
+          <span style="display: block" id="t">Row 333, Col 2</span>
+          <span style="display: block">Row 333, Col 3</span>
+        </span>
+      </span>
+    </span>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/dynamic-switch-block-to-cell-5.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <script>
+      function doTest() {
+        document.getElementById("t").style.display = "table-cell";
+        document.documentElement.className = "";
+      }
+    </script>
+  </head>
+  <body style="font-family: monospace" onload="doTest()">
+    <span style="display:table">
+      <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 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 style="display: table-row">
+          <span style="display: table-cell">Row 333, Col 1</span>
+          <span style="display: block">Row 333, Col 2</span>
+          <span style="display: block" id="t">Row 333, Col 3</span>
+        </span>
+      </span>
+    </span>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/dynamic-switch-inline-to-cell-1.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <script>
+      function doTest() {
+        document.getElementById("t").style.display = "table-cell";
+        document.documentElement.className = "";
+      }
+    </script>
+  </head>
+  <body style="font-family: monospace" onload="doTest()">
+    <span style="display:table">
+      <span style="display: table-row">
+        <span id="t">Row 1, Col 1</span>
+        <span>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-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 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>
+    </span>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/dynamic-switch-inline-to-cell-2.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <script>
+      function doTest() {
+        document.getElementById("t").style.display = "table-cell";
+        document.documentElement.className = "";
+      }
+    </script>
+  </head>
+  <body style="font-family: monospace" onload="doTest()">
+    <span style="display:table">
+      <span style="display: table-row">
+        <span>Row 1, Col 1</span>
+        <span id="t">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-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 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>
+    </span>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/dynamic-switch-inline-to-cell-3.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <script>
+      function doTest() {
+        document.getElementById("t").style.display = "table-cell";
+        document.documentElement.className = "";
+      }
+    </script>
+  </head>
+  <body style="font-family: monospace" onload="doTest()">
+    <span style="display:table">
+      <span style="display: table-row">
+        <span>Row 1, Col 1</span>
+        <span id="t">Row 1, Col 2</span>
+        <span>Row 1, Col 3</span>
+      </span>
+      <span style="display: table-row-group"> 
+        <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 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>
+    </span>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/dynamic-switch-inline-to-cell-4.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <script>
+      function doTest() {
+        document.getElementById("t").style.display = "table-cell";
+        document.documentElement.className = "";
+      }
+    </script>
+  </head>
+  <body style="font-family: monospace" onload="doTest()">
+    <span style="display:table">
+      <span style="display: table-row">
+        <span style="display: table-cell">Row 1, Col 1</span>
+        <span id="t">Row 1, Col 2</span>
+        <span>Row 1, Col 3</span>
+      </span>
+      <span style="display: table-row-group"> 
+        <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 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>
+    </span>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/dynamic-switch-inline-to-cell-5.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <script>
+      function doTest() {
+        document.getElementById("t").style.display = "table-cell";
+        document.documentElement.className = "";
+      }
+    </script>
+  </head>
+  <body style="font-family: monospace" onload="doTest()">
+    <span style="display:table">
+      <span style="display: table-row">
+        <span style="display: table-cell">Row 1, Col 1</span>
+        <span>Row 1, Col 2</span>
+        <span id="t">Row 1, Col 3</span>
+      </span>
+      <span style="display: table-row-group"> 
+        <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 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>
+    </span>
+  </body>
+</html>
--- a/layout/reftests/table-anonymous-boxes/infer-cells-1.html
+++ b/layout/reftests/table-anonymous-boxes/infer-cells-1.html
@@ -1,18 +1,18 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
     <!-- The test in the first row might not be correct, depending on spec
          clarifications -->
-    <div style="display: table-row"> 
+    <span style="display: table-row"> 
       <span>Row 1, Col 1</span>
       <span>Row 1, Col 2</span>
       <span>Row 1, Col 3</span>
-    </div>
-    <div style="display: table-row"> 
-      <div style="display: block">Row 22, Col 1Row 22, Col 2Row 22, Col 3</div>
-    </div>
-    <div style="display: table-row">
+    </span>
+    <span style="display: table-row"> 
+      <span style="display: block">Row 22, Col 1Row 22, Col 2Row 22, Col 3</span>
+    </span>
+    <span style="display: table-row">
       <span>Row 333, Col 1</span><span>Row 333, Col 2</span><span>Row 333, Col 3</span>
-    </div>
+    </span>
   </body>
 </html>
--- a/layout/reftests/table-anonymous-boxes/infer-cells-2.html
+++ b/layout/reftests/table-anonymous-boxes/infer-cells-2.html
@@ -1,29 +1,29 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
-    <div style="display: table-row"> 
+    <span style="display: table-row"> 
       <!-- Trailing spaces in the spans needed only if the first test in
            infer-cells-1.html is valid -->
       <span>Row 1, </span>
       <span>Col 1</span>
-      <div style="display: table-cell">Row 1, Col 2</div>
-      <div>Row 1, Col 3</div>
-    </div>
-    <div style="display: table-row"> 
-      <div style="display: table-cell">Row 22, Col 1</div>
+      <span style="display: table-cell">Row 1, Col 2</span>
+      <span>Row 1, Col 3</span>
+    </span>
+    <span style="display: table-row"> 
+      <span style="display: table-cell">Row 22, Col 1</span>
       <span>Row </span>
       <span>22, </span>
       <span>Col </span>
       <span>2</span>
-      <div style="display: table-cell">Row 22, Col 3</div>
-    </div>
-    <div style="display: table-row">
-      <div style="display: table-cell">Row 333, Col 1</div>
-      <div style="display: table-cell">Row 333, Col 2</div>
+      <span style="display: table-cell">Row 22, Col 3</span>
+    </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>Row </span>
       <span>333, </span>
       <span>Col </span>
       <span>3</span>
-    </div>
+    </span>
   </body>
 </html>
--- a/layout/reftests/table-anonymous-boxes/infer-cells-3.html
+++ b/layout/reftests/table-anonymous-boxes/infer-cells-3.html
@@ -1,29 +1,29 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
-    <div style="display: table-row"> 
+    <span style="display: table-row"> 
       <!-- Trailing spaces in the spans needed only if the first test in
            infer-cells-1.html is valid -->
       <span>Row 1, </span>
       <span>Col 1</span>
-      <div style="display: table-cell">Row 1, Col 2</div>
-      <div style="display: table-row">Row 1, Col 3</div>
-    </div>
-    <div style="display: table-row"> 
-      <div style="display: table-cell">Row 22, Col 1</div>
+      <span style="display: table-cell">Row 1, Col 2</span>
+      <span style="display: table-row">Row 1, Col 3</span>
+    </span>
+    <span style="display: table-row"> 
+      <span style="display: table-cell">Row 22, Col 1</span>
       <span>Row </span>
       <span>22, </span>
       <span>Col </span>
       <span>2</span>
-      <div style="display: table-cell">Row 22, Col 3</div>
-    </div>
-    <div style="display: table-row">
-      <div style="display: table-row-group">Row 333, Col 1</div>
-      <div style="display: table-cell">Row 333, Col 2</div>
+      <span style="display: table-cell">Row 22, Col 3</span>
+    </span>
+    <span style="display: table-row">
+      <span style="display: table-row-group">Row 333, Col 1</span>
+      <span style="display: table-cell">Row 333, Col 2</span>
       <span>Row </span>
       <span>333, </span>
       <span>Col </span>
       <span>3</span>
-    </div>
+    </span>
   </body>
 </html>
--- a/layout/reftests/table-anonymous-boxes/infer-cells-4.html
+++ b/layout/reftests/table-anonymous-boxes/infer-cells-4.html
@@ -1,29 +1,29 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
-    <div style="display: table-row"> 
+    <span style="display: table-row"> 
       <!-- Trailing spaces in the spans needed only if the first test in
            infer-cells-1.html is valid -->
       <span>Row 1, </span>
       <span>Col 1</span>
-      <div style="display: table-cell">Row 1, Col 2</div>
-      <div style="display: table">Row 1, Col 3</div>
-    </div>
-    <div style="display: table-row"> 
-      <div style="display: table-cell">Row 22, Col 1</div>
+      <span style="display: table-cell">Row 1, Col 2</span>
+      <span style="display: table">Row 1, Col 3</span>
+    </span>
+    <span style="display: table-row"> 
+      <span style="display: table-cell">Row 22, Col 1</span>
       <span>Row </span>
       <span>22, </span>
       <span>Col </span>
       <span>2</span>
-      <div style="display: table-cell">Row 22, Col 3</div>
-    </div>
-    <div style="display: table-row">
-      <div style="display: inline-table">Row 333, Col 1</div>
-      <div style="display: table-cell">Row 333, Col 2</div>
+      <span style="display: table-cell">Row 22, Col 3</span>
+    </span>
+    <span style="display: table-row">
+      <span style="display: inline-table">Row 333, Col 1</span>
+      <span style="display: table-cell">Row 333, Col 2</span>
       <span>Row </span>
       <span>333, </span>
       <span>Col </span>
       <span>3</span>
-    </div>
+    </span>
   </body>
 </html>
--- a/layout/reftests/table-anonymous-boxes/infer-first-row-and-table.html
+++ b/layout/reftests/table-anonymous-boxes/infer-first-row-and-table.html
@@ -1,20 +1,20 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
-    <div style="display: table-cell">Row 1, Col 1</div>
-    <div style="display: table-cell">Row 1, Col 2</div>
-    <div style="display: table-cell">Row 1, Col 3</div>
-    <div style="display: table-row-group"> 
-      <div style="display: table-row">
-        <div style="display: table-cell">Row 22, Col 1</div>
-        <div style="display: table-cell">Row 22, Col 2</div>
-        <div style="display: table-cell">Row 22, Col 3</div>
-      </div>
-      <div style="display: table-row">
-        <div style="display: table-cell">Row 333, Col 1</div>
-        <div style="display: table-cell">Row 333, Col 2</div>
-        <div style="display: table-cell">Row 333, Col 3</div>
-      </div>
-    </div>
+    <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 style="display: table-row-group"> 
+      <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 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/infer-first-row.html
+++ b/layout/reftests/table-anonymous-boxes/infer-first-row.html
@@ -1,22 +1,22 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
-    <div style="display:table">
-      <div style="display: table-cell">Row 1, Col 1</div>
-      <div style="display: table-cell">Row 1, Col 2</div>
-      <div style="display: table-cell">Row 1, Col 3</div>
-      <div style="display: table-row-group"> 
-        <div style="display: table-row">
-          <div style="display: table-cell">Row 22, Col 1</div>
-          <div style="display: table-cell">Row 22, Col 2</div>
-          <div style="display: table-cell">Row 22, Col 3</div>
-        </div>
-        <div style="display: table-row">
-          <div style="display: table-cell">Row 333, Col 1</div>
-          <div style="display: table-cell">Row 333, Col 2</div>
-          <div style="display: table-cell">Row 333, Col 3</div>
-        </div>
-      </div>
-    </div>
+    <span style="display:table">
+      <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 style="display: table-row-group"> 
+        <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 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>
+    </span>
   </body>
 </html>
--- a/layout/reftests/table-anonymous-boxes/infer-rows-inside-rowgroups.html
+++ b/layout/reftests/table-anonymous-boxes/infer-rows-inside-rowgroups.html
@@ -1,20 +1,20 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
-    <div style="display: table-footer-group"> 
-      <div style="display: table-cell">Row 333, Col 1</div>
-      <div style="display: table-cell">Row 333, Col 2</div>
-      <div style="display: table-cell">Row 333, Col 3</div>
-    </div>
-    <div style="display: table-row-group"> 
-      <div style="display: table-cell">Row 22, Col 1</div>
-      <div style="display: table-cell">Row 22, Col 2</div>
-      <div style="display: table-cell">Row 22, Col 3</div>
-    </div>
-    <div style="display: table-header-group"> 
-      <div style="display: table-cell">Row 1, Col 1</div>
-      <div style="display: table-cell">Row 1, Col 2</div>
-      <div style="display: table-cell">Row 1, Col 3</div>
-    </div>
+    <span style="display: table-footer-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>
+    <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 style="display: table-header-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>
   </body>
 </html>
--- a/layout/reftests/table-anonymous-boxes/infer-second-row-and-table.html
+++ b/layout/reftests/table-anonymous-boxes/infer-second-row-and-table.html
@@ -1,22 +1,22 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
-    <div style="display: table-row-group">
-      <div style="display: table-row">
-        <div style="display: table-cell">Row 1, Col 1</div>
-        <div style="display: table-cell">Row 1, Col 2</div>
-        <div style="display: table-cell">Row 1, Col 3</div>
-      </div>
-    </div>
-    <div style="display: table-cell">Row 22, Col 1</div>
-    <div style="display: table-cell">Row 22, Col 2</div>
-    <div style="display: table-cell">Row 22, Col 3</div>
-    <div style="display: table-row-group"> 
-      <div style="display: table-row">
-        <div style="display: table-cell">Row 333, Col 1</div>
-        <div style="display: table-cell">Row 333, Col 2</div>
-        <div style="display: table-cell">Row 333, Col 3</div>
-      </div>
-    </div>
+    <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 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/infer-second-row.html
+++ b/layout/reftests/table-anonymous-boxes/infer-second-row.html
@@ -1,24 +1,24 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
-    <div style="display:table">
-      <div style="display: table-row-group">
-        <div style="display: table-row">
-          <div style="display: table-cell">Row 1, Col 1</div>
-          <div style="display: table-cell">Row 1, Col 2</div>
-          <div style="display: table-cell">Row 1, Col 3</div>
-        </div>
-      </div>
-      <div style="display: table-cell">Row 22, Col 1</div>
-      <div style="display: table-cell">Row 22, Col 2</div>
-      <div style="display: table-cell">Row 22, Col 3</div>
-      <div style="display: table-row-group"> 
-        <div style="display: table-row">
-          <div style="display: table-cell">Row 333, Col 1</div>
-          <div style="display: table-cell">Row 333, Col 2</div>
-          <div style="display: table-cell">Row 333, Col 3</div>
-        </div>
-      </div>
-    </div>
+    <span style="display:table">
+      <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 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>
+    </span>
   </body>
 </html>
--- a/layout/reftests/table-anonymous-boxes/infer-table-around-headers-footers-1.html
+++ b/layout/reftests/table-anonymous-boxes/infer-table-around-headers-footers-1.html
@@ -1,26 +1,26 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
-    <div style="display: table-header-group"> 
-      <div style="display: table-row">
-        <div style="display: table-cell">Row 1, Col 1</div>
-        <div style="display: table-cell">Row 1, Col 2</div>
-        <div style="display: table-cell">Row 1, Col 3</div>
-      </div>
-    </div>
-    <div style="display: table-row-group"> 
-      <div style="display: table-row">
-        <div style="display: table-cell">Row 22, Col 1</div>
-        <div style="display: table-cell">Row 22, Col 2</div>
-        <div style="display: table-cell">Row 22, Col 3</div>
-      </div>
-    </div>
-    <div style="display: table-footer-group"> 
-      <div style="display: table-row">
-        <div style="display: table-cell">Row 333, Col 1</div>
-        <div style="display: table-cell">Row 333, Col 2</div>
-        <div style="display: table-cell">Row 333, Col 3</div>
-      </div>
-    </div>
+    <span style="display: table-header-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-row-group"> 
+      <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>
+    <span style="display: table-footer-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/infer-table-around-headers-footers-2.html
+++ b/layout/reftests/table-anonymous-boxes/infer-table-around-headers-footers-2.html
@@ -1,26 +1,26 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
-    <div style="display: table-row-group"> 
-      <div style="display: table-row">
-        <div style="display: table-cell">Row 22, Col 1</div>
-        <div style="display: table-cell">Row 22, Col 2</div>
-        <div style="display: table-cell">Row 22, Col 3</div>
-      </div>
-    </div>
-    <div style="display: table-header-group"> 
-      <div style="display: table-row">
-        <div style="display: table-cell">Row 1, Col 1</div>
-        <div style="display: table-cell">Row 1, Col 2</div>
-        <div style="display: table-cell">Row 1, Col 3</div>
-      </div>
-    </div>
-    <div style="display: table-footer-group"> 
-      <div style="display: table-row">
-        <div style="display: table-cell">Row 333, Col 1</div>
-        <div style="display: table-cell">Row 333, Col 2</div>
-        <div style="display: table-cell">Row 333, Col 3</div>
-      </div>
-    </div>
+    <span style="display: table-row-group"> 
+      <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>
+    <span style="display: table-header-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-footer-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/infer-table-around-headers-footers-3.html
+++ b/layout/reftests/table-anonymous-boxes/infer-table-around-headers-footers-3.html
@@ -1,26 +1,26 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
-    <div style="display: table-footer-group"> 
-      <div style="display: table-row">
-        <div style="display: table-cell">Row 333, Col 1</div>
-        <div style="display: table-cell">Row 333, Col 2</div>
-        <div style="display: table-cell">Row 333, Col 3</div>
-      </div>
-    </div>
-    <div style="display: table-row-group"> 
-      <div style="display: table-row">
-        <div style="display: table-cell">Row 22, Col 1</div>
-        <div style="display: table-cell">Row 22, Col 2</div>
-        <div style="display: table-cell">Row 22, Col 3</div>
-      </div>
-    </div>
-    <div style="display: table-header-group"> 
-      <div style="display: table-row">
-        <div style="display: table-cell">Row 1, Col 1</div>
-        <div style="display: table-cell">Row 1, Col 2</div>
-        <div style="display: table-cell">Row 1, Col 3</div>
-      </div>
-    </div>
+    <span style="display: table-footer-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>
+    <span style="display: table-row-group"> 
+      <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>
+    <span style="display: table-header-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>
   </body>
 </html>
--- a/layout/reftests/table-anonymous-boxes/infer-table-row-cell.html
+++ b/layout/reftests/table-anonymous-boxes/infer-table-row-cell.html
@@ -1,27 +1,27 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
-    <div style="display: table-row-group">
-      <div style="display: table-cell">Row 1, Col 1</div>
-      <div style="display: block">Row 1, Col 2</div>
-      <div style="display: table-cell">Row 1, Col 3</div>
-    </div>
-    <div style="display: table-row-group">
-      <div style="display: table-row">
-        <div style="display: table-cell">Row 22, Col 1</div>
-        <div style="display: table-cell">Row 22, Col 2</div>
-        <div style="display: table-cell">Row 22, Col 3</div>
-      </div>
-    </div>
-    <div style="display: table-row-group">
-      <div style="display: table-row">
-        <div style="display: table-cell">Row 333, Col 1</div>
-        <div style="display: table-cell">Row 333, Col 2</div>
-        <div style="display: table-cell">Row 333, Col 3</div>
-      </div>
-    </div>
+    <span style="display: table-row-group">
+      <span style="display: table-cell">Row 1, Col 1</span>
+      <span style="display: block">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-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>
+    <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/infer-table.html
+++ b/layout/reftests/table-anonymous-boxes/infer-table.html
@@ -1,20 +1,20 @@
 <!DOCTYPE html>
 <html>
   <body style="font-family: monospace">
-    <div style="display: table-row"> 
-      <div style="display: table-cell">Row 1, Col 1</div>
-      <div style="display: table-cell">Row 1, Col 2</div>
-      <div style="display: table-cell">Row 1, Col 3</div>
-    </div>
-    <div style="display: table-row"> 
-      <div style="display: table-cell">Row 22, Col 1</div>
-      <div style="display: table-cell">Row 22, Col 2</div>
-      <div style="display: table-cell">Row 22, Col 3</div>
-    </div>
-    <div style="display: table-row"> 
-      <div style="display: table-cell">Row 333, Col 1</div>
-      <div style="display: table-cell">Row 333, Col 2</div>
-      <div style="display: table-cell">Row 333, Col 3</div>
-    </div>
+    <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 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>
--- a/layout/reftests/table-anonymous-boxes/reftest.list
+++ b/layout/reftests/table-anonymous-boxes/reftest.list
@@ -1,23 +1,37 @@
+== 121142-1a.html 121142-1-ref.html
+== 121142-1b.html 121142-1-ref.html
+== 121142-2.html 121142-2-ref.html
 fails == 156888-1.html 156888-1-ref.html # bug 484825
 == 156888-2.html 156888-2-ref.html
 == 162063-1.xhtml about:blank
 == 203923-1.html white-space-1-ref.html
 == 203923-2.html white-space-1-ref.html
 == 208305-1.html 208305-1-ref.html
+== 208305-2.html white-space-1-ref.html
+== 208305-3.html white-space-1-ref.html
+== 208305-4.html white-space-1-ref.html
 == 277995-1.html 277995-1-ref.html
 == 293576-1.html 293576-1-ref.html
 == 302113-1.html 302113-1-ref.html
 == 315146-1.xhtml 315146-1-ref.xhtml
+== 325543-1a.html 325543-1-ref.html
+== 325543-1b.html 325543-1-ref.html
 == 338735-1.html 338735-1-ref.html
 == 339388-1a.html 339388-1-ref.html
 == 339388-1b.html 339388-1-ref.html
+== 368932-1.html 368932-1-ref.html
+== 371054-1.html 371054-1-ref.html
+== 372649-1.html 372649-1-ref.html
 == 373379-1.html 373379-1-ref.html
+== 394402-1a.html 394402-1-ref.html
+== 394402-1b.html 394402-1-ref.html
 == 407115-1.html 407115-1-ref.html
+== 448111-1.html 448111-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
 == infer-second-row-and-table.html 3x3-ref.html
 == infer-table-around-headers-footers-1.html 3x3-ref.html
 == infer-table-around-headers-footers-2.html 3x3-ref.html
 == infer-table-around-headers-footers-3.html 3x3-ref.html
 == infer-rows-inside-rowgroups.html 3x3-ref.html
@@ -30,20 +44,32 @@ fails == 156888-1.html 156888-1-ref.html
 == infer-cells-2.html 3x3-ref.html
 == infer-cells-3.html 3x3-ref.html
 == infer-cells-4.html 3x3-ref.html
 == cols-test-1.html 3x3-cols-ref.html
 == cols-test-2.html 3x3-cols-ref.html
 == cols-test-3.html 3x3-cols-ref.html
 == dynamic-removal-1.html 3x3-ref.html
 == dynamic-removal-2.html 3x3-ref.html
-fails == dynamic-removal-3.html 3x3-ref.html
+== dynamic-removal-3.html 3x3-ref.html
 == dynamic-removal-4.html 3x3-ref.html
 == dynamic-removal-5.html 3x3-ref.html
 == dynamic-removal-6.html 3x3-ref.html
 == dynamic-removal-7.html 3x3-ref.html
 == dynamic-removal-8.html 3x3-ref.html
 == dynamic-removal-9.html white-space-1-ref.html
 == dynamic-removal-10.html white-space-1-ref.html
 == dynamic-removal-11.html white-space-1-ref.html
 == dynamic-removal-12.html white-space-1-ref.html
 == dynamic-removal-13.html 3x3-ref.html
+== dynamic-removal-14.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
+== dynamic-switch-inline-to-cell-3.html 3x3-ref.html
+== dynamic-switch-inline-to-cell-4.html 3x3-ref.html
+== dynamic-switch-inline-to-cell-5.html 3x3-ref.html
 == white-space-1.html white-space-1-ref.html
--- a/layout/reftests/table-anonymous-boxes/white-space-1.html
+++ b/layout/reftests/table-anonymous-boxes/white-space-1.html
@@ -1,11 +1,11 @@
 <!DOCTYPE HTML>
 <html>
   <body>
-    <div style="display: inline;">
+    <span>
       <span>a</span>
       <span style="display: table-cell">b</span>
       <span style="display: table-cell">c</span>
       <span>d</span>
-    </div>
+    </span>
   </body>
 </html>