summaryrefslogtreecommitdiffstats
path: root/layout/reftests/table-bordercollapse
diff options
context:
space:
mode:
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/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-orig.css23
-rw-r--r--layout/reftests/table-bordercollapse/bordercol.css24
-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/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-stylo.list107
-rw-r--r--layout/reftests/table-bordercollapse/reftest.list107
197 files changed, 8363 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 000000000..f8297b13e
--- /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 000000000..7897ffa1b
--- /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/349655-ref.html b/layout/reftests/table-bordercollapse/349655-ref.html
new file mode 100644
index 000000000..9fd31c444
--- /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 000000000..1fe61dd4b
--- /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 000000000..3ebe8942f
--- /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 000000000..0759bdf7e
--- /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 000000000..e865326f8
--- /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 000000000..bbb0698eb
--- /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 000000000..2dcddb94c
--- /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 000000000..a7dd2fca5
--- /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 000000000..083f2ae89
--- /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 000000000..30240313a
--- /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 000000000..f9aa04a9f
--- /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 000000000..8ff326676
--- /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 000000000..7fd2945fc
--- /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 000000000..2b208eaad
--- /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 000000000..305c228d6
--- /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 000000000..b4c349823
--- /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 000000000..6e640b37c
--- /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 000000000..7a5f1852e
--- /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 000000000..eb7cb53b2
--- /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 000000000..240ba0187
--- /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 000000000..d8b7acf51
--- /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 000000000..6facc281e
--- /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 000000000..d4a6238dd
--- /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 000000000..8dea12929
--- /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 000000000..254271ae6
--- /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 000000000..e92d487d3
--- /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 000000000..454d78bf3
--- /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 000000000..bfa5447b7
--- /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 000000000..c3f761358
--- /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 000000000..9e0778c33
--- /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 000000000..00449ed44
--- /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 000000000..c575a7e02
--- /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 000000000..01f4e82c2
--- /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 000000000..65a9cd523
--- /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 000000000..c03f1780f
--- /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 000000000..0fcda0496
--- /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 000000000..35d95ce6f
--- /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 000000000..bceb54284
--- /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 000000000..c9b17fd63
--- /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 000000000..a426552a7
--- /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 000000000..8c57dbc12
--- /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 000000000..55d171d4b
--- /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 000000000..66db649e9
--- /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 000000000..b011bd22f
--- /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 000000000..ddb0f71c8
--- /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 000000000..a7245459e
--- /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-orig.css b/layout/reftests/table-bordercollapse/bordercol-orig.css
new file mode 100644
index 000000000..65dc2803d
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bordercol-orig.css
@@ -0,0 +1,23 @@
+
+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 #505050}
+table.bottomDark {border-bottom: 1px solid black}
+table.leftLight {border-left: 1px solid #B2B2B2}
+table.right {border-right: 1px solid #505050}
+table.rightDark {border-right: 1px solid black}
+table.top {border-top: 1px solid #505050}
+table.left {border-left: 1px solid #505050}
+table.bc {border-collapse:collapse}
+tbody.border{border-top: 1px solid #505050; border-bottom: 1px solid #505050; }
+tr.border{border-top: 1px solid #505050; border-bottom: 1px solid #505050; }
+td.border{border-left:1px solid #505050;}
+
diff --git a/layout/reftests/table-bordercollapse/bordercol.css b/layout/reftests/table-bordercollapse/bordercol.css
new file mode 100644
index 000000000..19168e0d5
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/bordercol.css
@@ -0,0 +1,24 @@
+
+table {
+ margin-bottom: 0.5in;
+ }
+caption {
+ font-weight: bold;
+ font-style: italic;
+ }
+td {background-color:LightCyan }
+
+table.topLight {border-top: 1px solid #AFAFAF}
+table.bottom {border-bottom: 1px solid black}
+table.bottomDark {border-bottom: 1px solid #444444}
+table.leftLight {border-left: 1px solid #AFAFAF}
+table.right {border-right: 1px solid black}
+table.rightDark {border-right: 1px solid #444444}
+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 000000000..587b514dd
--- /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 000000000..634040a01
--- /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 000000000..145b1a05c
--- /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 000000000..be46dd0cc
--- /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 000000000..26000fef2
--- /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 000000000..cfd9b78e3
--- /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 000000000..3dd1f6120
--- /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 000000000..ee1f79fc9
--- /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 000000000..df14e1e82
--- /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 000000000..4bd2ee8c0
--- /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 000000000..c3bea8194
--- /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 000000000..6190e3e69
--- /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 000000000..b3d0a6cf6
--- /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 000000000..3adaf3752
--- /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 000000000..9db3a3fb9
--- /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 000000000..ee488f983
--- /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 000000000..bd0b8a23c
--- /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 000000000..c3bf72492
--- /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 000000000..63d2ddb58
--- /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 000000000..ada9045c4
--- /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 000000000..4e339a625
--- /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 000000000..01af55802
--- /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 000000000..5cf82c073
--- /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 000000000..349eb0d76
--- /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 000000000..e0fedb031
--- /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 000000000..198018dda
--- /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 000000000..757dec098
--- /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 000000000..b564d5fcf
--- /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 000000000..9c32a6697
--- /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 000000000..55e7443c6
--- /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 000000000..553cda44d
--- /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 000000000..1af52c7c2
--- /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 000000000..c729ace87
--- /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 000000000..96393bc2f
--- /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 000000000..cf5af7f86
--- /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 000000000..e35724e0f
--- /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 000000000..903491418
--- /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 000000000..535c51ec6
--- /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 000000000..79d51c4cc
--- /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 000000000..526bbe4b8
--- /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 000000000..030f79e2e
--- /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 000000000..3e1dc1579
--- /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 000000000..233ba687a
--- /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 000000000..0d0c073ed
--- /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 000000000..66083fa27
--- /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 000000000..4cb164113
--- /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 000000000..7b3d30c9a
--- /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 000000000..ef5c88143
--- /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 000000000..a472e0151
--- /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/double_borders.html b/layout/reftests/table-bordercollapse/double_borders.html
new file mode 100644
index 000000000..25c4e87f2
--- /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 000000000..a323fdaa0
--- /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 000000000..429dea366
--- /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 000000000..084389131
--- /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 000000000..51d538ba7
--- /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 000000000..c37074296
--- /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 000000000..f8a7ce8a3
--- /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 000000000..2bfe69f58
--- /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 000000000..e04d35b5c
--- /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 000000000..0fc138df0
--- /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 000000000..e7f70dc9a
--- /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 000000000..4ab3a0aa0
--- /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 000000000..c5c028392
--- /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 000000000..932bb1e47
--- /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 000000000..b9a502ccb
--- /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 000000000..468d73505
--- /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 000000000..deae5cc6f
--- /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 000000000..a930f09a0
--- /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 000000000..1870663b5
--- /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 000000000..811d115a0
--- /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 000000000..ecd59c96b
--- /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 000000000..09c462b95
--- /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 000000000..134469be3
--- /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 000000000..1b39a6148
--- /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 000000000..27542f8f9
--- /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 000000000..0e79c2455
--- /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 000000000..34fb8580e
--- /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 000000000..9c7dbceea
--- /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 000000000..31115ab2f
--- /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 000000000..58c477c08
--- /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 000000000..3910d49ce
--- /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 000000000..7e73bcf0d
--- /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 000000000..2bb47be2f
--- /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 000000000..13aaddedc
--- /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 000000000..78fafc87e
--- /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 000000000..f83ea707a
--- /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 000000000..d9a4bae3d
--- /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 000000000..8fb8d5d14
--- /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 000000000..4edcc7c46
--- /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 000000000..bea73c78a
--- /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 000000000..35704abda
--- /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 000000000..ff31ca3e2
--- /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 000000000..ac49cc23b
--- /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 000000000..6d7cd5b13
--- /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 000000000..f23c43ce0
--- /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 000000000..1be7bfd99
--- /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 000000000..b8dd99e85
--- /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 000000000..7a14d6e93
--- /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 000000000..4e59a4490
--- /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 000000000..2d44f31d0
--- /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 000000000..7f6d1548f
--- /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 000000000..e72aade1f
--- /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 000000000..002ea5319
--- /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 000000000..4574bac3f
--- /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 000000000..cab19c8a3
--- /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 000000000..ae027937c
--- /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 000000000..16882ceb2
--- /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 000000000..d0b413e84
--- /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 000000000..acd4f40be
--- /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 000000000..57b90e9fb
--- /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 000000000..bf2332d31
--- /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 000000000..e459ed3c3
--- /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 000000000..1e5cd8738
--- /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 000000000..51aa94aac
--- /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 000000000..23952eb46
--- /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 000000000..1c97ec0d0
--- /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 000000000..60bb7b06e
--- /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 000000000..0c7a72e35
--- /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 000000000..3acef0a89
--- /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 000000000..6517cada6
--- /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 000000000..629a981b8
--- /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 000000000..8925cb1ee
--- /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 000000000..ad1508b52
--- /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 000000000..fc9ffffc8
--- /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 000000000..3bc8ccd12
--- /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 000000000..91563fc4c
--- /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 000000000..39ec91406
--- /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 000000000..e96948e23
--- /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 000000000..0ac120d00
--- /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 000000000..0420398ce
--- /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 000000000..f52679d27
--- /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 000000000..ed45be95b
--- /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 000000000..bbc4c241d
--- /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 000000000..7a6f364ab
--- /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 000000000..58b924bd4
--- /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 000000000..eb1ef28ab
--- /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 000000000..fe691858a
--- /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 000000000..d818bba3f
--- /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 000000000..8307493cc
--- /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 000000000..b86badf00
--- /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 000000000..cf4823db4
--- /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 000000000..cb87996de
--- /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 000000000..b845d83f9
--- /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 000000000..1ac863d6a
--- /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 000000000..c1fa0032f
--- /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 000000000..944f021a2
--- /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-stylo.list b/layout/reftests/table-bordercollapse/reftest-stylo.list
new file mode 100644
index 000000000..2821d7e2e
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/reftest-stylo.list
@@ -0,0 +1,107 @@
+# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
+== bc_dyn_cell1.html bc_dyn_cell1.html
+== bc_dyn_cell2.html bc_dyn_cell2.html
+== bc_dyn_cell3.html bc_dyn_cell3.html
+== bc_dyn_cell4.html bc_dyn_cell4.html
+== bc_dyn_cell5.html bc_dyn_cell5.html
+== bc_dyn_row1.html bc_dyn_row1.html
+== bc_dyn_row2.html bc_dyn_row2.html
+== bc_dyn_row3.html bc_dyn_row3.html
+== bc_dyn_rg1.html bc_dyn_rg1.html
+== bc_dyn_rg2.html bc_dyn_rg2.html
+== bc_dyn_rg3.html bc_dyn_rg3.html
+== bc_dyn_col1.html bc_dyn_col1.html
+== bc_dyn_col2.html bc_dyn_col2.html
+== bc_dyn_col3.html bc_dyn_col3.html
+== bc_dyn_cg1.html bc_dyn_cg1.html
+== bc_dyn_cg2.html bc_dyn_cg2.html
+== bc_dyn_cg3.html bc_dyn_cg3.html
+== bc_dyn_table1.html bc_dyn_table1.html
+== bc_dyn_table2.html bc_dyn_table2.html
+== bc_dyn_table3.html bc_dyn_table3.html
+== bc_borderoffset1.html bc_borderoffset1.html
+== bc_borderoffset2.html bc_borderoffset2.html
+== frame_above_rules_all.html frame_above_rules_all.html
+== frame_above_rules_cols.html frame_above_rules_cols.html
+== frame_above_rules_groups.html frame_above_rules_groups.html
+== frame_above_rules_none.html frame_above_rules_none.html
+== frame_above_rules_rows.html frame_above_rules_rows.html
+== frame_below_rules_all.html frame_below_rules_all.html
+== frame_below_rules_cols.html frame_below_rules_cols.html
+== frame_below_rules_groups.html frame_below_rules_groups.html
+== frame_below_rules_none.html frame_below_rules_none.html
+== frame_below_rules_rows.html frame_below_rules_rows.html
+== frame_border_rules_all.html frame_border_rules_all.html
+== frame_border_rules_cols.html frame_border_rules_cols.html
+== frame_border_rules_groups.html frame_border_rules_groups.html
+== frame_border_rules_none.html frame_border_rules_none.html
+== frame_border_rules_rows.html frame_border_rules_rows.html
+== frame_box_rules_all.html frame_box_rules_all.html
+== frame_box_rules_cols.html frame_box_rules_cols.html
+== frame_box_rules_groups.html frame_box_rules_groups.html
+== frame_box_rules_none.html frame_box_rules_none.html
+== frame_box_rules_none-collapse.html frame_box_rules_none-collapse.html
+== frame_box_rules_rows.html frame_box_rules_rows.html
+== frame_hsides_rules_all.html frame_hsides_rules_all.html
+== frame_hsides_rules_cols.html frame_hsides_rules_cols.html
+== frame_hsides_rules_groups.html frame_hsides_rules_groups.html
+== frame_hsides_rules_none.html frame_hsides_rules_none.html
+skip == frame_hsides_rules_rows.html frame_hsides_rules_rows.html
+== frame_lhs_rules_all.html frame_lhs_rules_all.html
+== frame_lhs_rules_cols.html frame_lhs_rules_cols.html
+== frame_lhs_rules_groups.html frame_lhs_rules_groups.html
+== frame_lhs_rules_none.html frame_lhs_rules_none.html
+== frame_lhs_rules_rows.html frame_lhs_rules_rows.html
+== frame_rhs_rules_all.html frame_rhs_rules_all.html
+== frame_rhs_rules_cols.html frame_rhs_rules_cols.html
+== frame_rhs_rules_groups.html frame_rhs_rules_groups.html
+== frame_rhs_rules_none.html frame_rhs_rules_none.html
+== frame_rhs_rules_rows.html frame_rhs_rules_rows.html
+== frame_void_rules_all.html frame_void_rules_all.html
+== frame_void_rules_cols.html frame_void_rules_cols.html
+== frame_void_rules_groups.html frame_void_rules_groups.html
+== frame_void_rules_none.html frame_void_rules_none.html
+== frame_void_rules_rows.html frame_void_rules_rows.html
+== frame_vsides_rules_all.html frame_vsides_rules_all.html
+== frame_vsides_rules_cols.html frame_vsides_rules_cols.html
+== frame_vsides_rules_groups.html frame_vsides_rules_groups.html
+== frame_vsides_rules_none.html frame_vsides_rules_none.html
+== frame_vsides_rules_rows.html frame_vsides_rules_rows.html
+== borderhandling-1.html borderhandling-1.html
+== borderhandling-2.html borderhandling-2.html
+== borderhandling-3.html borderhandling-3.html
+== borderhandling-4.html borderhandling-4.html
+== borderhandling-5.xhtml borderhandling-5.xhtml
+== borderhandling-6.xhtml borderhandling-6.xhtml
+== borderhandling-7.xhtml borderhandling-7.xhtml
+== borderhandling-8.html borderhandling-8.html
+== borderhandling-frame-border.html borderhandling-frame-border.html
+== borderhandling-rules-border-empty-quirks.html borderhandling-rules-border-empty-quirks.html
+== borderhandling-rules-border-rules-quirks.html borderhandling-rules-border-rules-quirks.html
+== borderhandling-rules-border-none-quirks.html borderhandling-rules-border-none-quirks.html
+== borderhandling-rules-border-groups-quirks.html borderhandling-rules-border-groups-quirks.html
+== borderhandling-rules-border-rows-quirks.html borderhandling-rules-border-rows-quirks.html
+skip == borderhandling-rules-border-cols-quirks.html borderhandling-rules-border-cols-quirks.html
+== borderhandling-rules-border-all-quirks.html borderhandling-rules-border-all-quirks.html
+== borderhandling-rules-border-empty-strict.html borderhandling-rules-border-empty-strict.html
+== borderhandling-rules-border-rules-strict.html borderhandling-rules-border-rules-strict.html
+== borderhandling-rules-border-none-strict.html borderhandling-rules-border-none-strict.html
+== borderhandling-rules-border-groups-strict.html borderhandling-rules-border-groups-strict.html
+== borderhandling-rules-border-rows-strict.html borderhandling-rules-border-rows-strict.html
+== borderhandling-rules-border-cols-strict.html borderhandling-rules-border-cols-strict.html
+== borderhandling-rules-border-all-strict.html borderhandling-rules-border-all-strict.html
+== bordercolor-1.html bordercolor-1.html
+== bordercolor-2.html bordercolor-2.html
+== bordercolor-3.html bordercolor-3.html
+== bordercolor-4.html bordercolor-4.html
+== empty-toprow.html empty-toprow.html
+== double_borders.html double_borders.html
+== border-collapse-rtl.html border-collapse-rtl.html
+# Fuzzy because for some reason the corner beveling is antialiased differently.
+# So get 40 pixels of fuzz, 20 at each beveled corner (because the border width
+# is 20px).
+== border-style-outset-becomes-groove.html border-style-outset-becomes-groove.html
+# Fuzzy because for some reason the corner beveling is antialiased differently.
+# So get 40 pixels of fuzz, 20 at each beveled corner (because the border width
+# is 20px).
+== border-style-inset-becomes-ridge.html border-style-inset-becomes-ridge.html
diff --git a/layout/reftests/table-bordercollapse/reftest.list b/layout/reftests/table-bordercollapse/reftest.list
new file mode 100644
index 000000000..8356dc54b
--- /dev/null
+++ b/layout/reftests/table-bordercollapse/reftest.list
@@ -0,0 +1,107 @@
+== 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
+== 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
+== 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
+== 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
+== 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
+== 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
+== 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
+== 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
+== 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 for some reason the corner beveling is antialiased differently.
+# So get 40 pixels of fuzz, 20 at each beveled corner (because the border width
+# is 20px).
+fuzzy(255,40) == border-style-outset-becomes-groove.html border-style-outset-becomes-groove-ref.html
+# Fuzzy because for some reason the corner beveling is antialiased differently.
+# So get 40 pixels of fuzz, 20 at each beveled corner (because the border width
+# is 20px).
+fuzzy(255,40) == border-style-inset-becomes-ridge.html border-style-inset-becomes-ridge-ref.html
+fuzzy(2,8301) == 1324524.html 1324524-ref.html