diff --git a/layout/reftests/reftest.list b/layout/reftests/reftest.list
index 87c1f3e634a0..3587b79a75a6 100644
--- a/layout/reftests/reftest.list
+++ b/layout/reftests/reftest.list
@@ -120,6 +120,9 @@ include svg/reftest.list
# svg-integration/
include svg-integration/reftest.list
+# table-anonymous-boxes/
+include table-anonymous-boxes/reftest.list
+
# table-background/
include table-background/reftest.list
diff --git a/layout/reftests/table-anonymous-boxes/3-tables-ref.html b/layout/reftests/table-anonymous-boxes/3-tables-ref.html
new file mode 100644
index 000000000000..3193b5218a8b
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/3-tables-ref.html
@@ -0,0 +1,26 @@
+
+
+
+
+
+ Row 1, Col 1 |
+ Row 1, Col 2 |
+ Row 1, Col 3 |
+
+
+
+
+ Row 22, Col 1 |
+ Row 22, Col 2 |
+ Row 22, Col 3 |
+
+
+
+
+ Row 333, Col 1 |
+ Row 333, Col 2 |
+ Row 333, Col 3 |
+
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/3x3-cols-ref.html b/layout/reftests/table-anonymous-boxes/3x3-cols-ref.html
new file mode 100644
index 000000000000..43c146f72d46
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/3x3-cols-ref.html
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ Row 1, Col 1 |
+ Row 1, Col 2 |
+ Row 1, Col 3 |
+
+
+ Row 22, Col 1 |
+ Row 22, Col 2 |
+ Row 22, Col 3 |
+
+
+ Row 333, Col 1 |
+ Row 333, Col 2 |
+ Row 333, Col 3 |
+
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/3x3-ref.html b/layout/reftests/table-anonymous-boxes/3x3-ref.html
new file mode 100644
index 000000000000..91bc9e08f923
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/3x3-ref.html
@@ -0,0 +1,22 @@
+
+
+
+
+
+ Row 1, Col 1 |
+ Row 1, Col 2 |
+ Row 1, Col 3 |
+
+
+ Row 22, Col 1 |
+ Row 22, Col 2 |
+ Row 22, Col 3 |
+
+
+ Row 333, Col 1 |
+ Row 333, Col 2 |
+ Row 333, Col 3 |
+
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/blocks-divide-tables-1.html b/layout/reftests/table-anonymous-boxes/blocks-divide-tables-1.html
new file mode 100644
index 000000000000..1731f57841d2
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/blocks-divide-tables-1.html
@@ -0,0 +1,20 @@
+
+
+
+
+
Row 1, Col 1
+
Row 1, Col 2
+
Row 1, Col 3
+
+
+
Row 22, Col 1
+
Row 22, Col 2
+
Row 22, Col 3
+
+
+
Row 333, Col 1
+
Row 333, Col 2
+
Row 333, Col 3
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/blocks-divide-tables-2.html b/layout/reftests/table-anonymous-boxes/blocks-divide-tables-2.html
new file mode 100644
index 000000000000..df345f42f995
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/blocks-divide-tables-2.html
@@ -0,0 +1,20 @@
+
+
+
+
+
Row 1, Col 1
+
Row 1, Col 2
+
Row 1, Col 3
+
+
+
Row 22, Col 1
+
Row 22, Col 2
+
Row 22, Col 3
+
+
+
Row 333, Col 1
+
Row 333, Col 2
+
Row 333, Col 3
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/cols-test-1.html b/layout/reftests/table-anonymous-boxes/cols-test-1.html
new file mode 100644
index 000000000000..104210853c44
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/cols-test-1.html
@@ -0,0 +1,25 @@
+
+
+
+
+
+
Row 1, Col 1
+
Row 1, Col 2
+
Row 1, Col 3
+
+
+
+
Row 22, Col 1
+
Row 22, Col 2
+
Row 22, Col 3
+
+
+
Row 333, Col 1
+
Row 333, Col 2
+
Row 333, Col 3
+
+
+
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/cols-test-2.html b/layout/reftests/table-anonymous-boxes/cols-test-2.html
new file mode 100644
index 000000000000..4d9833f5654a
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/cols-test-2.html
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
Row 1, Col 1
+
Row 1, Col 2
+
Row 1, Col 3
+
+
+
Row 22, Col 1
+
Row 22, Col 2
+
Row 22, Col 3
+
+
+
Row 333, Col 1
+
Row 333, Col 2
+
Row 333, Col 3
+
+
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/cols-test-3.html b/layout/reftests/table-anonymous-boxes/cols-test-3.html
new file mode 100644
index 000000000000..0dbe643678a3
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/cols-test-3.html
@@ -0,0 +1,25 @@
+
+
+
+
+
Row 1, Col 1
+
Row 1, Col 2
+
Row 1, Col 3
+
+
+
Row 22, Col 1
+
Row 22, Col 2
+
Row 22, Col 3
+
+
+
Row 333, Col 1
+
Row 333, Col 2
+
Row 333, Col 3
+
+
+
+
+
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/infer-cells-1.html b/layout/reftests/table-anonymous-boxes/infer-cells-1.html
new file mode 100644
index 000000000000..258208d39e21
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/infer-cells-1.html
@@ -0,0 +1,18 @@
+
+
+
+
+
+ Row 1, Col 1
+ Row 1, Col 2
+ Row 1, Col 3
+
+
+
Row 22, Col 1Row 22, Col 2Row 22, Col 3
+
+
+ Row 333, Col 1Row 333, Col 2Row 333, Col 3
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/infer-cells-2.html b/layout/reftests/table-anonymous-boxes/infer-cells-2.html
new file mode 100644
index 000000000000..b82de42f5dec
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/infer-cells-2.html
@@ -0,0 +1,29 @@
+
+
+
+
+
+
Row 1,
+
Col 1
+
Row 1, Col 2
+
Row 1, Col 3
+
+
+
Row 22, Col 1
+
Row
+
22,
+
Col
+
2
+
Row 22, Col 3
+
+
+
Row 333, Col 1
+
Row 333, Col 2
+
Row
+
333,
+
Col
+
3
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/infer-cells-3.html b/layout/reftests/table-anonymous-boxes/infer-cells-3.html
new file mode 100644
index 000000000000..4d3d92164925
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/infer-cells-3.html
@@ -0,0 +1,29 @@
+
+
+
+
+
+
Row 1,
+
Col 1
+
Row 1, Col 2
+
Row 1, Col 3
+
+
+
Row 22, Col 1
+
Row
+
22,
+
Col
+
2
+
Row 22, Col 3
+
+
+
Row 333, Col 1
+
Row 333, Col 2
+
Row
+
333,
+
Col
+
3
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/infer-cells-4.html b/layout/reftests/table-anonymous-boxes/infer-cells-4.html
new file mode 100644
index 000000000000..a7b40a9bf2de
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/infer-cells-4.html
@@ -0,0 +1,29 @@
+
+
+
+
+
+
Row 1,
+
Col 1
+
Row 1, Col 2
+
Row 1, Col 3
+
+
+
Row 22, Col 1
+
Row
+
22,
+
Col
+
2
+
Row 22, Col 3
+
+
+
Row 333, Col 1
+
Row 333, Col 2
+
Row
+
333,
+
Col
+
3
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/infer-first-row-and-table.html b/layout/reftests/table-anonymous-boxes/infer-first-row-and-table.html
new file mode 100644
index 000000000000..a049441bb36b
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/infer-first-row-and-table.html
@@ -0,0 +1,20 @@
+
+
+
+ Row 1, Col 1
+ Row 1, Col 2
+ Row 1, Col 3
+
+
+
Row 22, Col 1
+
Row 22, Col 2
+
Row 22, Col 3
+
+
+
Row 333, Col 1
+
Row 333, Col 2
+
Row 333, Col 3
+
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/infer-first-row.html b/layout/reftests/table-anonymous-boxes/infer-first-row.html
new file mode 100644
index 000000000000..75c2d8458042
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/infer-first-row.html
@@ -0,0 +1,22 @@
+
+
+
+
+
Row 1, Col 1
+
Row 1, Col 2
+
Row 1, Col 3
+
+
+
Row 22, Col 1
+
Row 22, Col 2
+
Row 22, Col 3
+
+
+
Row 333, Col 1
+
Row 333, Col 2
+
Row 333, Col 3
+
+
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/infer-rows-inside-rowgroups.html b/layout/reftests/table-anonymous-boxes/infer-rows-inside-rowgroups.html
new file mode 100644
index 000000000000..80a2865e94d8
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/infer-rows-inside-rowgroups.html
@@ -0,0 +1,20 @@
+
+
+
+
+
Row 333, Col 1
+
Row 333, Col 2
+
Row 333, Col 3
+
+
+
Row 22, Col 1
+
Row 22, Col 2
+
Row 22, Col 3
+
+
+
Row 1, Col 1
+
Row 1, Col 2
+
Row 1, Col 3
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/infer-second-row-and-table.html b/layout/reftests/table-anonymous-boxes/infer-second-row-and-table.html
new file mode 100644
index 000000000000..7dd5bb726363
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/infer-second-row-and-table.html
@@ -0,0 +1,22 @@
+
+
+
+
+
+
Row 1, Col 1
+
Row 1, Col 2
+
Row 1, Col 3
+
+
+ Row 22, Col 1
+ Row 22, Col 2
+ Row 22, Col 3
+
+
+
Row 333, Col 1
+
Row 333, Col 2
+
Row 333, Col 3
+
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/infer-second-row.html b/layout/reftests/table-anonymous-boxes/infer-second-row.html
new file mode 100644
index 000000000000..f3f5176f769a
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/infer-second-row.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
Row 1, Col 1
+
Row 1, Col 2
+
Row 1, Col 3
+
+
+
Row 22, Col 1
+
Row 22, Col 2
+
Row 22, Col 3
+
+
+
Row 333, Col 1
+
Row 333, Col 2
+
Row 333, Col 3
+
+
+
+
+
diff --git 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
new file mode 100644
index 000000000000..cdcd51722fe8
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/infer-table-around-headers-footers-1.html
@@ -0,0 +1,26 @@
+
+
+
+
+
+
Row 1, Col 1
+
Row 1, Col 2
+
Row 1, Col 3
+
+
+
+
+
Row 22, Col 1
+
Row 22, Col 2
+
Row 22, Col 3
+
+
+
+
+
Row 333, Col 1
+
Row 333, Col 2
+
Row 333, Col 3
+
+
+
+
diff --git 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
new file mode 100644
index 000000000000..79627f8391ed
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/infer-table-around-headers-footers-2.html
@@ -0,0 +1,26 @@
+
+
+
+
+
+
Row 22, Col 1
+
Row 22, Col 2
+
Row 22, Col 3
+
+
+
+
+
Row 1, Col 1
+
Row 1, Col 2
+
Row 1, Col 3
+
+
+
+
+
Row 333, Col 1
+
Row 333, Col 2
+
Row 333, Col 3
+
+
+
+
diff --git 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
new file mode 100644
index 000000000000..a572a44735fb
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/infer-table-around-headers-footers-3.html
@@ -0,0 +1,26 @@
+
+
+
+
+
+
Row 333, Col 1
+
Row 333, Col 2
+
Row 333, Col 3
+
+
+
+
+
Row 22, Col 1
+
Row 22, Col 2
+
Row 22, Col 3
+
+
+
+
+
Row 1, Col 1
+
Row 1, Col 2
+
Row 1, Col 3
+
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/infer-table-row-cell.html b/layout/reftests/table-anonymous-boxes/infer-table-row-cell.html
new file mode 100644
index 000000000000..ca4a7a65a49f
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/infer-table-row-cell.html
@@ -0,0 +1,27 @@
+
+
+
+
+
Row 1, Col 1
+
Row 1, Col 2
+
Row 1, Col 3
+
+
+
+
Row 22, Col 1
+
Row 22, Col 2
+
Row 22, Col 3
+
+
+
+
+
Row 333, Col 1
+
Row 333, Col 2
+
Row 333, Col 3
+
+
+
+
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/infer-table.html b/layout/reftests/table-anonymous-boxes/infer-table.html
new file mode 100644
index 000000000000..12889a481c0b
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/infer-table.html
@@ -0,0 +1,20 @@
+
+
+
+
+
Row 1, Col 1
+
Row 1, Col 2
+
Row 1, Col 3
+
+
+
Row 22, Col 1
+
Row 22, Col 2
+
Row 22, Col 3
+
+
+
Row 333, Col 1
+
Row 333, Col 2
+
Row 333, Col 3
+
+
+
diff --git a/layout/reftests/table-anonymous-boxes/reftest.list b/layout/reftests/table-anonymous-boxes/reftest.list
new file mode 100644
index 000000000000..20ac81de028a
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/reftest.list
@@ -0,0 +1,21 @@
+== 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
+== infer-table-row-cell.html 3x3-ref.html # Or should it be? Spec is unclear.
+== infer-table.html 3x3-ref.html
+!= 3-tables-ref.html 3x3-ref.html
+== blocks-divide-tables-1.html 3-tables-ref.html
+== blocks-divide-tables-2.html 3-tables-ref.html
+== infer-cells-1.html 3-tables-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
+== white-space-1.html white-space-1-ref.html
diff --git a/layout/reftests/table-anonymous-boxes/white-space-1-ref.html b/layout/reftests/table-anonymous-boxes/white-space-1-ref.html
new file mode 100644
index 000000000000..eeb70fc0f954
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/white-space-1-ref.html
@@ -0,0 +1,6 @@
+
+
+
+ a bc d
+
+
diff --git a/layout/reftests/table-anonymous-boxes/white-space-1.html b/layout/reftests/table-anonymous-boxes/white-space-1.html
new file mode 100644
index 000000000000..ad979276f71c
--- /dev/null
+++ b/layout/reftests/table-anonymous-boxes/white-space-1.html
@@ -0,0 +1,11 @@
+
+
+
+
+ a
+ b
+ c
+ d
+
+
+