summaryrefslogtreecommitdiffstats
path: root/layout/reftests/table-bordercollapse
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /layout/reftests/table-bordercollapse
parentInitial commit. (diff)
downloadfirefox-e51783d008170d9ab27d25da98ca3a38b0a41b67.tar.xz
firefox-e51783d008170d9ab27d25da98ca3a38b0a41b67.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/reftests/table-bordercollapse')
-rw-r--r--layout/reftests/table-bordercollapse/1324524-ref.html18
-rw-r--r--layout/reftests/table-bordercollapse/1324524.html19
-rw-r--r--layout/reftests/table-bordercollapse/1384602-1-ref.html18
-rw-r--r--layout/reftests/table-bordercollapse/1384602-1a.html25
-rw-r--r--layout/reftests/table-bordercollapse/1384602-1b.html29
-rw-r--r--layout/reftests/table-bordercollapse/349655-ref.html103
-rw-r--r--layout/reftests/table-bordercollapse/349655.html97
-rw-r--r--layout/reftests/table-bordercollapse/bc_borderoffset1.html22
-rw-r--r--layout/reftests/table-bordercollapse/bc_borderoffset1_ref.html19
-rw-r--r--layout/reftests/table-bordercollapse/bc_borderoffset2.html22
-rw-r--r--layout/reftests/table-bordercollapse/bc_borderoffset2_ref.html20
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_cell1.html23
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_cell1_ref.html14
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_cell2.html23
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_cell2_ref.html15
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_cell3.html23
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_cell3_ref.html14
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_cell4.html23
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_cell4_ref.html14
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_cell5.html23
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_cell5_ref.html14
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_cg1.html30
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_cg1_ref.html21
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_cg2.html30
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_cg2_ref.html21
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_cg3.html30
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_cg3_ref.html21
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_col1.html30
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_col2.html30
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_col3.html30
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_rg1.html27
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_rg1_ref.html18
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_rg2.html27
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_rg2_ref.html19
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_rg3.html27
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_rg3_ref.html19
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_row1.html23
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_row2.html23
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_row3.html23
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_table1.html30
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_table1_ref.html22
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_table2.html30
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_table2_ref.html21
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_table3.html30
-rw-r--r--layout/reftests/table-bordercollapse/bc_dyn_table3_ref.html22
-rw-r--r--layout/reftests/table-bordercollapse/border-collapse-rtl-ref.html48
-rw-r--r--layout/reftests/table-bordercollapse/border-collapse-rtl.html48
-rw-r--r--layout/reftests/table-bordercollapse/border-style-inset-becomes-ridge-ref.html10
-rw-r--r--layout/reftests/table-bordercollapse/border-style-inset-becomes-ridge.html12
-rw-r--r--layout/reftests/table-bordercollapse/border-style-outset-becomes-groove-ref.html10
-rw-r--r--layout/reftests/table-bordercollapse/border-style-outset-becomes-groove.html12
-rw-r--r--layout/reftests/table-bordercollapse/bordercol.css22
-rw-r--r--layout/reftests/table-bordercollapse/bordercolor-1.html17
-rw-r--r--layout/reftests/table-bordercollapse/bordercolor-2.html17
-rw-r--r--layout/reftests/table-bordercollapse/bordercolor-3-ref.html57
-rw-r--r--layout/reftests/table-bordercollapse/bordercolor-3.html51
-rw-r--r--layout/reftests/table-bordercollapse/bordercolor-4-ref.html59
-rw-r--r--layout/reftests/table-bordercollapse/bordercolor-4.html59
-rw-r--r--layout/reftests/table-bordercollapse/bordercolor-ref.html22
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-1.html11
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-2.html11
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-3.html11
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-4.html11
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-5.xhtml11
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-6.xhtml11
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-7.xhtml11
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-8.html16
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-frame-border-ref.html108
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-frame-border.html103
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-ref.html11
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-all-quirks-ref.html59
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-all-quirks.html53
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-all-strict-ref.html60
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-all-strict.html54
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-cols-quirks-ref.html60
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-cols-quirks.html55
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-cols-strict-ref.html61
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-cols-strict.html56
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-empty-quirks-ref.html58
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-empty-quirks.html52
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-empty-strict-ref.html59
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-empty-strict.html53
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-groups-quirks-ref.html59
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-groups-quirks.html53
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-groups-strict-ref.html60
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-groups-strict.html54
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-none-quirks-ref.html59
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-none-quirks.html53
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-none-strict-ref.html60
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-none-strict.html54
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-ref.html293
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-rows-quirks-ref.html59
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-rows-quirks.html53
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-rows-strict-ref.html60
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-rows-strict.html54
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-rules-quirks-ref.html58
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-rules-quirks.html52
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-rules-strict-ref.html59
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border-rules-strict.html53
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-rules-border.html287
-rw-r--r--layout/reftests/table-bordercollapse/borderhandling-strict-ref.html12
-rw-r--r--layout/reftests/table-bordercollapse/bug1375518-2.html22
-rw-r--r--layout/reftests/table-bordercollapse/bug1375518-3.html22
-rw-r--r--layout/reftests/table-bordercollapse/bug1375518-4-ref.html44
-rw-r--r--layout/reftests/table-bordercollapse/bug1375518-4.html44
-rw-r--r--layout/reftests/table-bordercollapse/bug1375518-5-ref.html45
-rw-r--r--layout/reftests/table-bordercollapse/bug1375518-5.html45
-rw-r--r--layout/reftests/table-bordercollapse/bug1375518-ref.html17
-rw-r--r--layout/reftests/table-bordercollapse/bug1375518.html24
-rw-r--r--layout/reftests/table-bordercollapse/bug1379306-ref.html32
-rw-r--r--layout/reftests/table-bordercollapse/bug1379306.html30
-rw-r--r--layout/reftests/table-bordercollapse/bug1394226-notref.html63
-rw-r--r--layout/reftests/table-bordercollapse/bug1394226-ref.html47
-rw-r--r--layout/reftests/table-bordercollapse/bug1394226.html47
-rw-r--r--layout/reftests/table-bordercollapse/bug1405929-2-ref.html35
-rw-r--r--layout/reftests/table-bordercollapse/bug1405929-2.html35
-rw-r--r--layout/reftests/table-bordercollapse/bug1405929-ref.html36
-rw-r--r--layout/reftests/table-bordercollapse/bug1405929.html34
-rw-r--r--layout/reftests/table-bordercollapse/bug1421887-ref.html56
-rw-r--r--layout/reftests/table-bordercollapse/bug1421887.html53
-rw-r--r--layout/reftests/table-bordercollapse/double_borders.html6
-rw-r--r--layout/reftests/table-bordercollapse/double_borders_ref.html6
-rw-r--r--layout/reftests/table-bordercollapse/empty-toprow-ref.html15
-rw-r--r--layout/reftests/table-bordercollapse/empty-toprow.html16
-rw-r--r--layout/reftests/table-bordercollapse/frame_above_rules_all.html45
-rw-r--r--layout/reftests/table-bordercollapse/frame_above_rules_all_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_above_rules_cols.html45
-rw-r--r--layout/reftests/table-bordercollapse/frame_above_rules_cols_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_above_rules_groups.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_above_rules_groups_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_above_rules_none.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_above_rules_none_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_above_rules_rows.html45
-rw-r--r--layout/reftests/table-bordercollapse/frame_above_rules_rows_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_below_rules_all.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_below_rules_all_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_below_rules_cols.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_below_rules_cols_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_below_rules_groups.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_below_rules_groups_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_below_rules_none.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_below_rules_none_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_below_rules_rows.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_below_rules_rows_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_border_rules_all.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_border_rules_all_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_border_rules_cols.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_border_rules_cols_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_border_rules_groups.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_border_rules_groups_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_border_rules_none.html53
-rw-r--r--layout/reftests/table-bordercollapse/frame_border_rules_none_ref.html52
-rw-r--r--layout/reftests/table-bordercollapse/frame_border_rules_rows.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_border_rules_rows_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_box_rules_all.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_box_rules_all_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_box_rules_cols.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_box_rules_cols_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_box_rules_groups.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_box_rules_groups_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_box_rules_none-collapse-ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_box_rules_none-collapse.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_box_rules_none.html53
-rw-r--r--layout/reftests/table-bordercollapse/frame_box_rules_none_ref.html52
-rw-r--r--layout/reftests/table-bordercollapse/frame_box_rules_rows.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_box_rules_rows_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_hsides_rules_all.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_hsides_rules_all_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_hsides_rules_cols.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_hsides_rules_cols_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_hsides_rules_groups.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_hsides_rules_groups_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_hsides_rules_none.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_hsides_rules_none_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_hsides_rules_rows.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_hsides_rules_rows_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_lhs_rules_all.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_lhs_rules_all_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_lhs_rules_cols.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_lhs_rules_cols_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_lhs_rules_groups.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_lhs_rules_groups_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_lhs_rules_none.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_lhs_rules_none_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_lhs_rules_rows.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_lhs_rules_rows_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_rhs_rules_all.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_rhs_rules_all_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_rhs_rules_cols.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_rhs_rules_cols_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_rhs_rules_groups.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_rhs_rules_groups_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_rhs_rules_none.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_rhs_rules_none_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_rhs_rules_rows.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_rhs_rules_rows_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_void_rules_all.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_void_rules_all_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_void_rules_cols.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_void_rules_cols_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_void_rules_groups.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_void_rules_groups_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_void_rules_none.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_void_rules_none_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_void_rules_rows.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_void_rules_rows_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_vsides_rules_all.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_vsides_rules_all_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_vsides_rules_cols.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_vsides_rules_cols_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_vsides_rules_groups.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_vsides_rules_groups_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_vsides_rules_none.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_vsides_rules_none_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/frame_vsides_rules_rows.html44
-rw-r--r--layout/reftests/table-bordercollapse/frame_vsides_rules_rows_ref.html43
-rw-r--r--layout/reftests/table-bordercollapse/reftest.list120
217 files changed, 9047 insertions, 0 deletions
diff --git a/layout/reftests/table-bordercollapse/1324524-ref.html b/layout/reftests/table-bordercollapse/1324524-ref.html
new file mode 100644
index 0000000000..f8297b13ea
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/1324524-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<style>
+ table {
+ border-collapse: collapse;
+ }
+ td {
+ background-color: rgba(0, 255, 0, 0.5);
+ margin-bottom: 10px;
+ height: 100px;
+ width:100px;
+ border-radius: 50px;
+ }
+</style>
+<table>
+ <tr>
+ <td></td>
+ </tr>
+</table>
diff --git a/layout/reftests/table-bordercollapse/1324524.html b/layout/reftests/table-bordercollapse/1324524.html
new file mode 100644
index 0000000000..7897ffa1b9
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/1324524.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<style>
+ table {
+ border-collapse: collapse;
+ }
+ td {
+ background-color: rgb(0, 255, 0);
+ margin-bottom: 10px;
+ height: 100px;
+ width:100px;
+ border-radius: 50px;
+ opacity: 0.5;
+ }
+</style>
+<table>
+ <tr>
+ <td></td>
+ </tr>
+</table>
diff --git a/layout/reftests/table-bordercollapse/1384602-1-ref.html b/layout/reftests/table-bordercollapse/1384602-1-ref.html
new file mode 100644
index 0000000000..3a7efb1612
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/1384602-1-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<style>
+ table {
+ table-layout: fixed;
+ width: 100%;
+ border-collapse: collapse;
+ }
+</style>
+<table>
+ <tbody>
+ <tr>
+ <td colspan="4">Spanning.</td>
+ </tr>
+ </tbody>
+ <tbody>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td></tr>
+ </tbody>
+</table>
diff --git a/layout/reftests/table-bordercollapse/1384602-1a.html b/layout/reftests/table-bordercollapse/1384602-1a.html
new file mode 100644
index 0000000000..eb58374c9b
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/1384602-1a.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<style>
+ table {
+ table-layout: fixed;
+ width: 100%;
+ border-collapse: collapse;
+ }
+</style>
+<table>
+ <tbody>
+ <tr>
+ <td colspan="4">Spanning.</td>
+ </tr>
+ </tbody>
+ <tbody>
+ <tr id="target"></tr>
+ </tbody>
+</table>
+<script>
+ onload = function() {
+ document.body.offsetWidth;
+ var row = document.getElementById("target");
+ row.innerHTML = "<td>1</td><td>2</td><!--This comment is needed--><td>3</td><td>4</td>";
+ }
+</script>
diff --git a/layout/reftests/table-bordercollapse/1384602-1b.html b/layout/reftests/table-bordercollapse/1384602-1b.html
new file mode 100644
index 0000000000..bd2c968975
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/1384602-1b.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<style>
+ table {
+ table-layout: fixed;
+ width: 100%;
+ border-collapse: collapse;
+ }
+</style>
+<table>
+ <tbody>
+ <tr>
+ <td colspan="4">Spanning.</td>
+ </tr>
+ </tbody>
+ <tbody>
+ <tr id="target"></tr>
+ </tbody>
+</table>
+<script>
+ onload = function() {
+ var row = document.getElementById("target");
+ for (var i = 1; i <= 4; ++i) {
+ document.body.offsetWidth;
+ var cell = document.createElement("td");
+ cell.textContent = i;
+ row.appendChild(cell);
+ }
+ }
+</script>
diff --git a/layout/reftests/table-bordercollapse/349655-ref.html b/layout/reftests/table-bordercollapse/349655-ref.html
new file mode 100644
index 0000000000..9fd31c4442
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/349655-ref.html
@@ -0,0 +1,103 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <title>Testcase #2 for bug 349655</title>
+<style type="text/css">
+ table table tr { background: yellow; }
+ td.gray table {border-top-style:outset}
+ td.rot table {border-top-style:solid;
+ border-bottom-style:solid;}
+ table.rl {border-left-style:solid;
+ border-right-style:solid;}
+
+</style>
+</head>
+<body>
+
+<table ><tr><th colspan="2"><h5>Tables on the left have no bordercolor attribute. Right side is the same but with bordercolor.</h5></th></tr>
+<tr><td class="gray">
+<table border="1" frame="hsides" rules="none">
+ <tr><td>border="1" frame="hsides" rules="none"</td><td>cell2</td></tr>
+</table>
+<br>
+<table border="8" frame="hsides" rules="none">
+ <tr><td>border="8" frame="hsides" rules="none"</td><td>cell2</td></tr>
+</table>
+<br>
+<table border="8" frame="hsides">
+ <tr><td>border="8" frame="hsides"</td><td>cell2</td></tr>
+</table>
+<br>
+<table border="8" rules="none">
+ <tr><td>border="8" rules="none"</td><td>cell2</td></tr>
+</table>
+</td><td class="rot">
+<table bordercolor="red" border="1" frame="hsides" rules="none">
+ <tr><td>border="1" frame="hsides" rules="none"</td><td>cell2</td></tr>
+</table>
+<br>
+<table bordercolor="red" border="8" frame="hsides" rules="none">
+ <tr><td>border="8" frame="hsides" rules="none"</td><td>cell2</td></tr>
+</table>
+<br>
+<table bordercolor="red" border="8" frame="hsides">
+ <tr><td>border="8" frame="hsides"</td><td>cell2</td></tr>
+</table>
+<br>
+<table bordercolor="red" border="8" rules="none" class="rl">
+ <tr><td>border="8" rules="none"</td><td>cell2</td></tr>
+</table>
+</td></tr>
+
+<tr><th colspan="2"><h5>Without "frame"/"rules" attribute.</h5></th></tr>
+<tr><td class="gray">
+<table border="1">
+ <tr><td>border="1"</td><td>cell2</td></tr>
+</table>
+<br>
+<table border="8">
+ <tr><td>border="8"</td><td>cell2</td></tr>
+</table>
+</td><td class="rot">
+<table bordercolor="red" border="1" class="rl">
+ <tr><td>border="1"</td><td>cell2</td></tr>
+</table>
+<br>
+<table bordercolor="red" border="8" class="rl">
+ <tr><td>border="8" </td><td>cell2</td></tr>
+</table>
+</td></tr>
+<tr><th colspan="2"><h5>border-collapse</h5></th></tr>
+<tr><td >
+<table style="border-collapse:collapse" border="1">
+ <tr><td>border="1"</td><td>cell2</td></tr>
+</table>
+<br>
+<table style="border-collapse:collapse" border="8">
+ <tr><td>border="8"</td><td>cell2</td></tr>
+</table>
+</td><td class="rot">
+<table style="border-collapse:collapse" bordercolor="red" border="1" class="rl">
+ <tr><td>border="1"</td><td>cell2</td></tr>
+</table>
+<br>
+<table style="border-collapse:collapse" bordercolor="red" border="8" class="rl">
+ <tr><td>border="8" </td><td>cell2</td></tr>
+</table>
+</td></tr>
+<tr><td></td><td>
+<h5>bordercolor attribute on other elements</h5>
+<table border="8" style="border-style:outset">
+ <tbody bordercolor="red"><tr><td>TBODY bordercolor</td><td>cell2</td></tr></tbody>
+</table><br>
+<table border="8" style="border-style:outset">
+ <tr bordercolor="red"><td>TR bordercolor</td><td>cell2</td></tr>
+</table>
+<table bordercolor="red" border="8" style="border-style:solid">
+ <tr><td bordercolor="red">TD bordercolor</td><td>cell2</td></tr>
+</table>
+</td></tr>
+</table>
+
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/table-bordercollapse/349655.html b/layout/reftests/table-bordercollapse/349655.html
new file mode 100644
index 0000000000..1fe61dd4b0
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/349655.html
@@ -0,0 +1,97 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <title>Testcase #2 for bug 349655</title>
+<style type="text/css">
+ table table tr { background: yellow; }
+</style>
+</head>
+<body>
+
+<table><tr><th colspan="2"><h5>Tables on the left have no bordercolor attribute. Right side is the same but with bordercolor.</h5></th></tr>
+<tr><td>
+<table border="1" frame="hsides" rules="none">
+ <tr><td>border="1" frame="hsides" rules="none"</td><td>cell2</td></tr>
+</table>
+<br>
+<table border="8" frame="hsides" rules="none">
+ <tr><td>border="8" frame="hsides" rules="none"</td><td>cell2</td></tr>
+</table>
+<br>
+<table border="8" frame="hsides">
+ <tr><td>border="8" frame="hsides"</td><td>cell2</td></tr>
+</table>
+<br>
+<table border="8" rules="none">
+ <tr><td>border="8" rules="none"</td><td>cell2</td></tr>
+</table>
+</td><td>
+<table bordercolor="red" border="1" frame="hsides" rules="none">
+ <tr><td>border="1" frame="hsides" rules="none"</td><td>cell2</td></tr>
+</table>
+<br>
+<table bordercolor="red" border="8" frame="hsides" rules="none">
+ <tr><td>border="8" frame="hsides" rules="none"</td><td>cell2</td></tr>
+</table>
+<br>
+<table bordercolor="red" border="8" frame="hsides">
+ <tr><td>border="8" frame="hsides"</td><td>cell2</td></tr>
+</table>
+<br>
+<table bordercolor="red" border="8" rules="none">
+ <tr><td>border="8" rules="none"</td><td>cell2</td></tr>
+</table>
+</td></tr>
+
+<tr><th colspan="2"><h5>Without "frame"/"rules" attribute.</h5></th></tr>
+<tr><td>
+<table border="1">
+ <tr><td>border="1"</td><td>cell2</td></tr>
+</table>
+<br>
+<table border="8">
+ <tr><td>border="8"</td><td>cell2</td></tr>
+</table>
+</td><td>
+<table bordercolor="red" border="1">
+ <tr><td>border="1"</td><td>cell2</td></tr>
+</table>
+<br>
+<table bordercolor="red" border="8" >
+ <tr><td>border="8" </td><td>cell2</td></tr>
+</table>
+</td></tr>
+<tr><th colspan="2"><h5>border-collapse</h5></th></tr>
+<tr><td>
+<table style="border-collapse:collapse" border="1">
+ <tr><td>border="1"</td><td>cell2</td></tr>
+</table>
+<br>
+<table style="border-collapse:collapse" border="8">
+ <tr><td>border="8"</td><td>cell2</td></tr>
+</table>
+</td><td>
+<table style="border-collapse:collapse" bordercolor="red" border="1">
+ <tr><td>border="1"</td><td>cell2</td></tr>
+</table>
+<br>
+<table style="border-collapse:collapse" bordercolor="red" border="8" >
+ <tr><td>border="8" </td><td>cell2</td></tr>
+</table>
+</td></tr>
+<tr><td></td><td>
+<h5>bordercolor attribute on other elements</h5>
+<table border="8">
+ <tbody bordercolor="red"><tr><td>TBODY bordercolor</td><td>cell2</td></tr></tbody>
+</table><br>
+<table border="8">
+ <tr bordercolor="red"><td>TR bordercolor</td><td>cell2</td></tr>
+</table>
+<table bordercolor="red" border="8">
+ <tr><td bordercolor="red">TD bordercolor</td><td>cell2</td></tr>
+</table>
+</td></tr>
+</table>
+
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/table-bordercollapse/bc_borderoffset1.html b/layout/reftests/table-bordercollapse/bc_borderoffset1.html
new file mode 100644
index 0000000000..3ebe8942f7
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_borderoffset1.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>CSS 2.1 Test Suite: border collapse</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="" />
+<style>
+td {width: 100px; text-align:center}
+div {position:absolute; border:green 4px solid}
+
+</style>
+</head>
+
+<body>
+<div>
+<table style="border-collapse:collapse;">
+ <tr><td style="border:solid 4px orange; height:30px">cell 1</td></tr>
+</table>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/bc_borderoffset1_ref.html b/layout/reftests/table-bordercollapse/bc_borderoffset1_ref.html
new file mode 100644
index 0000000000..0759bdf7eb
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_borderoffset1_ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+td {width: 100px; text-align:center}
+div {position:absolute; border:green 4px solid}
+
+</style>
+</head>
+
+<body>
+<!-- in standards mode, the height for table cells does not includes the border -->
+<div>
+<table cellspacing="0">
+ <tr><td style="border:solid 4px orange; height:30px">cell 1</td></tr>
+</table>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/bc_borderoffset2.html b/layout/reftests/table-bordercollapse/bc_borderoffset2.html
new file mode 100644
index 0000000000..e865326f8b
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_borderoffset2.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>CSS 2.1 Test Suite: border collapse</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="" />
+<style>
+td {width: 100px; text-align:center}
+caption {border:solid 4px green}
+
+</style>
+</head>
+
+<body>
+<!-- by default, td has padding of 1px -->
+<table style="border-collapse:collapse;"><caption>caption</caption>
+ <tr><td style="border:solid 4px orange; height:30px">cell 1</td></tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/bc_borderoffset2_ref.html b/layout/reftests/table-bordercollapse/bc_borderoffset2_ref.html
new file mode 100644
index 0000000000..bbb0698eb8
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_borderoffset2_ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+td {width: 100px; text-align:center}
+caption {border:solid 4px green}
+
+</style>
+</head>
+
+<body>
+
+
+<table cellspacing="0" cellpadding="0"><caption>caption</caption>
+ <tr>
+ <td style="border:solid 4px orange; width:102px; height:32px">cell 1</td>
+ </tr>
+</table>
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_cell1.html b/layout/reftests/table-bordercollapse/bc_dyn_cell1.html
new file mode 100644
index 0000000000..2dcddb94c0
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_cell1.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to cell style</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderStyle="solid";
+}
+</script>
+<style>
+td { border: 10px green outset;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse">
+ <tr><td>c11</td><td>c12</td><td>c13</td></tr>
+ <tr><td>c21</td><td id="target" style="border-style:none">c22</td><td>c23</td></tr>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_cell1_ref.html b/layout/reftests/table-bordercollapse/bc_dyn_cell1_ref.html
new file mode 100644
index 0000000000..a7dd2fca5f
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_cell1_ref.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>border collapse dynamic change to cell style</title>
+<style>
+td { border: 10px green outset;}
+table {margin: 30px}
+</style>
+</head>
+<body>
+<table style="border-collapse:collapse">
+ <tr><td>c11</td><td>c12</td><td>c13</td></tr>
+ <tr><td>c21</td><td style="border-style:solid">c22</td><td>c23</td></tr>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_cell2.html b/layout/reftests/table-bordercollapse/bc_dyn_cell2.html
new file mode 100644
index 0000000000..083f2ae893
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_cell2.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to cell color</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderColor="yellow";
+}
+</script>
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse">
+ <tr><td>c11</td><td>c12</td><td>c13</td></tr>
+ <tr><td>c21</td><td id="target" style="border-width:11px">c22</td><td>c23</td></tr>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_cell2_ref.html b/layout/reftests/table-bordercollapse/bc_dyn_cell2_ref.html
new file mode 100644
index 0000000000..30240313ae
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_cell2_ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>border collapse dynamic change to cell color</title>
+
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body>
+<table style="border-collapse:collapse">
+ <tr><td>c11</td><td>c12</td><td>c13</td></tr>
+ <tr><td>c21</td><td style="border-width:11px;border-color:yellow">c22</td><td>c23</td></tr>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_cell3.html b/layout/reftests/table-bordercollapse/bc_dyn_cell3.html
new file mode 100644
index 0000000000..f9aa04a9fb
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_cell3.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to cell border width</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderWidth="20px";
+}
+</script>
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse">
+ <tr><td>c11</td><td>c12</td><td>c13</td></tr>
+ <tr><td>c21</td><td id="target">c22</td><td>c23</td></tr>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_cell3_ref.html b/layout/reftests/table-bordercollapse/bc_dyn_cell3_ref.html
new file mode 100644
index 0000000000..8ff3266765
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_cell3_ref.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>border collapse dynamic change to cell border width</title>
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body>
+<table style="border-collapse:collapse">
+ <tr><td>c11</td><td>c12</td><td>c13</td></tr>
+ <tr><td>c21</td><td style="border-width:20px">c22</td><td>c23</td></tr>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_cell4.html b/layout/reftests/table-bordercollapse/bc_dyn_cell4.html
new file mode 100644
index 0000000000..7fd2945fc6
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_cell4.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to colspan cell style</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderStyle="solid";
+}
+</script>
+<style>
+td { border: 10px green outset;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse">
+ <tr><td>c11</td><td>c12</td><td>c13</td></tr>
+ <tr><td id="target" colspan="3" style="border-style:none">c21</td></tr>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_cell4_ref.html b/layout/reftests/table-bordercollapse/bc_dyn_cell4_ref.html
new file mode 100644
index 0000000000..2b208eaad2
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_cell4_ref.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>border collapse dynamic change to colspan cell style</title>
+<style>
+td { border: 10px green outset;}
+table {margin: 30px}
+</style>
+</head>
+<body>
+<table style="border-collapse:collapse">
+ <tr><td>c11</td><td>c12</td><td>c13</td></tr>
+ <tr><td style="border-style:solid;" colspan="3">c21</td></tr>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_cell5.html b/layout/reftests/table-bordercollapse/bc_dyn_cell5.html
new file mode 100644
index 0000000000..305c228d6e
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_cell5.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to rowspan cell style </title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderStyle="solid";
+}
+</script>
+<style>
+td { border: 10px green outset;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse">
+ <tr><td>c11</td><td id="target" rowspan="3" style="border-style:none">c12</td><td>c13</td></tr>
+ <tr><td>c21</td><td>c23</td></tr>
+ <tr><td>c31</td><td>c33</td></tr>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_cell5_ref.html b/layout/reftests/table-bordercollapse/bc_dyn_cell5_ref.html
new file mode 100644
index 0000000000..b4c3498238
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_cell5_ref.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>border collapse dynamic change to rowspan cell style </title>
+<style>
+td { border: 10px green outset;}
+table {margin: 30px}
+</style>
+</head>
+<body>
+<table style="border-collapse:collapse">
+ <tr><td>c11</td><td rowspan="3" style="border-style:solid">c12</td><td>c13</td></tr>
+ <tr><td>c21</td><td>c23</td></tr>
+ <tr><td>c31</td><td>c33</td></tr>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_cg1.html b/layout/reftests/table-bordercollapse/bc_dyn_cg1.html
new file mode 100644
index 0000000000..6e640b37c5
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_cg1.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to colgroup border color</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderColor="yellow";
+}
+</script>
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse">
+<colgroup><col></colgroup>
+<colgroup id="target" style="border:solid green 11px"><col></colgroup>
+<colgroup><col></colgroup>
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody>
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_cg1_ref.html b/layout/reftests/table-bordercollapse/bc_dyn_cg1_ref.html
new file mode 100644
index 0000000000..7a5f1852ef
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_cg1_ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>border collapse dynamic change to colgroup border color</title>
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body>
+<table style="border-collapse:collapse">
+<colgroup><col></colgroup>
+<colgroup style="border:solid yellow 11px"><col></colgroup>
+<colgroup><col></colgroup>
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody>
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_cg2.html b/layout/reftests/table-bordercollapse/bc_dyn_cg2.html
new file mode 100644
index 0000000000..eb7cb53b20
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_cg2.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to colgroup border width</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderWidth="20px";
+}
+</script>
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse">
+<colgroup><col></colgroup>
+<colgroup id="target" style="border:solid green 11px"><col></colgroup>
+<colgroup><col></colgroup>
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody>
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_cg2_ref.html b/layout/reftests/table-bordercollapse/bc_dyn_cg2_ref.html
new file mode 100644
index 0000000000..240ba0187d
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_cg2_ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>border collapse dynamic change to colgroup border width</title>
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body>
+<table style="border-collapse:collapse">
+<colgroup><col></colgroup>
+<colgroup style="border:solid green 20px"><col></colgroup>
+<colgroup><col></colgroup>
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody>
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_cg3.html b/layout/reftests/table-bordercollapse/bc_dyn_cg3.html
new file mode 100644
index 0000000000..d8b7acf516
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_cg3.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to colgroup border style</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderStyle="solid";
+}
+</script>
+<style>
+td { border: 10px green outset;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse">
+<colgroup><col></colgroup>
+<colgroup id="target" style="border:outset green 10px"><col></colgroup>
+<colgroup><col></colgroup>
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody>
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_cg3_ref.html b/layout/reftests/table-bordercollapse/bc_dyn_cg3_ref.html
new file mode 100644
index 0000000000..6facc281e7
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_cg3_ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>border collapse dynamic change to colgroup border style</title>
+<style>
+td { border: 10px green outset;}
+table {margin: 30px}
+</style>
+</head>
+<body>
+<table style="border-collapse:collapse">
+<colgroup><col></colgroup>
+<colgroup style="border:solid green 10px"><col></colgroup>
+<colgroup><col></colgroup>
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody>
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_col1.html b/layout/reftests/table-bordercollapse/bc_dyn_col1.html
new file mode 100644
index 0000000000..d4a6238dd6
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_col1.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to col border color</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderColor="yellow";
+}
+</script>
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse">
+<colgroup><col></colgroup>
+<colgroup><col id="target" style="border:solid green 11px"></colgroup>
+<colgroup><col></colgroup>
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody>
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_col2.html b/layout/reftests/table-bordercollapse/bc_dyn_col2.html
new file mode 100644
index 0000000000..8dea12929a
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_col2.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to col border width</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderWidth="20px";
+}
+</script>
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse">
+<colgroup><col></colgroup>
+<colgroup><col id="target" style="border:solid green 11px"></colgroup>
+<colgroup><col></colgroup>
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody>
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_col3.html b/layout/reftests/table-bordercollapse/bc_dyn_col3.html
new file mode 100644
index 0000000000..254271ae67
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_col3.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to col border style</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderStyle="solid";
+}
+</script>
+<style>
+td { border: 10px green outset;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse">
+<colgroup><col></colgroup>
+<colgroup><col id="target" style="border:outset green 10px"></colgroup>
+<colgroup><col></colgroup>
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody>
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_rg1.html b/layout/reftests/table-bordercollapse/bc_dyn_rg1.html
new file mode 100644
index 0000000000..e92d487d3f
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_rg1.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to rowgroup border color</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderColor="yellow";
+}
+</script>
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse">
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody id="target" style="border:solid green 11px">
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_rg1_ref.html b/layout/reftests/table-bordercollapse/bc_dyn_rg1_ref.html
new file mode 100644
index 0000000000..454d78bf3c
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_rg1_ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>border collapse dynamic change to rowgroup border color</title>
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body>
+<table style="border-collapse:collapse">
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody style="border:solid yellow 11px">
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_rg2.html b/layout/reftests/table-bordercollapse/bc_dyn_rg2.html
new file mode 100644
index 0000000000..bfa5447b75
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_rg2.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to rowgroup border width</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderWidth="20px";
+}
+</script>
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse">
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody id="target" style="border:solid green 11px">
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_rg2_ref.html b/layout/reftests/table-bordercollapse/bc_dyn_rg2_ref.html
new file mode 100644
index 0000000000..c3f7613589
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_rg2_ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>border collapse dynamic change to rowgroup border width</title>
+
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body>
+<table style="border-collapse:collapse">
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody style="border:solid green 20px">
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_rg3.html b/layout/reftests/table-bordercollapse/bc_dyn_rg3.html
new file mode 100644
index 0000000000..9e0778c33c
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_rg3.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to rowgroup border style</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderStyle="solid";
+}
+</script>
+<style>
+td { border: 10px green outset;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse">
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody id="target" style="border:outset green 10px">
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_rg3_ref.html b/layout/reftests/table-bordercollapse/bc_dyn_rg3_ref.html
new file mode 100644
index 0000000000..00449ed443
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_rg3_ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>border collapse dynamic change to rowgroup border style</title>
+
+<style>
+td { border: 10px green outset;}
+table {margin: 30px}
+</style>
+</head>
+<body>
+<table style="border-collapse:collapse">
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody style="border:solid green 10px">
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_row1.html b/layout/reftests/table-bordercollapse/bc_dyn_row1.html
new file mode 100644
index 0000000000..c575a7e02b
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_row1.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to row border color</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderColor="yellow";
+}
+</script>
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse">
+ <tr><td>c11</td><td>c12</td><td>c13</td></tr>
+ <tr id="target" style="border:solid green 11px"><td>c21</td><td>c22</td><td>c23</td></tr>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_row2.html b/layout/reftests/table-bordercollapse/bc_dyn_row2.html
new file mode 100644
index 0000000000..01f4e82c2e
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_row2.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to row border width</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderWidth="20px";
+}
+</script>
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse">
+ <tr><td>c11</td><td>c12</td><td>c13</td></tr>
+ <tr id="target" style="border:solid green 2px"><td>c21</td><td>c22</td><td>c23</td></tr>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_row3.html b/layout/reftests/table-bordercollapse/bc_dyn_row3.html
new file mode 100644
index 0000000000..65a9cd5236
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_row3.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to row border style</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderStyle="solid";
+}
+</script>
+<style>
+td { border: 10px green outset;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse">
+ <tr><td>c11</td><td>c12</td><td>c13</td></tr>
+ <tr id="target" style="border:outset green 10px"><td>c21</td><td>c22</td><td>c23</td></tr>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_table1.html b/layout/reftests/table-bordercollapse/bc_dyn_table1.html
new file mode 100644
index 0000000000..c03f1780ff
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_table1.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to table border color</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderColor="yellow";
+}
+</script>
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse; border:solid green 11px" id="target">
+<colgroup><col></colgroup>
+<colgroup><col></colgroup>
+<colgroup><col></colgroup>
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody>
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_table1_ref.html b/layout/reftests/table-bordercollapse/bc_dyn_table1_ref.html
new file mode 100644
index 0000000000..0fcda0496a
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_table1_ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>border collapse dynamic change to table border color</title>
+
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body>
+<table style="border-collapse:collapse; border:solid yellow 11px">
+<colgroup><col></colgroup>
+<colgroup><col></colgroup>
+<colgroup><col></colgroup>
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody>
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_table2.html b/layout/reftests/table-bordercollapse/bc_dyn_table2.html
new file mode 100644
index 0000000000..35d95ce6f9
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_table2.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to table border width</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderWidth="20px";
+}
+</script>
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse; border:solid green 11px" id="target">
+<colgroup><col></colgroup>
+<colgroup><col></colgroup>
+<colgroup><col></colgroup>
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody>
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_table2_ref.html b/layout/reftests/table-bordercollapse/bc_dyn_table2_ref.html
new file mode 100644
index 0000000000..bceb542846
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_table2_ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>border collapse dynamic change to table border width</title>
+<style>
+td { border: 10px green solid;}
+table {margin: 30px}
+</style>
+</head>
+<body>
+<table style="border-collapse:collapse; border:solid green 20px">
+<colgroup><col></colgroup>
+<colgroup><col></colgroup>
+<colgroup><col></colgroup>
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody>
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_table3.html b/layout/reftests/table-bordercollapse/bc_dyn_table3.html
new file mode 100644
index 0000000000..c9b17fd632
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_table3.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>CSS 2.1 Test Suite: border collapse dynamic change to table border style</title>
+ <link rel="author" title="Bernd Mielke" href="mailto:bmlk@gmx.de" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#collapsing-borders" />
+ <meta name="flags" content="dom" />
+<script>
+function doTest(){
+ var t1 =document.getElementById('target');
+ t1.style.borderStyle="solid";
+}
+</script>
+<style>
+td { border: 10px green outset;}
+table {margin: 30px}
+</style>
+</head>
+<body onload="doTest()";>
+<table style="border-collapse:collapse; border:none green 10px" id="target">
+<colgroup><col></colgroup>
+<colgroup><col></colgroup>
+<colgroup><col></colgroup>
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody>
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bc_dyn_table3_ref.html b/layout/reftests/table-bordercollapse/bc_dyn_table3_ref.html
new file mode 100644
index 0000000000..a426552a77
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bc_dyn_table3_ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<head><title>border collapse dynamic change to table border style</title>
+
+<style>
+td { border: 10px green outset;}
+table {margin: 30px}
+</style>
+</head>
+<body>
+<table style="border-collapse:collapse; border:solid green 10px">
+<colgroup><col></colgroup>
+<colgroup><col></colgroup>
+<colgroup><col></colgroup>
+<tbody></tbody><tr><td>c11</td><td>c12</td><td>c13</td></tr></tbody>
+ <tbody>
+ <tr><td>c21</td><td>c22</td><td>c23</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>c31</td><td>c32</td><td>c33</td></tr>
+ </tbody>
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/border-collapse-rtl-ref.html b/layout/reftests/table-bordercollapse/border-collapse-rtl-ref.html
new file mode 100644
index 0000000000..8c57dbc121
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/border-collapse-rtl-ref.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table {
+ margin: 10px;
+ border: 8px solid silver;
+ border-right-color: gray;
+ border-bottom-color: gray;
+ border-spacing: 5px;
+ border-collapse: collapse;
+}
+td {
+ border: 4px solid black;
+ width: 50px;
+ height: 20px;
+ text-align: center;
+}
+td.w1 {
+ width: 80px;
+}
+td.w2 {
+ width: 120px;
+}
+tr:nth-child(even) {
+ background: #ffc;
+}
+tr:nth-child(odd) {
+ background: #cff;
+}
+tr:nth-child(1) {
+ background: #fcf;
+}
+</style>
+</head>
+<body>
+
+<table>
+<tr><td>x</td> <td colspan=3>x</td> </tr>
+<tr><td>x</td> <td>x</td> <td class="w1">x</td><td rowspan=3>x</td></tr>
+<tr><td rowspan=2>x</td> <td>x</td> <td>x</td> </tr>
+<tr> <td>x</td> <td>x</td> </tr>
+<tr><td class="w2">x</td><td>x</td> <td>x</td><td>x</td> </tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/border-collapse-rtl.html b/layout/reftests/table-bordercollapse/border-collapse-rtl.html
new file mode 100644
index 0000000000..55d171d4bf
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/border-collapse-rtl.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table {
+ margin: 10px;
+ border: 8px solid silver;
+ border-right-color: gray;
+ border-bottom-color: gray;
+ border-spacing: 5px;
+ border-collapse: collapse;
+}
+td {
+ border: 4px solid black;
+ width: 50px;
+ height: 20px;
+ text-align: center;
+}
+td.w1 {
+ width: 80px;
+}
+td.w2 {
+ width: 120px;
+}
+tr:nth-child(even) {
+ background: #ffc;
+}
+tr:nth-child(odd) {
+ background: #cff;
+}
+tr:nth-child(1) {
+ background: #fcf;
+}
+</style>
+</head>
+<body>
+
+<table dir=rtl>
+<tr><td colspan=3>x</td> <td>x</td> </tr>
+<tr><td rowspan=3>x</td><td class="w1">x</td><td>x</td><td>x</td> </tr>
+<tr> <td>x</td> <td>x</td><td rowspan=2>x</td> </tr>
+<tr> <td>x</td> <td>x</td> </tr>
+<tr><td>x</td> <td>x</td> <td>x</td><td class="w2">x</td></tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/border-style-inset-becomes-ridge-ref.html b/layout/reftests/table-bordercollapse/border-style-inset-becomes-ridge-ref.html
new file mode 100644
index 0000000000..66db649e9b
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/border-style-inset-becomes-ridge-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<style>
+ table { border-collapse: separate; border-spacing: 0 }
+ td { border: 20px ridge; width: 100px; height: 100px}
+</style>
+<table>
+ <tr>
+ <td></td>
+ </tr>
+</table>
diff --git a/layout/reftests/table-bordercollapse/border-style-inset-becomes-ridge.html b/layout/reftests/table-bordercollapse/border-style-inset-becomes-ridge.html
new file mode 100644
index 0000000000..b011bd22f7
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/border-style-inset-becomes-ridge.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<style>
+ /* In border-collapse mode, inset becomes ridge. */
+ table { border-collapse: collapse; border-spacing: 0 }
+ table, td { border-style: inset; }
+ td { border-width: 20px; width: 100px; height: 100px}
+</style>
+<table>
+ <tr>
+ <td></td>
+ </tr>
+</table>
diff --git a/layout/reftests/table-bordercollapse/border-style-outset-becomes-groove-ref.html b/layout/reftests/table-bordercollapse/border-style-outset-becomes-groove-ref.html
new file mode 100644
index 0000000000..ddb0f71c89
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/border-style-outset-becomes-groove-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<style>
+ table { border-collapse: separate; border-spacing: 0 }
+ td { border: 20px groove; width: 100px; height: 100px}
+</style>
+<table>
+ <tr>
+ <td></td>
+ </tr>
+</table>
diff --git a/layout/reftests/table-bordercollapse/border-style-outset-becomes-groove.html b/layout/reftests/table-bordercollapse/border-style-outset-becomes-groove.html
new file mode 100644
index 0000000000..a7245459ec
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/border-style-outset-becomes-groove.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<style>
+ /* In border-collapse mode, outset becomes groove. */
+ table { border-collapse: collapse; }
+ table, td { border-style: outset; }
+ td { border-width: 20px; width: 100px; height: 100px}
+</style>
+<table>
+ <tr>
+ <td></td>
+ </tr>
+</table>
diff --git a/layout/reftests/table-bordercollapse/bordercol.css b/layout/reftests/table-bordercollapse/bordercol.css
new file mode 100644
index 0000000000..7af1ea9b0b
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bordercol.css
@@ -0,0 +1,22 @@
+table {
+ margin-bottom: 0.5in;
+}
+caption {
+ font-weight: bold;
+ font-style: italic;
+}
+td {background-color:LightCyan}
+table.topLight {border-top: 1px solid #b2b2b2}
+table.bottom {border-bottom: 1px solid black}
+table.bottomDark {border-bottom: 1px solid #4c4c4c}
+table.leftLight {border-left: 1px solid #b2b2b2}
+table.right {border-right: 1px solid black}
+table.rightDark {border-right: 1px solid #4c4c4c}
+table.top {border-top: 1px solid black}
+table.left {border-left: 1px solid black}
+table.bc {border-collapse:collapse}
+tbody.border{border-top: 1px solid black; border-bottom: 1px solid black; }
+tr.border{border-top: 1px solid black; border-bottom: 1px solid black; }
+td.border{border-left:1px solid black;}
+div.maskPixel{position:absolute; background-color:Black; width:1px; height:1px; }
+
diff --git a/layout/reftests/table-bordercollapse/bordercolor-1.html b/layout/reftests/table-bordercollapse/bordercolor-1.html
new file mode 100644
index 0000000000..587b514dd9
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bordercolor-1.html
@@ -0,0 +1,17 @@
+<!doctype html public "-//w3c//dtd html 3.2//en">
+
+<html>
+
+<head>
+<title>bordercolor</title>
+</head>
+
+<body >
+<table border="1" bordercolor="green">
+<tr><td>c1</td></tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/bordercolor-2.html b/layout/reftests/table-bordercollapse/bordercolor-2.html
new file mode 100644
index 0000000000..634040a01f
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bordercolor-2.html
@@ -0,0 +1,17 @@
+<!doctype html public "-//w3c//dtd html 3.2//en">
+
+<html>
+
+<head>
+<title>bordercolor</title>
+</head>
+
+<body >
+<table border="1" bordercolor="blue">
+<tr><td>c1</td></tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/bordercolor-3-ref.html b/layout/reftests/table-bordercollapse/bordercolor-3-ref.html
new file mode 100644
index 0000000000..145b1a05cb
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bordercolor-3-ref.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html >
+ <head>
+ <title>CSS Test: HTML bordercolor Attribute</title>
+ <link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact"/>
+ <link rel="help" href="RELEVANT_SPEC_SECTION"/>
+ <meta name="assert" content="Figure out which rules are ignored and how."/>
+ <style type="text/css">
+ html { color: blue; }
+ table { margin: 0.5em; }
+ .thin, .elemthin { border-width: thin; border-style: outset; }
+ .thin * { border-width: thin; border-style: inset; }
+ .orange, .orange *, .elemorange { border-color: orange; }
+ </style>
+ </head>
+ <body>
+ <table class="orange thin">
+ <tr><td>A<td>A
+ </table>
+
+ <table class="elemorange elemthin">
+ <tr><td>B<td>B
+ </table>
+
+ <table class=orange style="border-collapse: collapse;">
+ <tr><td style="border-right-width: thin; border-right-style: solid;
+ border-bottom-width: thin; border-bottom-style: solid;">C
+ <td style="border-bottom-width: thin; border-bottom-style: solid;">C
+ <tr><td style="border-right-width: thin; border-right-style: solid;">C<td>C
+ </table>
+
+ <table class=orange style="border-collapse: collapse;">
+ <tr><td style="border-right-width: thin; border-right-style: solid;">D<td>D
+ <tr><td style="border-right-width: thin; border-right-style: solid;">D<td>D
+ </table>
+
+ <table>
+ <tr><td>E<td>E
+ <tr><td>E<td>E
+ </table>
+
+ <table>
+ <tr><td>F<td>F
+ </table>
+
+ <table style="border-collapse: collapse;">
+ <tr class=orange><td style="border-right-width: thin; border-right-style: solid;
+ border-bottom-width: thin; border-bottom-style: solid;">G
+ <td style="border-bottom-width: thin; border-bottom-style: solid;">G
+ <tr class=orange><td style="border-right-width: thin; border-right-style: solid;">G<td>G
+ </table>
+
+ <table class="elemorange thin">
+ <tr><td>H<td>H
+ </table>
+ </body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/bordercolor-3.html b/layout/reftests/table-bordercollapse/bordercolor-3.html
new file mode 100644
index 0000000000..be46dd0ccf
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bordercolor-3.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html >
+ <head>
+ <title>CSS Test: HTML bordercolor Attribute</title>
+ <link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact"/>
+ <link rel="help" href="RELEVANT_SPEC_SECTION"/>
+ <meta name="assert" content="Figure out which rules are ignored and how."/>
+ <style type="text/css">
+ html { color: lime; }
+ table { margin: 0.5em; }
+ td { color: blue; }
+ </style>
+ </head>
+ <body>
+ <table bordercolor=orange border>
+ <tr><td>A<td>A
+ </table>
+
+ <table bordercolor=orange frame=border>
+ <tr><td>B<td>B
+ </table>
+
+ <table bordercolor=orange rules=all>
+ <tr><td>C<td>C
+ <tr><td>C<td>C
+ </table>
+
+ <table bordercolor=orange rules=cols>
+ <tr><td>D<td>D
+ <tr><td>D<td>D
+ </table>
+
+ <table bordercolor=orange rules=none>
+ <tr><td>E<td>E
+ <tr><td>E<td>E
+ </table>
+
+ <table bordercolor=orange>
+ <tr><td>F<td>F
+ </table>
+
+ <table bordercolor=orange rules=all frame=none>
+ <tr><td>G<td>G
+ <tr><td>G<td>G
+ </table>
+
+ <table style="border-color: orange;" border>
+ <tr><td>H<td>H
+ </table>
+ </body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/bordercolor-4-ref.html b/layout/reftests/table-bordercollapse/bordercolor-4-ref.html
new file mode 100644
index 0000000000..26000fef2c
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bordercolor-4-ref.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head>
+
+<style type="text/css">
+
+/* just to improve vissibility */
+td {
+ border-width: 3px;
+ border-style: solid;
+}
+
+</style>
+
+</head>
+<body>
+ <table border="5" style="border-color:blue;">
+ <caption>TABLE with CSS border-color:blue</caption>
+ <tr>
+ <td style="border-color: black;">Row 1</td>
+ </tr>
+ <tr>
+ <td style="color:red; border-color: red;">Row 2</td>
+ </tr>
+ <tr>
+ <td style="border-color:green">Row 3</td>
+ </tr>
+ </table>
+<br>
+
+ <table border="5" style="border-color: orange;">
+ <caption>TABLE with HTML bordercolor attribute=orange</caption>
+ <tr>
+ <td style="border-color: orange">Row 1</td>
+ </tr>
+ <tr>
+ <td style="color:red; border-color: orange">Row 2</td>
+ </tr>
+ <tr>
+ <td style="border-color:green">Row 3</td>
+ </tr>
+ </table>
+<br>
+
+ <table border="5" style="border-color:blue;">
+ <caption>TABLE with CSS border-color:blue and HTML bordercolor attribute=orange</caption>
+ <tr>
+ <td style="border-color: blue;">Row 1</td>
+ </tr>
+ <tr>
+ <td style="color:red; border-color: blue;">Row 2</td>
+ </tr>
+ <tr>
+ <td style="border-color:green">Row 3</td>
+ </tr>
+ </table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/bordercolor-4.html b/layout/reftests/table-bordercollapse/bordercolor-4.html
new file mode 100644
index 0000000000..cfd9b78e32
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bordercolor-4.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head>
+
+<style type="text/css">
+
+/* just to improve vissibility */
+td {
+ border-width: 3px;
+ border-style: solid;
+}
+
+</style>
+
+</head>
+<body>
+ <table border="5" style="border-color:blue;">
+ <caption>TABLE with CSS border-color:blue</caption>
+ <tr>
+ <td>Row 1</td>
+ </tr>
+ <tr>
+ <td style="color:red">Row 2</td>
+ </tr>
+ <tr>
+ <td style="border-color:green">Row 3</td>
+ </tr>
+ </table>
+<br>
+
+ <table border="5" bordercolor="orange">
+ <caption>TABLE with HTML bordercolor attribute=orange</caption>
+ <tr>
+ <td>Row 1</td>
+ </tr>
+ <tr>
+ <td style="color:red">Row 2</td>
+ </tr>
+ <tr>
+ <td style="border-color:green">Row 3</td>
+ </tr>
+ </table>
+<br>
+
+ <table border="5" bordercolor="orange" style="border-color:blue;">
+ <caption>TABLE with CSS border-color:blue and HTML bordercolor attribute=orange</caption>
+ <tr>
+ <td>Row 1</td>
+ </tr>
+ <tr>
+ <td style="color:red">Row 2</td>
+ </tr>
+ <tr>
+ <td style="border-color:green">Row 3</td>
+ </tr>
+ </table>
+
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/table-bordercollapse/bordercolor-ref.html b/layout/reftests/table-bordercollapse/bordercolor-ref.html
new file mode 100644
index 0000000000..3dd1f61202
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bordercolor-ref.html
@@ -0,0 +1,22 @@
+<!doctype html public "-//w3c//dtd html 3.2//en">
+
+<html>
+
+<head>
+<title>bordercolor</title>
+<style>
+table, td {
+ border-color: green;
+ }
+</style>
+</head>
+
+<body >
+<table border="1" bordercolor="blue">
+<tr><td>c1</td></tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-1.html b/layout/reftests/table-bordercollapse/borderhandling-1.html
new file mode 100644
index 0000000000..ee1f79fc98
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-1.html
@@ -0,0 +1,11 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 50px; height: 50px;}
+</style>
+</head>
+<body>
+<table border><tr><td><div/></td></tr></table>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/table-bordercollapse/borderhandling-2.html b/layout/reftests/table-bordercollapse/borderhandling-2.html
new file mode 100644
index 0000000000..df14e1e827
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-2.html
@@ -0,0 +1,11 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 50px; height: 50px;}
+</style>
+</head>
+<body>
+<table border><td><div/></td></table>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/table-bordercollapse/borderhandling-3.html b/layout/reftests/table-bordercollapse/borderhandling-3.html
new file mode 100644
index 0000000000..4bd2ee8c06
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-3.html
@@ -0,0 +1,11 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 50px; height: 50px;}
+</style>
+</head>
+<body>
+<table border><th><div/></th></table>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/table-bordercollapse/borderhandling-4.html b/layout/reftests/table-bordercollapse/borderhandling-4.html
new file mode 100644
index 0000000000..c3bea81945
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-4.html
@@ -0,0 +1,11 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 50px; height: 50px;}
+</style>
+</head>
+<body>
+<table border><tr><th><div/></th></tr></table>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/table-bordercollapse/borderhandling-5.xhtml b/layout/reftests/table-bordercollapse/borderhandling-5.xhtml
new file mode 100644
index 0000000000..6190e3e698
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-5.xhtml
@@ -0,0 +1,11 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <style>
+div {width: 50px; height: 50px;}
+</style>
+ </head>
+ <body>
+ <table border="1"><tr><th><div/></th></tr></table>
+ </body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-6.xhtml b/layout/reftests/table-bordercollapse/borderhandling-6.xhtml
new file mode 100644
index 0000000000..b3d0a6cf60
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-6.xhtml
@@ -0,0 +1,11 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <style>
+div {width: 50px; height: 50px;}
+</style>
+ </head>
+ <body>
+ <table border="1"><th><div/></th></table>
+ </body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-7.xhtml b/layout/reftests/table-bordercollapse/borderhandling-7.xhtml
new file mode 100644
index 0000000000..3adaf3752f
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-7.xhtml
@@ -0,0 +1,11 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <style>
+div {width: 50px; height: 50px;}
+</style>
+ </head>
+ <body>
+ <table border="1"><td><div/></td></table>
+ </body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-8.html b/layout/reftests/table-bordercollapse/borderhandling-8.html
new file mode 100644
index 0000000000..9db3a3fb92
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-8.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 50px; height: 50px;}
+table {border-collapse:separate;
+ border: outset 1px black;
+ }
+ td {border: inset 1px black;}
+</style>
+</head>
+<body>
+<table><tr><td><div/></td></tr></table>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/table-bordercollapse/borderhandling-frame-border-ref.html b/layout/reftests/table-bordercollapse/borderhandling-frame-border-ref.html
new file mode 100644
index 0000000000..ee488f9834
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-frame-border-ref.html
@@ -0,0 +1,108 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+table.frame {border: outset thin ;}
+table.frameTop {border-top: outset thin ;}
+table.frameBottom {border-bottom: outset thin ;}
+table.frameRight {border-right: outset thin ;}
+table.frameLeft {border-left: outset thin ;}
+
+td.inner {border: inset thin;}
+
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>frame/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>empty</th>
+<td><table><tr><td><div/></td></tr></table></td></td>
+<td><table class="frame"><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table><tr><td><div/></td></tr></table></td>
+<td><table class="frame"><tr><td class="inner"><div/></td></tr></table></td>
+<td><table class="frame" style="border-width: 3px"><tr><td class="inner"><div/></td></tr></table></td>
+</tr>
+<tr><th>frame</th>
+<td><table><tr><td><div/></td></tr></table></td>
+<td><table><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table><tr><td><div/></td></tr></table></td>
+<td><table><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table><tr><td class="inner"><div/></td></tr></table></td>
+</tr>
+<tr><th>frame="void"</th>
+<td><table><tr><td><div/></td></tr></table></td>
+<td><table><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table><tr><td><div/></td></tr></table></td>
+<td><table><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table style="border-width: 3px"><tr><td class="inner"><div/></td></tr></table></td>
+</tr>
+
+<tr><th>frame="above"</th>
+<td><table class="frameTop"><tr><td><div/></td></tr></table></td>
+<td><table class="frameTop"><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table><tr><td><div/></td></tr></table></td>
+<td><table class="frameTop"><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table class="frameTop" style="border-width: 3px"><tr><td class="inner"><div/></td></tr></table></td>
+</tr>
+
+<tr><th>frame="below"</th>
+<td><table class="frameBottom"><tr><td><div/></td></tr></table></td>
+<td><table class="frameBottom"><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table><tr><td><div/></td></tr></table></td>
+<td><table class="frameBottom"><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table class="frameBottom" style="border-width: 3px"><tr><td class="inner"><div/></td></tr></table></td>
+</tr>
+
+<tr><th>frame="hsides"</th>
+<td><table class="frameTop frameBottom"><tr><td><div/></td></tr></table></td>
+<td><table class="frameTop frameBottom"><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table><tr><td><div/></td></tr></table></td>
+<td><table class="frameTop frameBottom"><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table class="frameTop frameBottom" style="border-width: 3px"><tr><td class="inner"><div/></td></tr></table></td>
+</tr>
+
+<tr><th>frame="lhs"</th>
+<td><table class="frameLeft"><tr><td><div/></td></tr></table></td>
+<td><table class="frameLeft"><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table><tr><td><div/></td></tr></table></td>
+<td><table class="frameLeft"><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table class="frameLeft" style="border-width: 3px"><tr><td class="inner"><div/></td></tr></table></td>
+</tr>
+
+<tr><th>frame="rhs"</th>
+<td><table class="frameRight"><tr><td><div/></td></tr></table></td>
+<td><table class="frameRight"><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table><tr><td><div/></td></tr></table></td>
+<td><table class="frameRight"><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table class="frameRight" style="border-width: 3px"><tr><td class="inner"><div/></td></tr></table></td>
+</tr>
+
+<tr><th>frame="vsides"</th>
+<td><table class="frameLeft frameRight"><tr><td><div/></td></tr></table></td>
+<td><table class="frameLeft frameRight"><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table><tr><td><div/></td></tr></table></td>
+<td><table class="frameLeft frameRight"><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table class="frameLeft frameRight" style="border-width: 3px"><tr><td class="inner"><div/></td></tr></table></td>
+</tr>
+
+<tr><th>frame="box"</th>
+<td><table class="frame"><tr><td><div/></td></tr></table></td>
+<td><table class="frame"><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table><tr><td><div/></td></tr></table></td>
+<td><table class="frame"><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table class="frame" style="border-width: 3px"><tr><td class="inner"><div/></td></tr></table></td>
+</tr>
+
+<tr><th>frame="border"</th>
+<td><table class="frame"><tr><td><div/></td></tr></table></td>
+<td><table class="frame"><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table><tr><td><div/></td></tr></table></td>
+<td><table class="frame"><tr><td class="inner"><div/></td></tr></table></td></td>
+<td><table class="frame" style="border-width: 3px"><tr><td class="inner"><div/></td></tr></table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-frame-border.html b/layout/reftests/table-bordercollapse/borderhandling-frame-border.html
new file mode 100644
index 0000000000..bd0b8a23ca
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-frame-border.html
@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+
+
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>frame/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>empty</th>
+<td><table><tr><td><div/></td></tr></table></td></td>
+<td><table border><tr><td><div/></td></tr></table></td></td>
+<td><table border="0"><tr><td><div/></td></tr></table></td>
+<td><table border="1"><tr><td><div/></td></tr></table></td>
+<td><table border="3"><tr><td><div/></td></tr></table></td>
+</tr>
+<tr><th>frame</th>
+<td><table frame><tr><td><div/></td></tr></table></td>
+<td><table frame border><tr><td><div/></td></tr></table></td>
+<td><table frame border="0"><tr><td><div/></td></tr></table></td>
+<td><table frame border="1"><tr><td><div/></td></tr></table></td>
+<td><table frame border="3"><tr><td><div/></td></tr></table></td>
+</tr>
+<tr><th>frame="void"</th>
+<td><table frame="void"><tr><td><div/></td></tr></table></td>
+<td><table frame="void" border><tr><td><div/></td></tr></table></td>
+<td><table frame="void" border="0"><tr><td><div/></td></tr></table></td>
+<td><table frame="void" border="1"><tr><td><div/></td></tr></table></td>
+<td><table frame="void" border="3"><tr><td><div/></td></tr></table></td>
+</tr>
+
+<tr><th>frame="above"</th>
+
+<td><table frame="above"><tr><td><div/></td></tr></table></td>
+<td><table frame="above" border><tr><td><div/></td></tr></table></td>
+<td><table frame="above" border="0"><tr><td><div/></td></tr></table></td>
+<td><table frame="above" border="1"><tr><td><div/></td></tr></table></td>
+<td><table frame="above" border="3"><tr><td><div/></td></tr></table></td>
+</tr>
+
+<tr><th>frame="below"</th>
+<td><table frame="below"><tr><td><div/></td></tr></table></td>
+<td><table frame="below" border><tr><td><div/></td></tr></table></td>
+<td><table frame="below" border="0"><tr><td><div/></td></tr></table></td>
+<td><table frame="below" border="1"><tr><td><div/></td></tr></table></td>
+<td><table frame="below" border="3"><tr><td><div/></td></tr></table></td>
+</tr>
+
+<tr><th>frame="hsides"</th>
+<td><table frame="hsides"><tr><td><div/></td></tr></table></td>
+<td><table frame="hsides" border><tr><td><div/></td></tr></table></td>
+<td><table frame="hsides" border="0"><tr><td><div/></td></tr></table></td>
+<td><table frame="hsides" border="1"><tr><td><div/></td></tr></table></td>
+<td><table frame="hsides" border="3"><tr><td><div/></td></tr></table></td>
+</tr>
+
+<tr><th>frame="lhs"</th>
+<td><table frame="lhs"><tr><td><div/></td></tr></table></td>
+<td><table frame="lhs" border><tr><td><div/></td></tr></table></td>
+<td><table frame="lhs" border="0"><tr><td><div/></td></tr></table></td>
+<td><table frame="lhs" border="1"><tr><td><div/></td></tr></table></td>
+<td><table frame="lhs" border="3"><tr><td><div/></td></tr></table></td>
+</tr>
+
+<tr><th>frame="rhs"</th>
+<td><table frame="rhs"><tr><td><div/></td></tr></table></td>
+<td><table frame="rhs" border><tr><td><div/></td></tr></table></td>
+<td><table frame="rhs" border="0"><tr><td><div/></td></tr></table></td>
+<td><table frame="rhs" border="1"><tr><td><div/></td></tr></table></td>
+<td><table frame="rhs" border="3"><tr><td><div/></td></tr></table></td>
+</tr>
+
+<tr><th>frame="vsides"</th>
+<td><table frame="vsides"><tr><td><div/></td></tr></table></td>
+<td><table frame="vsides" border><tr><td><div/></td></tr></table></td>
+<td><table frame="vsides" border="0"><tr><td><div/></td></tr></table></td>
+<td><table frame="vsides" border="1"><tr><td><div/></td></tr></table></td>
+<td><table frame="vsides" border="3"><tr><td><div/></td></tr></table></td>
+</tr>
+
+<tr><th>frame="box"</th>
+<td><table frame="box"><tr><td><div/></td></tr></table></td>
+<td><table frame="box" border><tr><td><div/></td></tr></table></td>
+<td><table frame="box" border="0"><tr><td><div/></td></tr></table></td>
+<td><table frame="box" border="1"><tr><td><div/></td></tr></table></td>
+<td><table frame="box" border="3"><tr><td><div/></td></tr></table></td>
+</tr>
+
+<tr><th>frame="border"</th>
+<td><table frame="border"><tr><td><div/></td></tr></table></td>
+<td><table frame="border" border><tr><td><div/></td></tr></table></td>
+<td><table frame="border" border="0"><tr><td><div/></td></tr></table></td>
+<td><table frame="border" border="1"><tr><td><div/></td></tr></table></td>
+<td><table frame="border" border="3"><tr><td><div/></td></tr></table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-ref.html b/layout/reftests/table-bordercollapse/borderhandling-ref.html
new file mode 100644
index 0000000000..c3bf72492f
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-ref.html
@@ -0,0 +1,11 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 50px; height: 50px;}
+</style>
+</head>
+<body>
+<table border=1><tbody><tr><td><div/></td></tr></tbody></table>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-all-quirks-ref.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-all-quirks-ref.html
new file mode 100644
index 0000000000..63d2ddb587
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-all-quirks-ref.html
@@ -0,0 +1,59 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+div {width: 3px; height: 3px;}
+table.frame {border-style: outset; border-width: thin ;}
+
+table.bc{ border-collapse:collapse; border-style: hidden}
+.bcborder {border-width: 1px; border-style: solid}
+td.inner {border-style: inset; border-width: thin;}
+table.inner td {border-style: inset; border-width: thin;}
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="all"</th>
+<td>
+<table class="bc">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 3px; border-style: outset">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-all-quirks.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-all-quirks.html
new file mode 100644
index 0000000000..ada9045c47
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-all-quirks.html
@@ -0,0 +1,53 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="all"</th>
+<td>
+<table rules="all">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="all" border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="all" border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="all" border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="all" border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-all-strict-ref.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-all-strict-ref.html
new file mode 100644
index 0000000000..4e339a6257
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-all-strict-ref.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+div {width: 3px; height: 3px;}
+table.frame {border-style: outset; border-width: thin ;}
+
+table.bc{ border-collapse:collapse; border-style: hidden}
+.bcborder {border-width: 1px; border-style: solid}
+td.inner {border-style: inset; border-width: thin;}
+table.inner td {border-style: inset; border-width: thin;}
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="all"</th>
+<td>
+<table class="bc">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 3px; border-style: outset">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-all-strict.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-all-strict.html
new file mode 100644
index 0000000000..01af55802a
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-all-strict.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="all"</th>
+<td>
+<table rules="all">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="all" border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="all" border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="all" border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="all" border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-cols-quirks-ref.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-cols-quirks-ref.html
new file mode 100644
index 0000000000..5cf82c073e
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-cols-quirks-ref.html
@@ -0,0 +1,60 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+div {width: 3px; height: 3px;}
+table.frame {border-style: outset; border-width: thin ;}
+
+table.bc{ border-collapse:collapse; border-style: hidden}
+.bcborder {border-width: 1px; border-style: solid}
+td.inner {border-style: inset; border-width: thin;}
+table.inner td {border-style: inset; border-width: thin;}
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="cols"</th>
+<td>
+<table table class="bc" >
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table table class="bc" >
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table table class="bc" style="border-width: 3px; border-style: outset">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-cols-quirks.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-cols-quirks.html
new file mode 100644
index 0000000000..349eb0d76a
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-cols-quirks.html
@@ -0,0 +1,55 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="cols"</th>
+<td>
+<table rules="cols">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="cols" border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="cols" border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="cols" border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="cols" border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-cols-strict-ref.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-cols-strict-ref.html
new file mode 100644
index 0000000000..e0fedb0313
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-cols-strict-ref.html
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+div {width: 3px; height: 3px;}
+table.frame {border-style: outset; border-width: thin ;}
+
+table.bc{ border-collapse:collapse; border-style: hidden}
+.bcborder {border-width: 1px; border-style: solid}
+td.inner {border-style: inset; border-width: thin;}
+table.inner td {border-style: inset; border-width: thin;}
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="cols"</th>
+<td>
+<table table class="bc" >
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table table class="bc" >
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table table class="bc" style="border-width: 3px; border-style: outset">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-cols-strict.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-cols-strict.html
new file mode 100644
index 0000000000..198018dda5
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-cols-strict.html
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="cols"</th>
+<td>
+<table rules="cols">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="cols" border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="cols" border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="cols" border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="cols" border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-empty-quirks-ref.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-empty-quirks-ref.html
new file mode 100644
index 0000000000..757dec0980
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-empty-quirks-ref.html
@@ -0,0 +1,58 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+div {width: 3px; height: 3px;}
+table.frame {border-style: outset; border-width: thin ;}
+
+table.bc{ border-collapse:collapse; border-style: hidden}
+.bcborder {border-width: 1px; border-style: solid}
+td.inner {border-style: inset; border-width: thin;}
+table.inner td {border-style: inset; border-width: thin;}
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>empty</th>
+<td><table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame inner">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame inner">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame inner" style="border-width:3px">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-empty-quirks.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-empty-quirks.html
new file mode 100644
index 0000000000..b564d5fcf0
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-empty-quirks.html
@@ -0,0 +1,52 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>empty</th>
+<td><table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-empty-strict-ref.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-empty-strict-ref.html
new file mode 100644
index 0000000000..9c32a6697e
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-empty-strict-ref.html
@@ -0,0 +1,59 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+div {width: 3px; height: 3px;}
+table.frame {border-style: outset; border-width: thin ;}
+
+table.bc{ border-collapse:collapse; border-style: hidden}
+.bcborder {border-width: 1px; border-style: solid}
+td.inner {border-style: inset; border-width: thin;}
+table.inner td {border-style: inset; border-width: thin;}
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>empty</th>
+<td><table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame inner">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame inner">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame inner" style="border-width:3px">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-empty-strict.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-empty-strict.html
new file mode 100644
index 0000000000..55e7443c6e
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-empty-strict.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>empty</th>
+<td><table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-groups-quirks-ref.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-groups-quirks-ref.html
new file mode 100644
index 0000000000..553cda44da
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-groups-quirks-ref.html
@@ -0,0 +1,59 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+div {width: 3px; height: 3px;}
+table.frame {border-style: outset; border-width: thin ;}
+
+table.bc{ border-collapse:collapse; border-style: hidden}
+.bcborder {border-width: 1px; border-style: solid}
+td.inner {border-style: inset; border-width: thin;}
+table.inner td {border-style: inset; border-width: thin;}
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="groups"</th>
+<td>
+<table class="bc">
+ <colgroup class="bcborder"><col><col></colgroup>
+ <colgroup class="bcborder"><col></colgroup>
+ <thead class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup class="bcborder"><col><col></colgroup>
+ <colgroup class="bcborder"><col></colgroup>
+ <thead class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc">
+ <colgroup class="bcborder"><col><col></colgroup>
+ <colgroup class="bcborder"><col></colgroup>
+ <thead class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup class="bcborder"><col><col></colgroup>
+ <colgroup class="bcborder"><col></colgroup>
+ <thead class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 3px; border-style: outset">
+ <colgroup class="bcborder"><col><col></colgroup>
+ <colgroup class="bcborder"><col></colgroup>
+ <thead class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-groups-quirks.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-groups-quirks.html
new file mode 100644
index 0000000000..1af52c7c2d
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-groups-quirks.html
@@ -0,0 +1,53 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="groups"</th>
+<td>
+<table rules="groups">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="groups" border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="groups" border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="groups" border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="groups" border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-groups-strict-ref.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-groups-strict-ref.html
new file mode 100644
index 0000000000..c729ace871
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-groups-strict-ref.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+div {width: 3px; height: 3px;}
+table.frame {border-style: outset; border-width: thin ;}
+
+table.bc{ border-collapse:collapse; border-style: hidden}
+.bcborder {border-width: 1px; border-style: solid}
+td.inner {border-style: inset; border-width: thin;}
+table.inner td {border-style: inset; border-width: thin;}
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="groups"</th>
+<td>
+<table class="bc">
+ <colgroup class="bcborder"><col><col></colgroup>
+ <colgroup class="bcborder"><col></colgroup>
+ <thead class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup class="bcborder"><col><col></colgroup>
+ <colgroup class="bcborder"><col></colgroup>
+ <thead class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc">
+ <colgroup class="bcborder"><col><col></colgroup>
+ <colgroup class="bcborder"><col></colgroup>
+ <thead class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup class="bcborder"><col><col></colgroup>
+ <colgroup class="bcborder"><col></colgroup>
+ <thead class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 3px; border-style: outset">
+ <colgroup class="bcborder"><col><col></colgroup>
+ <colgroup class="bcborder"><col></colgroup>
+ <thead class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-groups-strict.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-groups-strict.html
new file mode 100644
index 0000000000..96393bc2fb
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-groups-strict.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="groups"</th>
+<td>
+<table rules="groups">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="groups" border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="groups" border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="groups" border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="groups" border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-none-quirks-ref.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-none-quirks-ref.html
new file mode 100644
index 0000000000..cf5af7f865
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-none-quirks-ref.html
@@ -0,0 +1,59 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+div {width: 3px; height: 3px;}
+table.frame {border-style: outset; border-width: thin ;}
+
+table.bc{ border-collapse:collapse; border-style: hidden}
+.bcborder {border-width: 1px; border-style: solid}
+td.inner {border-style: inset; border-width: thin;}
+table.inner td {border-style: inset; border-width: thin;}
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="none"</th>
+<td>
+<table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame" style="border-width:3px">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-none-quirks.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-none-quirks.html
new file mode 100644
index 0000000000..e35724e0f4
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-none-quirks.html
@@ -0,0 +1,53 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="none"</th>
+<td>
+<table rules="none">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="none" border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="none" border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="none" border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="none" border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-none-strict-ref.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-none-strict-ref.html
new file mode 100644
index 0000000000..9034914185
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-none-strict-ref.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+div {width: 3px; height: 3px;}
+table.frame {border-style: outset; border-width: thin ;}
+
+table.bc{ border-collapse:collapse; border-style: hidden}
+.bcborder {border-width: 1px; border-style: solid}
+td.inner {border-style: inset; border-width: thin;}
+table.inner td {border-style: inset; border-width: thin;}
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="none"</th>
+<td>
+<table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame" style="border-width:3px">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-none-strict.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-none-strict.html
new file mode 100644
index 0000000000..535c51ec69
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-none-strict.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="none"</th>
+<td>
+<table rules="none">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="none" border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="none" border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="none" border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="none" border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-ref.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-ref.html
new file mode 100644
index 0000000000..79d51c4cc3
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-ref.html
@@ -0,0 +1,293 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+div {width: 3px; height: 3px;}
+table.frame {border-style: outset; border-width: thin ;}
+
+table.bc{ border-collapse:collapse; border-style: hidden}
+.bcborder {border-width: 1px; border-style: solid}
+td.inner {border-style: inset; border-width: thin;}
+table.inner td {border-style: inset; border-width: thin;}
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>empty</th>
+<td><table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame inner">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame inner">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame inner" style="border-width:3px">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+<tr><th>rules</th>
+<td><table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame inner">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame inner">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame inner" style="border-width:3px">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+
+<tr><th>rules="none"</th>
+<td>
+<table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame" style="border-width:3px">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+<tr><th>rules="groups"</th>
+<td>
+<table class="bc">
+ <colgroup class="bcborder"><col><col></colgroup>
+ <colgroup class="bcborder"><col></colgroup>
+ <thead class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup class="bcborder"><col><col></colgroup>
+ <colgroup class="bcborder"><col></colgroup>
+ <thead class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc">
+ <colgroup class="bcborder"><col><col></colgroup>
+ <colgroup class="bcborder"><col></colgroup>
+ <thead class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup class="bcborder"><col><col></colgroup>
+ <colgroup class="bcborder"><col></colgroup>
+ <thead class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 3px; border-style: outset">
+ <colgroup class="bcborder"><col><col></colgroup>
+ <colgroup class="bcborder"><col></colgroup>
+ <thead class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody class="bcborder"><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+
+
+
+
+
+<tr><th>rules="rows"</th>
+<td>
+<table class="bc">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 3px; border-style: outset">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+
+<tr><th>rules="cols"</th>
+<td>
+<table table class="bc" >
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table table class="bc" >
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table table class="bc" style="border-width: 3px; border-style: outset">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+
+<tr><th>rules="all"</th>
+<td>
+<table class="bc">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 3px; border-style: outset">
+ <colgroup><col class="bcborder"><col class="bcborder"></colgroup>
+ <colgroup><col class="bcborder"></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-rows-quirks-ref.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-rows-quirks-ref.html
new file mode 100644
index 0000000000..526bbe4b86
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-rows-quirks-ref.html
@@ -0,0 +1,59 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+div {width: 3px; height: 3px;}
+table.frame {border-style: outset; border-width: thin ;}
+
+table.bc{ border-collapse:collapse; border-style: hidden}
+.bcborder {border-width: 1px; border-style: solid}
+td.inner {border-style: inset; border-width: thin;}
+table.inner td {border-style: inset; border-width: thin;}
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="rows"</th>
+<td>
+<table class="bc">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 3px; border-style: outset">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-rows-quirks.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-rows-quirks.html
new file mode 100644
index 0000000000..030f79e2e1
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-rows-quirks.html
@@ -0,0 +1,53 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="rows"</th>
+<td>
+<table rules="rows">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="rows" border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="rows" border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="rows" border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="rows" border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-rows-strict-ref.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-rows-strict-ref.html
new file mode 100644
index 0000000000..3e1dc1579a
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-rows-strict-ref.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+div {width: 3px; height: 3px;}
+table.frame {border-style: outset; border-width: thin ;}
+
+table.bc{ border-collapse:collapse; border-style: hidden}
+.bcborder {border-width: 1px; border-style: solid}
+td.inner {border-style: inset; border-width: thin;}
+table.inner td {border-style: inset; border-width: thin;}
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="rows"</th>
+<td>
+<table class="bc">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 1px; border-style: solid">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="bc" style="border-width: 3px; border-style: outset">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr><tr class="bcborder"><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-rows-strict.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-rows-strict.html
new file mode 100644
index 0000000000..233ba687af
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-rows-strict.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules="rows"</th>
+<td>
+<table rules="rows">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="rows" border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="rows" border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="rows" border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="rows" border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-rules-quirks-ref.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-rules-quirks-ref.html
new file mode 100644
index 0000000000..0d0c073eda
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-rules-quirks-ref.html
@@ -0,0 +1,58 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+div {width: 3px; height: 3px;}
+table.frame {border-style: outset; border-width: thin ;}
+
+table.bc{ border-collapse:collapse; border-style: hidden}
+.bcborder {border-width: 1px; border-style: solid}
+td.inner {border-style: inset; border-width: thin;}
+table.inner td {border-style: inset; border-width: thin;}
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules</th>
+<td><table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame inner">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame inner">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame inner" style="border-width:3px">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-rules-quirks.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-rules-quirks.html
new file mode 100644
index 0000000000..66083fa27b
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-rules-quirks.html
@@ -0,0 +1,52 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules</th>
+<td><table rules>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-rules-strict-ref.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-rules-strict-ref.html
new file mode 100644
index 0000000000..4cb1641131
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-rules-strict-ref.html
@@ -0,0 +1,59 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+div {width: 3px; height: 3px;}
+table.frame {border-style: outset; border-width: thin ;}
+
+table.bc{ border-collapse:collapse; border-style: hidden}
+.bcborder {border-width: 1px; border-style: solid}
+td.inner {border-style: inset; border-width: thin;}
+table.inner td {border-style: inset; border-width: thin;}
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules</th>
+<td><table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame inner">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame inner">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table class="frame inner" style="border-width:3px">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border-rules-strict.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border-rules-strict.html
new file mode 100644
index 0000000000..7b3d30c9a7
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border-rules-strict.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>rules</th>
+<td><table rules>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/borderhandling-rules-border.html b/layout/reftests/table-bordercollapse/borderhandling-rules-border.html
new file mode 100644
index 0000000000..ef5c881435
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-rules-border.html
@@ -0,0 +1,287 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 3px; height: 3px;}
+
+</style>
+</head>
+<body>
+<table cellpadding="5" rules="all">
+<tr><th>rules/border</th><th>empty</th><th>border</th><th>border="0"</th><th>border="1"</th><th>border="3"</th></tr>
+<tr><th>empty</th>
+<td><table>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+<tr><th>rules</th>
+<td><table rules>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+
+<tr><th>rules="none"</th>
+<td>
+<table rules="none">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="none" border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="none" border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="none" border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="none" border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+<tr><th>rules="groups"</th>
+<td>
+<table rules="groups">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="groups" border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="groups" border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="groups" border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="groups" border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+
+
+
+
+
+<tr><th>rules="rows"</th>
+<td>
+<table rules="rows">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="rows" border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="rows" border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="rows" border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="rows" border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+
+<tr><th>rules="cols"</th>
+<td>
+<table rules="cols">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="cols" border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="cols" border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="cols" border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="cols" border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+
+<tr><th>rules="all"</th>
+<td>
+<table rules="all">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="all" border>
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="all" border="0">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="all" border="1">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+<td><table rules="all" border="3">
+ <colgroup><col><col></colgroup>
+ <colgroup><col></colgroup>
+ <thead><tr><td><div/></td><td><div/></td><td><div/></td></tr></thead>
+ <tfoot><tr><td><div/></td><td><div/></td><td><div/></td></tr></tfoot>
+ <tbody><tr><td><div/></td><td><div/></td><td><div/></td></tr><tr><td><div/></td><td><div/></td><td><div/></td></tr></tbody>
+</table></td>
+</tr>
+</table>
+
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/table-bordercollapse/borderhandling-strict-ref.html b/layout/reftests/table-bordercollapse/borderhandling-strict-ref.html
new file mode 100644
index 0000000000..a472e01515
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/borderhandling-strict-ref.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<style>
+div {width: 50px; height: 50px;}
+</style>
+</head>
+<body>
+<table border=1><tbody><tr><td><div/></td></tr></tbody></table>
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/bug1375518-2.html b/layout/reftests/table-bordercollapse/bug1375518-2.html
new file mode 100644
index 0000000000..6e5af3c361
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1375518-2.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Table border collapse</title>
+<style>
+ div > span {
+ display: table-cell;
+ background-color: black;
+ height: 100px;
+ width: 100px;
+ border-radius: 50px;
+ }
+ div {
+ display: table;
+ border-collapse: collapse;
+ }
+</style>
+</head>
+<body>
+ <div><span></span></div>
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/bug1375518-3.html b/layout/reftests/table-bordercollapse/bug1375518-3.html
new file mode 100644
index 0000000000..d11edac929
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1375518-3.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Separated border model table</title>
+<style>
+ div > span {
+ display: table-cell;
+ background-color: black;
+ height: 100px;
+ width: 100px;
+ border-radius: 50px;
+ }
+ div {
+ display: table;
+ border-collapse: separate;
+ }
+</style>
+</head>
+<body>
+ <div><span></span></div>
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/bug1375518-4-ref.html b/layout/reftests/table-bordercollapse/bug1375518-4-ref.html
new file mode 100644
index 0000000000..55b0b74586
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1375518-4-ref.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<title>border-radius and separated border model tables</title>
+<style>
+
+body { background: white; color: black }
+
+table { border-collapse: separate; margin: 1em 2px; }
+table, td { border: 1px solid black; }
+
+.radius { border: 3px solid teal; background: aqua; color: black; }
+
+</style>
+
+<h1>border-radius and separated border model tables</h1>
+
+<table>
+ <tbody>
+ <tr><td>xx</td><td>xx</td><td>xx
+ </td></tr></tbody>
+ <tbody class="radius">
+ <tr><td>xx</td><td>xx</td><td>xx
+ </td></tr><tr><td>xx</td><td>xx</td><td>xx
+ </td></tr></tbody>
+ <tbody>
+ <tr><td>xx</td><td>xx</td><td>xx
+ </td></tr></tbody>
+</table>
+
+<table>
+ <tbody><tr class="radius"><td>xx</td><td>xx</td><td>xx
+ </td></tr><tr><td>xx</td><td>xx</td><td>xx
+</td></tr></tbody></table>
+
+<table>
+ <colgroup class="radius"><col><col></colgroup><colgroup><col>
+ </colgroup><tbody><tr><td>xx</td><td>xx</td><td>xx
+ </td></tr><tr><td>xx</td><td>xx</td><td>xx
+</td></tr></tbody></table>
+
+<table>
+ <colgroup><col><col class="radius"><col>
+ </colgroup><tbody><tr><td>xx</td><td>xx</td><td>xx
+ </td></tr><tr><td>xx</td><td>xx</td><td>xx
+</td></tr></tbody></table>
diff --git a/layout/reftests/table-bordercollapse/bug1375518-4.html b/layout/reftests/table-bordercollapse/bug1375518-4.html
new file mode 100644
index 0000000000..e319d75765
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1375518-4.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<title>border-radius and separated border model tables</title>
+<style>
+
+body { background: white; color: black }
+
+table { border-collapse: separate; margin: 1em 2px; }
+table, td { border: 1px solid black; }
+
+.radius { border: 3px solid teal; background: aqua; color: black; border-radius: 12px }
+
+</style>
+
+<h1>border-radius and separated border model tables</h1>
+
+<table>
+ <tbody>
+ <tr><td>xx</td><td>xx</td><td>xx
+ </td></tr></tbody>
+ <tbody class="radius">
+ <tr><td>xx</td><td>xx</td><td>xx
+ </td></tr><tr><td>xx</td><td>xx</td><td>xx
+ </td></tr></tbody>
+ <tbody>
+ <tr><td>xx</td><td>xx</td><td>xx
+ </td></tr></tbody>
+</table>
+
+<table>
+ <tbody><tr class="radius"><td>xx</td><td>xx</td><td>xx
+ </td></tr><tr><td>xx</td><td>xx</td><td>xx
+</td></tr></tbody></table>
+
+<table>
+ <colgroup class="radius"><col><col></colgroup><colgroup><col>
+ </colgroup><tbody><tr><td>xx</td><td>xx</td><td>xx
+ </td></tr><tr><td>xx</td><td>xx</td><td>xx
+</td></tr></tbody></table>
+
+<table>
+ <colgroup><col><col class="radius"><col>
+ </colgroup><tbody><tr><td>xx</td><td>xx</td><td>xx
+ </td></tr><tr><td>xx</td><td>xx</td><td>xx
+</td></tr></tbody></table>
diff --git a/layout/reftests/table-bordercollapse/bug1375518-5-ref.html b/layout/reftests/table-bordercollapse/bug1375518-5-ref.html
new file mode 100644
index 0000000000..7fc8258ce4
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1375518-5-ref.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML>
+<title>border-radius and border-collapse tables</title>
+<style>
+
+body { background: white; color: black }
+
+table { border-collapse: collapse; margin: 1em 2px; }
+td { border: 1px solid black; }
+
+.radius { border: 3px solid teal; background: aqua; color: black; }
+
+</style>
+
+<h1>border-radius and border-collapse tables</h1>
+
+<table>
+ <tbody>
+ <tr><td>xx<td>xx<td>xx
+ </tbody>
+ <tbody class="radius">
+ <tr><td>xx<td>xx<td>xx
+ <tr><td>xx<td>xx<td>xx
+ </tbody>
+ <tbody>
+ <tr><td>xx<td>xx<td>xx
+ </tbody>
+</table>
+
+<table>
+ <tr class="radius"><td>xx<td>xx<td>xx
+ <tr><td>xx<td>xx<td>xx
+</table>
+
+<table>
+ <colgroup class="radius"><col><col><colgroup><col>
+ <tr><td>xx<td>xx<td>xx
+ <tr><td>xx<td>xx<td>xx
+</table>
+
+<table>
+ <col><col class="radius"><col>
+ <tr><td>xx<td>xx<td>xx
+ <tr><td>xx<td>xx<td>xx
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bug1375518-5.html b/layout/reftests/table-bordercollapse/bug1375518-5.html
new file mode 100644
index 0000000000..d570edd42e
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1375518-5.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML>
+<title>border-radius and border-collapse tables</title>
+<style>
+
+body { background: white; color: black }
+
+table { border-collapse: collapse; margin: 1em 2px; }
+td { border: 1px solid black; }
+
+.radius { border: 3px solid teal; background: aqua; color: black; border-radius: 12px }
+
+</style>
+
+<h1>border-radius and border-collapse tables</h1>
+
+<table>
+ <tbody>
+ <tr><td>xx<td>xx<td>xx
+ </tbody>
+ <tbody class="radius">
+ <tr><td>xx<td>xx<td>xx
+ <tr><td>xx<td>xx<td>xx
+ </tbody>
+ <tbody>
+ <tr><td>xx<td>xx<td>xx
+ </tbody>
+</table>
+
+<table>
+ <tr class="radius"><td>xx<td>xx<td>xx
+ <tr><td>xx<td>xx<td>xx
+</table>
+
+<table>
+ <colgroup class="radius"><col><col><colgroup><col>
+ <tr><td>xx<td>xx<td>xx
+ <tr><td>xx<td>xx<td>xx
+</table>
+
+<table>
+ <col><col class="radius"><col>
+ <tr><td>xx<td>xx<td>xx
+ <tr><td>xx<td>xx<td>xx
+</table>
+
diff --git a/layout/reftests/table-bordercollapse/bug1375518-ref.html b/layout/reftests/table-bordercollapse/bug1375518-ref.html
new file mode 100644
index 0000000000..0f5f9ca049
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1375518-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Table border collapse</title>
+<style>
+ div {
+ background-color: black;
+ height: 100px;
+ width: 100px;
+ border-radius: 50px;
+ }
+</style>
+</head>
+<body>
+ <div></div>
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/bug1375518.html b/layout/reftests/table-bordercollapse/bug1375518.html
new file mode 100644
index 0000000000..1ed371c656
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1375518.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Table border collapse</title>
+<style>
+ table {
+ border-collapse: collapse;
+ height: 100px;
+ width: 100px;
+ }
+ td {
+ background-color: black;
+ border-radius: 50px;
+ }
+</style>
+</head>
+<body>
+ <table>
+ <tr>
+ <td></td>
+ </tr>
+ </table>
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/bug1379306-ref.html b/layout/reftests/table-bordercollapse/bug1379306-ref.html
new file mode 100644
index 0000000000..79d6b55bae
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1379306-ref.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<title>Table Cell Testcase, bug 1379306</title>
+<style>
+ table.collapse {
+ border-collapse: collapse;
+ }
+ td {
+ border: 20px solid #aaa;
+ width: 120px;
+ height: 150px;
+ }
+ .first {
+ background-color: #000;
+ position: absolute;
+ top: 20px;
+ left: 20px;
+ height: 10px;
+ width: 20px
+ }
+</style>
+<h1>Table Cell Testcase, bug 1379306</h1>
+
+<div style="position: relative;">
+ <table class="collapse">
+ <tr>
+ <td>
+ <div class="first"></div>
+ </td>
+ </tr>
+ </table>
+</div>
+
diff --git a/layout/reftests/table-bordercollapse/bug1379306.html b/layout/reftests/table-bordercollapse/bug1379306.html
new file mode 100644
index 0000000000..55f866d4d7
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1379306.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<title>Table Cell Testcase, bug 1379306</title>
+<style>
+ table.collapse {
+ border-collapse: collapse;
+ }
+ td {
+ border: 20px solid #aaa;
+ width: 120px;
+ height: 150px;
+ position: relative;
+ }
+ div {
+ background-color: #000;
+ position: absolute;
+ top: 0;
+ left: 0;
+ height: 10px;
+ width: 20px
+ }
+</style>
+<h1>Table Cell Testcase, bug 1379306</h1>
+
+<table class="collapse">
+ <tr>
+ <td>
+ <div></div>
+ </td>
+ </tr>
+</table>
diff --git a/layout/reftests/table-bordercollapse/bug1394226-notref.html b/layout/reftests/table-bordercollapse/bug1394226-notref.html
new file mode 100644
index 0000000000..f9ee6230ee
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1394226-notref.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Table border collapse</title>
+<style>
+ table {
+ border-collapse: collapse;
+ }
+ tr.odd {
+ background-color: LightCyan;
+ }
+ tr.even {
+ background-color: LightSkyBlue;
+ }
+ td {
+ border: 5px solid DarkBlue;
+ }
+ .inner td {
+ border: 5px solid red;
+ }
+ .inner tr:first-child td {
+ border-top: 5px solid DarkBlue;
+ }
+ .inner tr td:first-child {
+ border-left: 5px solid DarkBlue;
+ }
+ .inner tr:last-child td {
+ border-bottom: 5px solid DarkBlue;
+ }
+ .inner tr td:last-child {
+ border-right: 5px solid DarkBlue;
+ }
+ div {
+ height: 10px;
+ }
+</style>
+</head>
+<body>
+ <div></div>
+ <table>
+ <caption></caption>
+ <tr class="odd">
+ <td>Cell 1-1</td>
+ <td>Cell 1-2</td>
+ </tr>
+ <tr class="even">
+ <td>Cell 2-1</td>
+ <td>Cell 2-2
+ <table class="inner">
+ <tr class="odd">
+ <td>Cell 2-2/1-1</td>
+ <td>Cell 2-2/1-2</td>
+ </tr>
+ <tr class="even">
+ <td>Cell 2-2/2-1</td>
+ <td>Cell 2-2/2-2</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/bug1394226-ref.html b/layout/reftests/table-bordercollapse/bug1394226-ref.html
new file mode 100644
index 0000000000..3c3c1bb6c2
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1394226-ref.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Table border collapse</title>
+<style>
+ table {
+ border-collapse: collapse;
+ }
+ tr.odd {
+ background-color: LightCyan;
+ }
+ tr.even {
+ background-color: LightSkyBlue;
+ }
+ td {
+ border: 5px solid DarkBlue;
+ }
+ div {
+ height: 10px;
+ }
+</style>
+</head>
+<body>
+ <div></div>
+ <table>
+ <tr class="odd">
+ <td>Cell 1-1</td>
+ <td>Cell 1-2</td>
+ </tr>
+ <tr class="even">
+ <td>Cell 2-1</td>
+ <td>Cell 2-2
+ <table>
+ <tr class="odd">
+ <td>Cell 2-2/1-1</td>
+ <td>Cell 2-2/1-2</td>
+ </tr>
+ <tr class="even">
+ <td>Cell 2-2/2-1</td>
+ <td>Cell 2-2/2-2</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/bug1394226.html b/layout/reftests/table-bordercollapse/bug1394226.html
new file mode 100644
index 0000000000..359e6aa02e
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1394226.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Table border collapse</title>
+<style>
+ table {
+ border-collapse: collapse;
+ }
+ tr.odd {
+ background-color: LightCyan;
+ }
+ tr.even {
+ background-color: LightSkyBlue;
+ }
+ td {
+ border: 5px solid DarkBlue;
+ }
+ caption {
+ height: 10px
+ }
+</style>
+</head>
+<body>
+ <table>
+ <caption></caption>
+ <tr class="odd">
+ <td>Cell 1-1</td>
+ <td>Cell 1-2</td>
+ </tr>
+ <tr class="even">
+ <td>Cell 2-1</td>
+ <td>Cell 2-2
+ <table>
+ <tr class="odd">
+ <td>Cell 2-2/1-1</td>
+ <td>Cell 2-2/1-2</td>
+ </tr>
+ <tr class="even">
+ <td>Cell 2-2/2-1</td>
+ <td>Cell 2-2/2-2</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/bug1405929-2-ref.html b/layout/reftests/table-bordercollapse/bug1405929-2-ref.html
new file mode 100644
index 0000000000..d007c91561
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1405929-2-ref.html
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<title>Bug 1405929 reftest reference</title>
+<style>
+
+table {
+ border-collapse: collapse;
+ display: inline-table;
+ vertical-align: top;
+ margin: 20px;
+ width: 20px;
+}
+
+td {
+ background: green border-box;
+ padding: 20px;
+ width: 10px;
+}
+
+.bb {
+ border-bottom: 5px dashed fuchsia;
+}
+
+</style>
+
+<table>
+ <tbody>
+ <tr>
+ <td>
+ <td>
+ <tr>
+ <td colspan="2" class=bb>
+ <tr>
+ <td colspan="2">
+ </tbody>
+</table>
diff --git a/layout/reftests/table-bordercollapse/bug1405929-2.html b/layout/reftests/table-bordercollapse/bug1405929-2.html
new file mode 100644
index 0000000000..efe7ff2416
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1405929-2.html
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<title>Bug 1405929 reftest</title>
+<style>
+
+table {
+ border-collapse: collapse;
+ display: inline-table;
+ vertical-align: top;
+ margin: 20px;
+ width: 20px;
+}
+
+td {
+ background: green border-box;
+ padding: 20px;
+ width: 10px;
+}
+
+.bb {
+ border-bottom: 5px dashed fuchsia;
+}
+
+</style>
+
+<table>
+ <tbody>
+ <tr>
+ <td>
+ <td rowspan="2" class=bb>
+ <tr>
+ <td class=bb>
+ <tr>
+ <td colspan="2">
+ </tbody>
+</table>
diff --git a/layout/reftests/table-bordercollapse/bug1405929-ref.html b/layout/reftests/table-bordercollapse/bug1405929-ref.html
new file mode 100644
index 0000000000..426a7421d1
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1405929-ref.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Bug 1405929 reftest reference</title>
+<style type="text/css">
+table { border-collapse: collapse; }
+td { padding-left: 1em; }
+td:first-child {
+ border-bottom: 1px solid black;
+}
+.x {
+ border-bottom: 1px solid black;
+}
+</style>
+
+</head>
+<body>
+<table>
+ <tr> <td>1 </td> <td class="x" rowspan="2">Spans 1-2</td> </tr>
+ <tr> <td>2 </td> </tr>
+ <tr> <td>3 </td> <td class="x" rowspan="3">Spans 3-5</td> </tr>
+ <tr> <td>4 </td> </tr>
+ <tr> <td>5 </td> </tr>
+ <tr> <td>6 </td> <td class="x">Nospan</td> </tr>
+ <tr> <td>7 </td> <td class="x" rowspan="2">Spans 7-8</td> </tr>
+ <tr> <td>8 </td> </tr>
+ <tr> <td>9 </td> <td></td> </tr>
+ <tr> <td>10</td> <td class="x"></td> </tr>
+ <tr> <td>11</td> <td class="x" rowspan="4">Spans 11-14</td> </tr>
+ <tr> <td>12</td> </tr>
+ <tr> <td>13</td> </tr>
+ <tr> <td>14</td> </tr>
+ <tr> <td>13</td> <td class="x">Nospan</td> </tr>
+</table>
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/bug1405929.html b/layout/reftests/table-bordercollapse/bug1405929.html
new file mode 100644
index 0000000000..840f351ea3
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1405929.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<head>
+<title>Bug 1405929 reftest</title>
+<style type="text/css">
+table { border-collapse: collapse; }
+tr { border-bottom: 1px solid black; }
+td { padding-left: 1em; }
+</style>
+
+</head>
+<body>
+
+<table>
+ <tr> <td>1 </td> <td rowspan="2">Spans 1-2 </td> </tr>
+ <tr> <td>2 </td> </tr>
+ <tr> <td>3 </td> <td rowspan="3">Spans 3-5 </td> </tr>
+ <tr> <td>4 </td> </tr>
+ <tr> <td>5 </td> </tr>
+ <tr> <td>6 </td> <td> Nospan </td> </tr>
+ <tr> <td>7 </td> <td rowspan="2">Spans 7-8 </td> </tr>
+ <tr> <td>8 </td> </tr>
+ <tr> <td>9 </td> <td rowspan="2"></td> </tr>
+ <tr> <td>10</td> </tr>
+ <tr> <td>11</td> <td rowspan="4">Spans 11-14</td> </tr>
+ <tr> <td>12</td> </tr>
+ <tr> <td>13</td> </tr>
+ <tr> <td>14</td> </tr>
+ <tr> <td>13</td> <td> Nospan </td> </tr>
+</table>
+
+</body>
+</html>
+
+
diff --git a/layout/reftests/table-bordercollapse/bug1421887-ref.html b/layout/reftests/table-bordercollapse/bug1421887-ref.html
new file mode 100644
index 0000000000..e085b3bd52
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1421887-ref.html
@@ -0,0 +1,56 @@
+<html>
+<head>
+<title>Bug 1421887 reftest reference</title>
+<style type="text/css">
+table
+{
+ border-collapse : collapse;
+}
+td
+{
+ padding : 5px;
+ background-color : #F7F7F8;
+ border-left : dashed 1px;
+ border-right : dashed 1px;
+ text-align : left;
+}
+.bb {
+ border-bottom : solid 1px;
+ border-top : solid 1px;
+
+}
+</style>
+</head>
+
+<body>
+<table>
+<thead>
+ <tr>
+ <th>test</th>
+ <th>test</th>
+ </tr>
+</thead>
+<tbody>
+ <tr>
+ <td class="bb">test</td>
+
+ <td class="bb" rowspan="2">test</td>
+ </tr>
+ <tr><td class="bb">test</td></tr>
+
+ <tr>
+
+ <td class="bb">test</td>
+ <td></td>
+ </tr>
+ <tr><td class="bb">test</td><td></td></tr>
+
+ <tr>
+ <td class="bb">test</td>
+ <td class="bb" rowspan="2">test</td>
+ </tr>
+ <tr><td class="bb">test</td></tr>
+</tbody>
+</table>
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/bug1421887.html b/layout/reftests/table-bordercollapse/bug1421887.html
new file mode 100644
index 0000000000..e77b974e78
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bug1421887.html
@@ -0,0 +1,53 @@
+<html>
+<head>
+<title>Bug 1421887 reftest</title>
+<style type="text/css">
+table
+{
+ border-collapse : collapse;
+}
+td
+{
+ padding : 5px;
+ background-color : #F7F7F8;
+ border-left : dashed 1px;
+ border-right : dashed 1px;
+ border-bottom : solid 1px;
+ border-top : solid 1px;
+ text-align : left;
+}
+</style>
+</head>
+
+<body>
+<table>
+<thead>
+ <tr>
+ <th>test</th>
+ <th>test</th>
+ </tr>
+</thead>
+<tbody>
+ <tr>
+ <td>test</td>
+
+ <td rowspan="2">test</td>
+ </tr>
+ <tr><td>test</td></tr>
+
+ <tr>
+
+ <td>test</td>
+ <td rowspan="2"></td>
+ </tr>
+ <tr><td>test</td></tr>
+
+ <tr>
+ <td>test</td>
+ <td rowspan="2">test</td>
+ </tr>
+ <tr><td>test</td></tr>
+</tbody>
+</table>
+</body>
+</html>
diff --git a/layout/reftests/table-bordercollapse/double_borders.html b/layout/reftests/table-bordercollapse/double_borders.html
new file mode 100644
index 0000000000..25c4e87f2b
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/double_borders.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<table style="border-collapse: collapse; border: 1px double blue">
+ <tr>
+ <td>This should have a blue border</td>
+ </tr>
+</table>
diff --git a/layout/reftests/table-bordercollapse/double_borders_ref.html b/layout/reftests/table-bordercollapse/double_borders_ref.html
new file mode 100644
index 0000000000..a323fdaa07
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/double_borders_ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<table style="border-collapse: collapse; border: 1px solid blue">
+ <tr>
+ <td>This should have a blue border</td>
+ </tr>
+</table>
diff --git a/layout/reftests/table-bordercollapse/empty-toprow-ref.html b/layout/reftests/table-bordercollapse/empty-toprow-ref.html
new file mode 100644
index 0000000000..429dea3666
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/empty-toprow-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<style>
+ table {
+ border: 1px solid black;
+ border-collapse: collapse;
+ }
+ td {
+ border: 1px solid black;
+ }
+</style>
+<table>
+ <tr>
+ <td>td</td>
+ </tr>
+</table>
diff --git a/layout/reftests/table-bordercollapse/empty-toprow.html b/layout/reftests/table-bordercollapse/empty-toprow.html
new file mode 100644
index 0000000000..0843891311
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/empty-toprow.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<style>
+ table {
+ border: 1px solid black;
+ border-collapse: collapse;
+ }
+ td {
+ border: 1px solid black;
+ }
+</style>
+<table>
+ <tr></tr>
+ <tr>
+ <td>td</td>
+ </tr>
+</table>
diff --git a/layout/reftests/table-bordercollapse/frame_above_rules_all.html b/layout/reftests/table-bordercollapse/frame_above_rules_all.html
new file mode 100644
index 0000000000..51d538ba7d
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_above_rules_all.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="above" and Rules="all"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+
+<table rules="all" frame="above">
+ <caption><a name="void-none">Frame="above" and Rules="all"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_above_rules_all_ref.html b/layout/reftests/table-bordercollapse/frame_above_rules_all_ref.html
new file mode 100644
index 0000000000..c370742961
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_above_rules_all_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="void" and Rules="all"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="top bc">
+ <caption><a name="void-none">Frame="above" and Rules="all"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td class="border">Row 1, Cell 2</td>
+ <td class="border">Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="border">
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2" class="border">Row 2, Cell 2</td>
+ </tr>
+ <tr class="border">
+ <td class="border">Row 3, Cell 2</td>
+ <td rowspan="2" class="border">Row 3, Cell 3</td>
+ </tr>
+ <tr class="border">
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td class="border">Row 5, Cell 2</td>
+ <td class="border">Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_above_rules_cols.html b/layout/reftests/table-bordercollapse/frame_above_rules_cols.html
new file mode 100644
index 0000000000..f8a7ce8a3b
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_above_rules_cols.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="above" and Rules="cols"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+
+<table rules="cols" frame="above">
+ <caption><a name="void-none">Frame="above" and Rules="cols"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_above_rules_cols_ref.html b/layout/reftests/table-bordercollapse/frame_above_rules_cols_ref.html
new file mode 100644
index 0000000000..2bfe69f587
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_above_rules_cols_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="above" and Rules="cols"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="top bc">
+ <caption><a name="void-none">Frame="above" and Rules="cols"</caption>
+<thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td class="border">Row 1, Cell 2</td>
+ <td class="border">Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2" class="border">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td class="border">Row 3, Cell 2</td>
+ <td rowspan="2" class="border">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td class="border">Row 5, Cell 2</td>
+ <td class="border">Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_above_rules_groups.html b/layout/reftests/table-bordercollapse/frame_above_rules_groups.html
new file mode 100644
index 0000000000..e04d35b5c0
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_above_rules_groups.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="above" and Rules="groups"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="groups" frame="above">
+ <caption><a name="void-none">Frame="above" and Rules="groups"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_above_rules_groups_ref.html b/layout/reftests/table-bordercollapse/frame_above_rules_groups_ref.html
new file mode 100644
index 0000000000..0fc138df08
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_above_rules_groups_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="void" and Rules="groups"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="top bc">
+ <caption><a name="void-none">Frame="above" and Rules="groups"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody class=border>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_above_rules_none.html b/layout/reftests/table-bordercollapse/frame_above_rules_none.html
new file mode 100644
index 0000000000..e7f70dc9a4
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_above_rules_none.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="above" and Rules="none"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="none" frame="above">
+ <caption><a name="void-none">Frame="above" and Rules="none"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_above_rules_none_ref.html b/layout/reftests/table-bordercollapse/frame_above_rules_none_ref.html
new file mode 100644
index 0000000000..4ab3a0aa0c
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_above_rules_none_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="void" and Rules="none"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="topLight">
+ <caption><a name="void-none">Frame="above" and Rules="none"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_above_rules_rows.html b/layout/reftests/table-bordercollapse/frame_above_rules_rows.html
new file mode 100644
index 0000000000..c5c0283922
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_above_rules_rows.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="rows" and Rules="rows"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+
+<table rules="rows" frame="above">
+ <caption><a name="void-none">Frame="above" and Rules="rows"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_above_rules_rows_ref.html b/layout/reftests/table-bordercollapse/frame_above_rules_rows_ref.html
new file mode 100644
index 0000000000..932bb1e475
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_above_rules_rows_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="void" and Rules="rows"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="top bc">
+ <caption><a name="void-none">Frame="above" and Rules="rows"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class=border>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr class=border>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr class=border>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_below_rules_all.html b/layout/reftests/table-bordercollapse/frame_below_rules_all.html
new file mode 100644
index 0000000000..b9a502ccbe
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_below_rules_all.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="below" and Rules="all"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="all" frame="below">
+ <caption><a name="void-none">Frame="below" and Rules="all"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_below_rules_all_ref.html b/layout/reftests/table-bordercollapse/frame_below_rules_all_ref.html
new file mode 100644
index 0000000000..468d735052
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_below_rules_all_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="below" and Rules="all"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="bottom bc">
+ <caption><a name="void-none">Frame="below" and Rules="all"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td class="border">Row 1, Cell 2</td>
+ <td class="border">Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="border">
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2" class="border">Row 2, Cell 2</td>
+ </tr>
+ <tr class="border">
+ <td class="border">Row 3, Cell 2</td>
+ <td rowspan="2" class="border">Row 3, Cell 3</td>
+ </tr>
+ <tr class="border">
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td class="border">Row 5, Cell 2</td>
+ <td class="border">Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_below_rules_cols.html b/layout/reftests/table-bordercollapse/frame_below_rules_cols.html
new file mode 100644
index 0000000000..deae5cc6fe
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_below_rules_cols.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="below" and Rules="cols"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="cols" frame="below">
+ <caption><a name="void-none">Frame="below" and Rules="cols"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_below_rules_cols_ref.html b/layout/reftests/table-bordercollapse/frame_below_rules_cols_ref.html
new file mode 100644
index 0000000000..a930f09a0a
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_below_rules_cols_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="below" and Rules="cols"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="bottom bc">
+ <caption><a name="void-none">Frame="below" and Rules="cols"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td class="border">Row 1, Cell 2</td>
+ <td class="border">Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2" class="border">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td class="border">Row 3, Cell 2</td>
+ <td rowspan="2" class="border">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td class="border">Row 5, Cell 2</td>
+ <td class="border">Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_below_rules_groups.html b/layout/reftests/table-bordercollapse/frame_below_rules_groups.html
new file mode 100644
index 0000000000..1870663b57
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_below_rules_groups.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="below" and Rules="groups"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="groups" frame="below">
+ <caption><a name="void-none">Frame="below" and Rules="groups"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_below_rules_groups_ref.html b/layout/reftests/table-bordercollapse/frame_below_rules_groups_ref.html
new file mode 100644
index 0000000000..811d115a04
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_below_rules_groups_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="below" and Rules="groups"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="bottom bc">
+ <caption><a name="void-none">Frame="below" and Rules="groups"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody class="border">
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_below_rules_none.html b/layout/reftests/table-bordercollapse/frame_below_rules_none.html
new file mode 100644
index 0000000000..ecd59c96b0
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_below_rules_none.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="below" and Rules="none"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="none" frame="below">
+ <caption><a name="void-none">Frame="below" and Rules="none"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_below_rules_none_ref.html b/layout/reftests/table-bordercollapse/frame_below_rules_none_ref.html
new file mode 100644
index 0000000000..09c462b95c
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_below_rules_none_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="below" and Rules="none"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="bottomDark">
+ <caption><a name="void-none">Frame="below" and Rules="none"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_below_rules_rows.html b/layout/reftests/table-bordercollapse/frame_below_rules_rows.html
new file mode 100644
index 0000000000..134469be36
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_below_rules_rows.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="below" and Rules="rows"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="rows" frame="below">
+ <caption><a name="void-none">Frame="below" and Rules="rows"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_below_rules_rows_ref.html b/layout/reftests/table-bordercollapse/frame_below_rules_rows_ref.html
new file mode 100644
index 0000000000..1b39a61480
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_below_rules_rows_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="below" and Rules="rows"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="bottom bc">
+ <caption><a name="void-none">Frame="below" and Rules="rows"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class=border>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr class=border>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr class=border>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_border_rules_all.html b/layout/reftests/table-bordercollapse/frame_border_rules_all.html
new file mode 100644
index 0000000000..27542f8f93
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_border_rules_all.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="border" and Rules="all"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="all" frame="border">
+ <caption><a name="void-none">Frame="border" and Rules="all"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_border_rules_all_ref.html b/layout/reftests/table-bordercollapse/frame_border_rules_all_ref.html
new file mode 100644
index 0000000000..0e79c2455a
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_border_rules_all_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="border" and Rules="all"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="right left top bottom bc">
+ <caption><a name="void-none">Frame="border" and Rules="all"</caption>
+<thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td class="border">Row 1, Cell 2</td>
+ <td class="border">Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="border">
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2" class="border">Row 2, Cell 2</td>
+ </tr>
+ <tr class="border">
+ <td class="border">Row 3, Cell 2</td>
+ <td rowspan="2" class="border">Row 3, Cell 3</td>
+ </tr>
+ <tr class="border">
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td class="border">Row 5, Cell 2</td>
+ <td class="border">Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_border_rules_cols.html b/layout/reftests/table-bordercollapse/frame_border_rules_cols.html
new file mode 100644
index 0000000000..34fb8580ec
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_border_rules_cols.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="border" and Rules="cols"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="cols" frame="border">
+ <caption><a name="void-none">Frame="border" and Rules="cols"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_border_rules_cols_ref.html b/layout/reftests/table-bordercollapse/frame_border_rules_cols_ref.html
new file mode 100644
index 0000000000..9c7dbceea5
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_border_rules_cols_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="border" and Rules="cols"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="right left top bottom bc">
+ <caption><a name="void-none">Frame="border" and Rules="cols"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td class="border">Row 1, Cell 2</td>
+ <td class="border">Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2" class="border">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td class="border">Row 3, Cell 2</td>
+ <td rowspan="2" class="border">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td class="border">Row 5, Cell 2</td>
+ <td class="border">Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_border_rules_groups.html b/layout/reftests/table-bordercollapse/frame_border_rules_groups.html
new file mode 100644
index 0000000000..31115ab2f7
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_border_rules_groups.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="border" and Rules="groups"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="groups" frame="border">
+ <caption><a name="void-none">Frame="border" and Rules="groups"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_border_rules_groups_ref.html b/layout/reftests/table-bordercollapse/frame_border_rules_groups_ref.html
new file mode 100644
index 0000000000..58c477c08d
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_border_rules_groups_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="border" and Rules="groups"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="right left top bottom bc">
+ <caption><a name="void-none">Frame="border" and Rules="groups"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody class="border">
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_border_rules_none.html b/layout/reftests/table-bordercollapse/frame_border_rules_none.html
new file mode 100644
index 0000000000..3910d49ce5
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_border_rules_none.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="border" and Rules="none"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+ <script language=javascript>
+ function onReftestLoad() {
+ document.getElementById('topRightMask').style.left = (document.getElementById('tablehead').getBoundingClientRect().right + 2) + 'px';
+ document.getElementById('topRightMask').style.top = (document.getElementById('tablehead').getBoundingClientRect().top - 3) + 'px';
+ document.getElementById('bottomLeftMask').style.top = (document.getElementById('tablefooter').getBoundingClientRect().bottom + 2) + 'px';
+ }
+ </script>
+</head>
+<body onload='onReftestLoad();'>
+<div class="maskPixel" id="bottomLeftMask"></div>
+<div class="maskPixel" id="topRightMask"></div>
+<table rules="none" frame="border" id="testtable">
+ <caption><a name="void-none">Frame="border" and Rules="none"</caption>
+ <thead id="tablehead">
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot id='tablefooter'>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_border_rules_none_ref.html b/layout/reftests/table-bordercollapse/frame_border_rules_none_ref.html
new file mode 100644
index 0000000000..7e73bcf0d2
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_border_rules_none_ref.html
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="border" and Rules="none"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+ <script language=javascript>
+ function onReftestLoad() {
+ document.getElementById('topRightMask').style.left = (document.getElementById('tablehead').getBoundingClientRect().right + 2) + 'px';
+ document.getElementById('topRightMask').style.top = (document.getElementById('tablehead').getBoundingClientRect().top - 3) + 'px';
+ document.getElementById('bottomLeftMask').style.top = (document.getElementById('tablefooter').getBoundingClientRect().bottom + 2) + 'px';
+ }
+ </script>
+</head>
+<body onload='onReftestLoad();'>
+<div class="maskPixel" id="bottomLeftMask"></div>
+<div class="maskPixel" id="topRightMask"></div>
+<table class="leftLight topLight rightDark bottomDark">
+ <caption><a name="void-none">Frame="border" and Rules="none"</caption>
+ <thead id="tablehead">
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot id='tablefooter'>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_border_rules_rows.html b/layout/reftests/table-bordercollapse/frame_border_rules_rows.html
new file mode 100644
index 0000000000..2bb47be2f8
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_border_rules_rows.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="border" and Rules="rows"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="rows" frame="border">
+ <caption><a name="void-none">Frame="border" and Rules="rows"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_border_rules_rows_ref.html b/layout/reftests/table-bordercollapse/frame_border_rules_rows_ref.html
new file mode 100644
index 0000000000..13aaddedcb
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_border_rules_rows_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="border" and Rules="rows"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="right left top bottom bc">
+ <caption><a name="void-none">Frame="border" and Rules="rows"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="border">
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr class="border">
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr class="border">
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_box_rules_all.html b/layout/reftests/table-bordercollapse/frame_box_rules_all.html
new file mode 100644
index 0000000000..78fafc87ec
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_box_rules_all.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="box" and Rules="all"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="all" frame="box">
+ <caption><a name="void-none">Frame="box" and Rules="all"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_box_rules_all_ref.html b/layout/reftests/table-bordercollapse/frame_box_rules_all_ref.html
new file mode 100644
index 0000000000..f83ea707ab
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_box_rules_all_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="box" and Rules="all"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="right left top bottom bc">
+ <caption><a name="void-none">Frame="box" and Rules="all"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td class="border">Row 1, Cell 2</td>
+ <td class="border">Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="border">
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2" class="border">Row 2, Cell 2</td>
+ </tr>
+ <tr class="border">
+ <td class="border">Row 3, Cell 2</td>
+ <td rowspan="2" class="border">Row 3, Cell 3</td>
+ </tr>
+ <tr class="border">
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td class="border">Row 5, Cell 2</td>
+ <td class="border">Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_box_rules_cols.html b/layout/reftests/table-bordercollapse/frame_box_rules_cols.html
new file mode 100644
index 0000000000..d9a4bae3d7
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_box_rules_cols.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="box" and Rules="cols"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="cols" frame="box">
+ <caption><a name="void-none">Frame="box" and Rules="cols"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_box_rules_cols_ref.html b/layout/reftests/table-bordercollapse/frame_box_rules_cols_ref.html
new file mode 100644
index 0000000000..8fb8d5d14b
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_box_rules_cols_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="box" and Rules="cols"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="right left top bottom bc">
+ <caption><a name="void-none">Frame="box" and Rules="cols"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td class="border">Row 1, Cell 2</td>
+ <td class="border">Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2" class="border">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td class="border">Row 3, Cell 2</td>
+ <td rowspan="2" class="border">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td class="border">Row 5, Cell 2</td>
+ <td class="border">Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_box_rules_groups.html b/layout/reftests/table-bordercollapse/frame_box_rules_groups.html
new file mode 100644
index 0000000000..4edcc7c46f
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_box_rules_groups.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="box" and Rules="groups"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="groups" frame="box">
+ <caption><a name="void-none">Frame="box" and Rules="groups"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_box_rules_groups_ref.html b/layout/reftests/table-bordercollapse/frame_box_rules_groups_ref.html
new file mode 100644
index 0000000000..bea73c78af
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_box_rules_groups_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="box" and Rules="groups"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="right left top bottom bc">
+ <caption><a name="void-none">Frame="box" and Rules="groups"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody class="border">
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_box_rules_none-collapse-ref.html b/layout/reftests/table-bordercollapse/frame_box_rules_none-collapse-ref.html
new file mode 100644
index 0000000000..35704abda2
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_box_rules_none-collapse-ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="box" and Rules="none" and "border-collapse: collapse"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<table rules="none" frame="box" style="border-collapse: collapse; background: LightCyan; border: solid 1px">
+ <caption><a name="box-none">Frame="box" and Rules="none"</caption>
+ <thead id="tablehead">
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot id='tablefooter'>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_box_rules_none-collapse.html b/layout/reftests/table-bordercollapse/frame_box_rules_none-collapse.html
new file mode 100644
index 0000000000..ff31ca3e2b
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_box_rules_none-collapse.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="box" and Rules="none" and "border-collapse: collapse"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<table rules="none" frame="box" style="border-collapse: collapse">
+ <caption><a name="box-none">Frame="box" and Rules="none"</caption>
+ <thead id="tablehead">
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot id='tablefooter'>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_box_rules_none.html b/layout/reftests/table-bordercollapse/frame_box_rules_none.html
new file mode 100644
index 0000000000..ac49cc23b0
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_box_rules_none.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="box" and Rules="none"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+ <script language=javascript>
+ function onReftestLoad() {
+ document.getElementById('topRightMask').style.left = (document.getElementById('tablehead').getBoundingClientRect().right + 2) + 'px';
+ document.getElementById('topRightMask').style.top = (document.getElementById('tablehead').getBoundingClientRect().top - 3) + 'px';
+ document.getElementById('bottomLeftMask').style.top = (document.getElementById('tablefooter').getBoundingClientRect().bottom + 2) + 'px';
+ }
+ </script>
+</head>
+<body onload='onReftestLoad();'>
+<div class="maskPixel" id="bottomLeftMask"></div>
+<div class="maskPixel" id="topRightMask"></div>
+<table rules="none" frame="box">
+ <caption><a name="void-none">Frame="box" and Rules="none"</caption>
+ <thead id="tablehead">
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot id='tablefooter'>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_box_rules_none_ref.html b/layout/reftests/table-bordercollapse/frame_box_rules_none_ref.html
new file mode 100644
index 0000000000..6d7cd5b13c
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_box_rules_none_ref.html
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="box" and Rules="none"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+ <script language=javascript>
+ function onReftestLoad() {
+ document.getElementById('topRightMask').style.left = (document.getElementById('tablehead').getBoundingClientRect().right + 2) + 'px';
+ document.getElementById('topRightMask').style.top = (document.getElementById('tablehead').getBoundingClientRect().top - 3) + 'px';
+ document.getElementById('bottomLeftMask').style.top = (document.getElementById('tablefooter').getBoundingClientRect().bottom + 2) + 'px';
+ }
+ </script>
+</head>
+<body onload='onReftestLoad();'>
+<div class="maskPixel" id="bottomLeftMask"></div>
+<div class="maskPixel" id="topRightMask"></div>
+<table class="rightDark leftLight topLight bottomDark">
+ <caption><a name="void-none">Frame="box" and Rules="none"</caption>
+ <thead id="tablehead">
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot id='tablefooter'>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_box_rules_rows.html b/layout/reftests/table-bordercollapse/frame_box_rules_rows.html
new file mode 100644
index 0000000000..f23c43ce02
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_box_rules_rows.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="box" and Rules="rows"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="rows" frame="box">
+ <caption><a name="void-none">Frame="box" and Rules="rows"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_box_rules_rows_ref.html b/layout/reftests/table-bordercollapse/frame_box_rules_rows_ref.html
new file mode 100644
index 0000000000..1be7bfd995
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_box_rules_rows_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="box" and Rules="rows"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="right left top bottom bc">
+ <caption><a name="void-none">Frame="box" and Rules="rows"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="border">
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr class="border">
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr class="border">
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_hsides_rules_all.html b/layout/reftests/table-bordercollapse/frame_hsides_rules_all.html
new file mode 100644
index 0000000000..b8dd99e853
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_hsides_rules_all.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="hsides" and Rules="all"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="all" frame="hsides">
+ <caption><a name="void-none">Frame="hsides" and Rules="all"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_hsides_rules_all_ref.html b/layout/reftests/table-bordercollapse/frame_hsides_rules_all_ref.html
new file mode 100644
index 0000000000..7a14d6e930
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_hsides_rules_all_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="hsides" and Rules="all"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="top bottom bc">
+ <caption><a name="void-none">Frame="hsides" and Rules="all"</caption>
+<thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td class="border">Row 1, Cell 2</td>
+ <td class="border">Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="border">
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2" class="border">Row 2, Cell 2</td>
+ </tr>
+ <tr class="border">
+ <td class="border">Row 3, Cell 2</td>
+ <td rowspan="2" class="border">Row 3, Cell 3</td>
+ </tr>
+ <tr class="border">
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td class="border">Row 5, Cell 2</td>
+ <td class="border">Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_hsides_rules_cols.html b/layout/reftests/table-bordercollapse/frame_hsides_rules_cols.html
new file mode 100644
index 0000000000..4e59a4490a
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_hsides_rules_cols.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="hsides" and Rules="cols"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="cols" frame="hsides">
+ <caption><a name="void-none">Frame="hsides" and Rules="cols"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_hsides_rules_cols_ref.html b/layout/reftests/table-bordercollapse/frame_hsides_rules_cols_ref.html
new file mode 100644
index 0000000000..2d44f31d0d
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_hsides_rules_cols_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="hsides" and Rules="cols"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="top bottom bc">
+ <caption><a name="void-none">Frame="hsides" and Rules="cols"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td class="border">Row 1, Cell 2</td>
+ <td class="border">Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2" class="border">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td class="border">Row 3, Cell 2</td>
+ <td rowspan="2" class="border">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td class="border">Row 5, Cell 2</td>
+ <td class="border">Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_hsides_rules_groups.html b/layout/reftests/table-bordercollapse/frame_hsides_rules_groups.html
new file mode 100644
index 0000000000..7f6d1548ff
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_hsides_rules_groups.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="hsides" and Rules="groups"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="groups" frame="hsides">
+ <caption><a name="void-none">Frame="hsides" and Rules="groups"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_hsides_rules_groups_ref.html b/layout/reftests/table-bordercollapse/frame_hsides_rules_groups_ref.html
new file mode 100644
index 0000000000..e72aade1fa
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_hsides_rules_groups_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="hsides" and Rules="groups"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="top bottom bc">
+ <caption><a name="void-none">Frame="hsides" and Rules="groups"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody class="border">
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_hsides_rules_none.html b/layout/reftests/table-bordercollapse/frame_hsides_rules_none.html
new file mode 100644
index 0000000000..002ea5319c
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_hsides_rules_none.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="hsides" and Rules="none"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="none" frame="hsides">
+ <caption><a name="void-none">Frame="hsides" and Rules="none"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_hsides_rules_none_ref.html b/layout/reftests/table-bordercollapse/frame_hsides_rules_none_ref.html
new file mode 100644
index 0000000000..4574bac3f1
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_hsides_rules_none_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="hsides" and Rules="none"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="topLight bottomDark">
+ <caption><a name="void-none">Frame="hsides" and Rules="none"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_hsides_rules_rows.html b/layout/reftests/table-bordercollapse/frame_hsides_rules_rows.html
new file mode 100644
index 0000000000..cab19c8a3d
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_hsides_rules_rows.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="hsides" and Rules="rows"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="rows" frame="hsides">
+ <caption><a name="void-none">Frame="hsides" and Rules="rows"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_hsides_rules_rows_ref.html b/layout/reftests/table-bordercollapse/frame_hsides_rules_rows_ref.html
new file mode 100644
index 0000000000..ae027937c7
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_hsides_rules_rows_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="hsides" and Rules="rows"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="top bottom bc">
+ <caption><a name="void-none">Frame="hsides" and Rules="rows"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="border">
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr class="border">
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr class="border">
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_lhs_rules_all.html b/layout/reftests/table-bordercollapse/frame_lhs_rules_all.html
new file mode 100644
index 0000000000..16882ceb21
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_lhs_rules_all.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="lhs" and Rules="all"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="all" frame="lhs">
+ <caption><a name="void-none">Frame="lhs" and Rules="all"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_lhs_rules_all_ref.html b/layout/reftests/table-bordercollapse/frame_lhs_rules_all_ref.html
new file mode 100644
index 0000000000..d0b413e843
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_lhs_rules_all_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="lhs" and Rules="all"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+
+
+<table class="left bc">
+ <caption><a name="void-none">Frame="lhs" and Rules="all"</caption>
+<thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td class="border">Row 1, Cell 2</td>
+ <td class="border">Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="border">
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2" class="border">Row 2, Cell 2</td>
+ </tr>
+ <tr class="border">
+ <td class="border">Row 3, Cell 2</td>
+ <td rowspan="2" class="border">Row 3, Cell 3</td>
+ </tr>
+ <tr class="border">
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td class="border">Row 5, Cell 2</td>
+ <td class="border">Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_lhs_rules_cols.html b/layout/reftests/table-bordercollapse/frame_lhs_rules_cols.html
new file mode 100644
index 0000000000..acd4f40bef
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_lhs_rules_cols.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="lhs" and Rules="cols"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="cols" frame="lhs">
+ <caption><a name="void-none">Frame="lhs" and Rules="cols"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_lhs_rules_cols_ref.html b/layout/reftests/table-bordercollapse/frame_lhs_rules_cols_ref.html
new file mode 100644
index 0000000000..57b90e9fb6
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_lhs_rules_cols_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="lhs" and Rules="cols"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+
+
+<table class="left bc">
+ <caption><a name="void-none">Frame="lhs" and Rules="cols"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td class="border">Row 1, Cell 2</td>
+ <td class="border">Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2" class="border">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td class="border">Row 3, Cell 2</td>
+ <td rowspan="2" class="border">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td class="border">Row 5, Cell 2</td>
+ <td class="border">Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_lhs_rules_groups.html b/layout/reftests/table-bordercollapse/frame_lhs_rules_groups.html
new file mode 100644
index 0000000000..bf2332d31c
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_lhs_rules_groups.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="lhs" and Rules="groups"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="groups" frame="lhs">
+ <caption><a name="void-none">Frame="lhs" and Rules="groups"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_lhs_rules_groups_ref.html b/layout/reftests/table-bordercollapse/frame_lhs_rules_groups_ref.html
new file mode 100644
index 0000000000..e459ed3c32
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_lhs_rules_groups_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="lhs" and Rules="groups"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+
+
+<table class="left bc">
+ <caption><a name="void-none">Frame="lhs" and Rules="groups"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody class="border">
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_lhs_rules_none.html b/layout/reftests/table-bordercollapse/frame_lhs_rules_none.html
new file mode 100644
index 0000000000..1e5cd87389
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_lhs_rules_none.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="lhs" and Rules="none"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="none" frame="lhs">
+ <caption><a name="void-none">Frame="lhs" and Rules="none"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_lhs_rules_none_ref.html b/layout/reftests/table-bordercollapse/frame_lhs_rules_none_ref.html
new file mode 100644
index 0000000000..51aa94aaca
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_lhs_rules_none_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="lhs" and Rules="none"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+
+
+<table class="leftLight">
+ <caption><a name="void-none">Frame="lhs" and Rules="none"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_lhs_rules_rows.html b/layout/reftests/table-bordercollapse/frame_lhs_rules_rows.html
new file mode 100644
index 0000000000..23952eb462
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_lhs_rules_rows.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="lhs" and Rules="rows"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="rows" frame="lhs">
+ <caption><a name="void-none">Frame="lhs" and Rules="rows"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_lhs_rules_rows_ref.html b/layout/reftests/table-bordercollapse/frame_lhs_rules_rows_ref.html
new file mode 100644
index 0000000000..1c97ec0d08
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_lhs_rules_rows_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="lhs" and Rules="rows"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+
+
+<table class="left bc">
+ <caption><a name="void-none">Frame="lhs" and Rules="rows"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="border">
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr class="border">
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr class="border">
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_rhs_rules_all.html b/layout/reftests/table-bordercollapse/frame_rhs_rules_all.html
new file mode 100644
index 0000000000..60bb7b06ec
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_rhs_rules_all.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="rhs" and Rules="all"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="all" frame="rhs">
+ <caption><a name="void-none">Frame="rhs" and Rules="all"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_rhs_rules_all_ref.html b/layout/reftests/table-bordercollapse/frame_rhs_rules_all_ref.html
new file mode 100644
index 0000000000..0c7a72e35e
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_rhs_rules_all_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="rhs" and Rules="all"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="right bc">
+ <caption><a name="void-none">Frame="rhs" and Rules="all"</caption>
+<thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td class="border">Row 1, Cell 2</td>
+ <td class="border">Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="border">
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2" class="border">Row 2, Cell 2</td>
+ </tr>
+ <tr class="border">
+ <td class="border">Row 3, Cell 2</td>
+ <td rowspan="2" class="border">Row 3, Cell 3</td>
+ </tr>
+ <tr class="border">
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td class="border">Row 5, Cell 2</td>
+ <td class="border">Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_rhs_rules_cols.html b/layout/reftests/table-bordercollapse/frame_rhs_rules_cols.html
new file mode 100644
index 0000000000..3acef0a896
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_rhs_rules_cols.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="rhs" and Rules="cols"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="cols" frame="rhs">
+ <caption><a name="void-none">Frame="rhs" and Rules="cols"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_rhs_rules_cols_ref.html b/layout/reftests/table-bordercollapse/frame_rhs_rules_cols_ref.html
new file mode 100644
index 0000000000..6517cada6f
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_rhs_rules_cols_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="rhs" and Rules="cols"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="right bc">
+ <caption><a name="void-none">Frame="rhs" and Rules="cols"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td class="border">Row 1, Cell 2</td>
+ <td class="border">Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2" class="border">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td class="border">Row 3, Cell 2</td>
+ <td rowspan="2" class="border">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td class="border">Row 5, Cell 2</td>
+ <td class="border">Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_rhs_rules_groups.html b/layout/reftests/table-bordercollapse/frame_rhs_rules_groups.html
new file mode 100644
index 0000000000..629a981b8e
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_rhs_rules_groups.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="rhs" and Rules="groups"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="groups" frame="rhs">
+ <caption><a name="void-none">Frame="rhs" and Rules="groups"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_rhs_rules_groups_ref.html b/layout/reftests/table-bordercollapse/frame_rhs_rules_groups_ref.html
new file mode 100644
index 0000000000..8925cb1ee7
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_rhs_rules_groups_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="rhs" and Rules="groups"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="right bc">
+ <caption><a name="void-none">Frame="rhs" and Rules="groups"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody class="border">
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_rhs_rules_none.html b/layout/reftests/table-bordercollapse/frame_rhs_rules_none.html
new file mode 100644
index 0000000000..ad1508b52e
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_rhs_rules_none.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="rhs" and Rules="none"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="none" frame="rhs">
+ <caption><a name="void-none">Frame="rhs" and Rules="none"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_rhs_rules_none_ref.html b/layout/reftests/table-bordercollapse/frame_rhs_rules_none_ref.html
new file mode 100644
index 0000000000..fc9ffffc8c
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_rhs_rules_none_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="rhs" and Rules="none"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="rightDark">
+ <caption><a name="void-none">Frame="rhs" and Rules="none"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_rhs_rules_rows.html b/layout/reftests/table-bordercollapse/frame_rhs_rules_rows.html
new file mode 100644
index 0000000000..3bc8ccd122
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_rhs_rules_rows.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="rhs" and Rules="rows"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="rows" frame="rhs">
+ <caption><a name="void-none">Frame="rhs" and Rules="rows"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_rhs_rules_rows_ref.html b/layout/reftests/table-bordercollapse/frame_rhs_rules_rows_ref.html
new file mode 100644
index 0000000000..91563fc4c5
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_rhs_rules_rows_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="rhs" and Rules="rows"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="right bc">
+ <caption><a name="void-none">Frame="rhs" and Rules="rows"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="border">
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr class="border">
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr class="border">
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_void_rules_all.html b/layout/reftests/table-bordercollapse/frame_void_rules_all.html
new file mode 100644
index 0000000000..39ec914065
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_void_rules_all.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="void" and Rules="all"</title>
+<link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="all" frame="void">
+ <caption><a name="void-none">Frame="void" and Rules="all"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_void_rules_all_ref.html b/layout/reftests/table-bordercollapse/frame_void_rules_all_ref.html
new file mode 100644
index 0000000000..e96948e23c
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_void_rules_all_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="void" and Rules="all"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="bc">
+<caption><a name="void-none">Frame="void" and Rules="all"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td class="border">Row 1, Cell 2</td>
+ <td class="border">Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="border">
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2" class="border">Row 2, Cell 2</td>
+ </tr>
+ <tr class="border">
+ <td class="border">Row 3, Cell 2</td>
+ <td rowspan="2" class="border">Row 3, Cell 3</td>
+ </tr>
+ <tr class="border">
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td class="border">Row 5, Cell 2</td>
+ <td class="border">Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_void_rules_cols.html b/layout/reftests/table-bordercollapse/frame_void_rules_cols.html
new file mode 100644
index 0000000000..0ac120d004
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_void_rules_cols.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="void" and Rules="cols"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="cols" frame="void">
+ <caption><a name="void-none">Frame="void" and Rules="cols"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_void_rules_cols_ref.html b/layout/reftests/table-bordercollapse/frame_void_rules_cols_ref.html
new file mode 100644
index 0000000000..0420398ce3
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_void_rules_cols_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="void" and Rules="cols"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="bc">
+ <caption><a name="void-none">Frame="void" and Rules="cols"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td class="border">Row 1, Cell 2</td>
+ <td class="border">Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2" class="border">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td class="border">Row 3, Cell 2</td>
+ <td rowspan="2" class="border">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td class="border">Row 5, Cell 2</td>
+ <td class="border">Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_void_rules_groups.html b/layout/reftests/table-bordercollapse/frame_void_rules_groups.html
new file mode 100644
index 0000000000..f52679d271
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_void_rules_groups.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="void" and Rules="groups"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="groups" frame="void">
+ <caption><a name="void-none">Frame="void" and Rules="groups"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_void_rules_groups_ref.html b/layout/reftests/table-bordercollapse/frame_void_rules_groups_ref.html
new file mode 100644
index 0000000000..ed45be95b0
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_void_rules_groups_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="void" and Rules="groups"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="bc">
+ <caption><a name="void-none">Frame="void" and Rules="groups"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody class="border">
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_void_rules_none.html b/layout/reftests/table-bordercollapse/frame_void_rules_none.html
new file mode 100644
index 0000000000..bbc4c241d8
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_void_rules_none.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="void" and Rules="none"</title>
+<link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="none" frame="void">
+ <caption><a name="void-none">Frame="void" and Rules="none"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_void_rules_none_ref.html b/layout/reftests/table-bordercollapse/frame_void_rules_none_ref.html
new file mode 100644
index 0000000000..7a6f364abc
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_void_rules_none_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="void" and Rules="none"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table >
+ <caption><a name="void-none">Frame="void" and Rules="none"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_void_rules_rows.html b/layout/reftests/table-bordercollapse/frame_void_rules_rows.html
new file mode 100644
index 0000000000..58b924bd4b
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_void_rules_rows.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="void" and Rules="void"</title>
+<link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="rows" frame="void">
+ <caption><a name="void-none">Frame="void" and Rules="rows"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_void_rules_rows_ref.html b/layout/reftests/table-bordercollapse/frame_void_rules_rows_ref.html
new file mode 100644
index 0000000000..eb1ef28ab6
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_void_rules_rows_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="void" and Rules="rows"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="bc">
+ <caption><a name="void-none">Frame="void" and Rules="rows"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="border">
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr class="border">
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr class="border">
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_vsides_rules_all.html b/layout/reftests/table-bordercollapse/frame_vsides_rules_all.html
new file mode 100644
index 0000000000..fe691858a1
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_vsides_rules_all.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="vsides" and Rules="all"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="all" frame="vsides">
+ <caption><a name="void-none">Frame="vsides" and Rules="all"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_vsides_rules_all_ref.html b/layout/reftests/table-bordercollapse/frame_vsides_rules_all_ref.html
new file mode 100644
index 0000000000..d818bba3f3
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_vsides_rules_all_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="vsides" and Rules="all"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="left right bc">
+ <caption><a name="void-none">Frame="vsides" and Rules="all"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td class="border">Row 1, Cell 2</td>
+ <td class="border">Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="border">
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2" class="border">Row 2, Cell 2</td>
+ </tr>
+ <tr class="border">
+ <td class="border">Row 3, Cell 2</td>
+ <td rowspan="2" class="border">Row 3, Cell 3</td>
+ </tr>
+ <tr class="border">
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td class="border">Row 5, Cell 2</td>
+ <td class="border">Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_vsides_rules_cols.html b/layout/reftests/table-bordercollapse/frame_vsides_rules_cols.html
new file mode 100644
index 0000000000..8307493ccb
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_vsides_rules_cols.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="vsides" and Rules="cols"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="cols" frame="vsides">
+ <caption><a name="void-none">Frame="vsides" and Rules="cols"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_vsides_rules_cols_ref.html b/layout/reftests/table-bordercollapse/frame_vsides_rules_cols_ref.html
new file mode 100644
index 0000000000..b86badf00e
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_vsides_rules_cols_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="vsides" and Rules="cols"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="left right bc">
+ <caption><a name="void-none">Frame="vsides" and Rules="cols"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td class="border">Row 1, Cell 2</td>
+ <td class="border">Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2" class="border">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td class="border">Row 3, Cell 2</td>
+ <td rowspan="2" class="border">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td class="border">Row 5, Cell 2</td>
+ <td class="border">Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_vsides_rules_groups.html b/layout/reftests/table-bordercollapse/frame_vsides_rules_groups.html
new file mode 100644
index 0000000000..cf4823db41
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_vsides_rules_groups.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="vsides" and Rules="groups"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="groups" frame="vsides">
+ <caption><a name="void-none">Frame="vsides" and Rules="groups"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_vsides_rules_groups_ref.html b/layout/reftests/table-bordercollapse/frame_vsides_rules_groups_ref.html
new file mode 100644
index 0000000000..cb87996dee
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_vsides_rules_groups_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="vsides" and Rules="groups"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="left right bc">
+ <caption><a name="void-none">Frame="vsides" and Rules="groups"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody class="border">
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_vsides_rules_none.html b/layout/reftests/table-bordercollapse/frame_vsides_rules_none.html
new file mode 100644
index 0000000000..b845d83f9f
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_vsides_rules_none.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="vsides" and Rules="none"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="none" frame="vsides">
+ <caption><a name="void-none">Frame="vsides" and Rules="none"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_vsides_rules_none_ref.html b/layout/reftests/table-bordercollapse/frame_vsides_rules_none_ref.html
new file mode 100644
index 0000000000..1ac863d6ae
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_vsides_rules_none_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="vsides" and Rules="none"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="leftLight rightDark">
+ <caption><a name="void-none">Frame="vsides" and Rules="none"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_vsides_rules_rows.html b/layout/reftests/table-bordercollapse/frame_vsides_rules_rows.html
new file mode 100644
index 0000000000..c1fa0032f1
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_vsides_rules_rows.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en"><head>
+
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="vsides" and Rules="rows"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table rules="rows" frame="vsides">
+ <caption><a name="void-none">Frame="vsides" and Rules="rows"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr>
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr>
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/frame_vsides_rules_rows_ref.html b/layout/reftests/table-bordercollapse/frame_vsides_rules_rows_ref.html
new file mode 100644
index 0000000000..944f021a2d
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/frame_vsides_rules_rows_ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Frame="vsides" and Rules="rows"</title>
+ <link rel="stylesheet" type="text/css" href="bordercol.css" />
+</head>
+<body>
+<table class="left right bc">
+ <caption><a name="void-none">Frame="vsides" and Rules="rows"</caption>
+ <thead>
+ <tr>
+ <td>Row 1, Cell 1</td>
+ <td>Row 1, Cell 2</td>
+ <td>Row 1, Cell 3</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="border">
+ <td rowspan="2">Row 2, Cell 1</td>
+ <td colspan="2">Row 2, Cell 2</td>
+ </tr>
+ <tr class="border">
+ <td>Row 3, Cell 2</td>
+ <td rowspan="2">Row 3, Cell 3</td>
+ </tr>
+ <tr class="border">
+ <td colspan="2">Row 4, Cell 1</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td>Row 5, Cell 1</td>
+ <td>Row 5, Cell 2</td>
+ <td>Row 5, Cell 3</td>
+ </tr>
+ </tfoot>
+</table>
+
+
+</body>
+
+</html>
diff --git a/layout/reftests/table-bordercollapse/reftest.list b/layout/reftests/table-bordercollapse/reftest.list
new file mode 100644
index 0000000000..ab02997e57
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/reftest.list
@@ -0,0 +1,120 @@
+== bug1375518.html bug1375518-ref.html
+== bug1375518-2.html bug1375518-ref.html
+== bug1375518-3.html bug1375518-ref.html
+== bug1375518-4.html bug1375518-4-ref.html
+== bug1375518-5.html bug1375518-5-ref.html
+== bug1379306.html bug1379306-ref.html
+== bug1394226.html bug1394226-ref.html
+!= bug1394226.html bug1394226-notref.html
+== bug1405929.html bug1405929-ref.html
+== bug1405929-2.html bug1405929-2-ref.html
+== bug1421887.html bug1421887-ref.html
+== bc_dyn_cell1.html bc_dyn_cell1_ref.html
+== bc_dyn_cell2.html bc_dyn_cell2_ref.html
+== bc_dyn_cell3.html bc_dyn_cell3_ref.html
+== bc_dyn_cell4.html bc_dyn_cell4_ref.html
+== bc_dyn_cell5.html bc_dyn_cell5_ref.html
+== bc_dyn_row1.html bc_dyn_rg1_ref.html
+== bc_dyn_row2.html bc_dyn_rg2_ref.html
+== bc_dyn_row3.html bc_dyn_rg3_ref.html
+== bc_dyn_rg1.html bc_dyn_rg1_ref.html
+== bc_dyn_rg2.html bc_dyn_rg2_ref.html
+== bc_dyn_rg3.html bc_dyn_rg3_ref.html
+== bc_dyn_col1.html bc_dyn_cg1_ref.html
+== bc_dyn_col2.html bc_dyn_cg2_ref.html
+== bc_dyn_col3.html bc_dyn_cg3_ref.html
+== bc_dyn_cg1.html bc_dyn_cg1_ref.html
+== bc_dyn_cg2.html bc_dyn_cg2_ref.html
+== bc_dyn_cg3.html bc_dyn_cg3_ref.html
+== bc_dyn_table1.html bc_dyn_table1_ref.html
+== bc_dyn_table2.html bc_dyn_table2_ref.html
+== bc_dyn_table3.html bc_dyn_table3_ref.html
+== bc_borderoffset1.html bc_borderoffset1_ref.html
+== bc_borderoffset2.html bc_borderoffset2_ref.html
+== frame_above_rules_all.html frame_above_rules_all_ref.html
+== frame_above_rules_cols.html frame_above_rules_cols_ref.html
+== frame_above_rules_groups.html frame_above_rules_groups_ref.html
+fuzzy-if(appleSilicon,0-1,0-281) == frame_above_rules_none.html frame_above_rules_none_ref.html
+== frame_above_rules_rows.html frame_above_rules_rows_ref.html
+== frame_below_rules_all.html frame_below_rules_all_ref.html
+== frame_below_rules_cols.html frame_below_rules_cols_ref.html
+== frame_below_rules_groups.html frame_below_rules_groups_ref.html
+fuzzy-if(appleSilicon,0-1,0-281) == frame_below_rules_none.html frame_below_rules_none_ref.html
+== frame_below_rules_rows.html frame_below_rules_rows_ref.html
+== frame_border_rules_all.html frame_border_rules_all_ref.html
+== frame_border_rules_cols.html frame_border_rules_cols_ref.html
+== frame_border_rules_groups.html frame_border_rules_groups_ref.html
+fuzzy-if(appleSilicon,0-1,0-800) == frame_border_rules_none.html frame_border_rules_none_ref.html
+== frame_border_rules_rows.html frame_border_rules_rows_ref.html
+== frame_box_rules_all.html frame_box_rules_all_ref.html
+== frame_box_rules_cols.html frame_box_rules_cols_ref.html
+== frame_box_rules_groups.html frame_box_rules_groups_ref.html
+fuzzy-if(appleSilicon,0-1,0-800) == frame_box_rules_none.html frame_box_rules_none_ref.html
+== frame_box_rules_none-collapse.html frame_box_rules_none-collapse-ref.html
+== frame_box_rules_rows.html frame_box_rules_rows_ref.html
+== frame_hsides_rules_all.html frame_hsides_rules_all_ref.html
+== frame_hsides_rules_cols.html frame_hsides_rules_cols_ref.html
+== frame_hsides_rules_groups.html frame_hsides_rules_groups_ref.html
+fuzzy-if(appleSilicon,0-1,0-562) == frame_hsides_rules_none.html frame_hsides_rules_none_ref.html
+== frame_hsides_rules_rows.html frame_hsides_rules_rows_ref.html
+== frame_lhs_rules_all.html frame_lhs_rules_all_ref.html
+== frame_lhs_rules_cols.html frame_lhs_rules_cols_ref.html
+== frame_lhs_rules_groups.html frame_lhs_rules_groups_ref.html
+fuzzy-if(appleSilicon,0-1,0-118) == frame_lhs_rules_none.html frame_lhs_rules_none_ref.html
+== frame_lhs_rules_rows.html frame_lhs_rules_rows_ref.html
+== frame_rhs_rules_all.html frame_rhs_rules_all_ref.html
+== frame_rhs_rules_cols.html frame_rhs_rules_cols_ref.html
+== frame_rhs_rules_groups.html frame_rhs_rules_groups_ref.html
+fuzzy-if(appleSilicon,0-1,0-118) == frame_rhs_rules_none.html frame_rhs_rules_none_ref.html
+== frame_rhs_rules_rows.html frame_rhs_rules_rows_ref.html
+== frame_void_rules_all.html frame_void_rules_all_ref.html
+== frame_void_rules_cols.html frame_void_rules_cols_ref.html
+== frame_void_rules_groups.html frame_void_rules_groups_ref.html
+== frame_void_rules_none.html frame_void_rules_none_ref.html
+== frame_void_rules_rows.html frame_void_rules_rows_ref.html
+== frame_vsides_rules_all.html frame_vsides_rules_all_ref.html
+== frame_vsides_rules_cols.html frame_vsides_rules_cols_ref.html
+== frame_vsides_rules_groups.html frame_vsides_rules_groups_ref.html
+fuzzy-if(appleSilicon,0-1,0-236) == frame_vsides_rules_none.html frame_vsides_rules_none_ref.html
+== frame_vsides_rules_rows.html frame_vsides_rules_rows_ref.html
+== borderhandling-1.html borderhandling-ref.html
+== borderhandling-2.html borderhandling-ref.html
+== borderhandling-3.html borderhandling-ref.html
+== borderhandling-4.html borderhandling-ref.html
+== borderhandling-5.xhtml borderhandling-strict-ref.html
+== borderhandling-6.xhtml borderhandling-strict-ref.html
+== borderhandling-7.xhtml borderhandling-strict-ref.html
+== borderhandling-8.html borderhandling-strict-ref.html
+== borderhandling-frame-border.html borderhandling-frame-border-ref.html
+== borderhandling-rules-border-empty-quirks.html borderhandling-rules-border-empty-quirks-ref.html
+== borderhandling-rules-border-rules-quirks.html borderhandling-rules-border-rules-quirks-ref.html
+== borderhandling-rules-border-none-quirks.html borderhandling-rules-border-none-quirks-ref.html
+== borderhandling-rules-border-groups-quirks.html borderhandling-rules-border-groups-quirks-ref.html
+== borderhandling-rules-border-rows-quirks.html borderhandling-rules-border-rows-quirks-ref.html
+== borderhandling-rules-border-cols-quirks.html borderhandling-rules-border-cols-quirks-ref.html
+== borderhandling-rules-border-all-quirks.html borderhandling-rules-border-all-quirks-ref.html
+== borderhandling-rules-border-empty-strict.html borderhandling-rules-border-empty-strict-ref.html
+== borderhandling-rules-border-rules-strict.html borderhandling-rules-border-rules-strict-ref.html
+== borderhandling-rules-border-none-strict.html borderhandling-rules-border-none-strict-ref.html
+== borderhandling-rules-border-groups-strict.html borderhandling-rules-border-groups-strict-ref.html
+== borderhandling-rules-border-rows-strict.html borderhandling-rules-border-rows-strict-ref.html
+== borderhandling-rules-border-cols-strict.html borderhandling-rules-border-cols-strict-ref.html
+== borderhandling-rules-border-all-strict.html borderhandling-rules-border-all-strict-ref.html
+== bordercolor-1.html bordercolor-ref.html
+!= bordercolor-2.html bordercolor-ref.html
+== bordercolor-3.html bordercolor-3-ref.html
+== bordercolor-4.html bordercolor-4-ref.html
+== empty-toprow.html empty-toprow-ref.html
+== double_borders.html double_borders_ref.html
+== border-collapse-rtl.html border-collapse-rtl-ref.html
+# Fuzzy because border-collapsed borders are not antialiased, since each segment is painted separately.
+# So get 40 pixels of fuzz, 20 at each beveled corner (because the border width
+# is 20px).
+fuzzy(0-255,0-40) fuzzy-if(!useDrawSnapshot,51-52,40-526) fuzzy-if(appleSilicon,0-95,0-9760) fails-if(geckoview) == border-style-outset-becomes-groove.html border-style-outset-becomes-groove-ref.html
+# Fuzzy because border-collapsed borders are not antialiased, since each segment is painted separately.
+# So get 40 pixels of fuzz, 20 at each beveled corner (because the border width
+# is 20px).
+fuzzy(0-255,0-40) fuzzy-if(!useDrawSnapshot,51-52,40-526) fuzzy-if(appleSilicon,0-95,0-9760) fails-if(geckoview) == border-style-inset-becomes-ridge.html border-style-inset-becomes-ridge-ref.html
+fuzzy(0-2,0-11000) == 1324524.html 1324524-ref.html
+== 1384602-1a.html 1384602-1-ref.html
+== 1384602-1b.html 1384602-1-ref.html