Display table header groups at the top of each page

FF, IE and Edge all repeat a table header group at the top of each printed page.

This area is underspecified but after some discussion in the bug we agreed to
repeat the header group if it has break-inside:avoid. We make this the default
style for theads when printing.

BUG=24826

Review-Url: https://codereview.chromium.org/2021703002
Cr-Commit-Position: refs/heads/master@{#397915}
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index b46fb8f..e127aa9 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1133,6 +1133,9 @@
 
 crbug.com/571710 http/tests/inspector/search/source-frame-search.html [ Timeout Pass ]
 
+crbug.com/24826 [ Mac Win ] printing/thead-repeats-at-top-of-each-page.html [ NeedsRebaseline ]
+crbug.com/24826 [ Mac Win ] virtual/threaded/printing/thead-repeats-at-top-of-each-page.html [ NeedsRebaseline ]
+
 crbug.com/614063 [ Win10 ] svg/custom/shape-rendering.svg [ Failure ]
 crbug.com/614063 [ Win10 ] svg/custom/use-referencing-nonexisting-symbol.svg [ Failure ]
 
diff --git a/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.html b/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.html
new file mode 100644
index 0000000..625cbd1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<style>
+table {
+    border-collapse: collapse;
+}
+td, th {
+    background-color: #ddd;
+    border: 1px solid black;
+}
+tr {
+    break-inside: avoid;
+}
+.header {
+    font-weight: bold;
+    text-align: -internal-center
+}
+</style>
+<p>crbug.com/24826: A table header group repeats on each page and forces a strut on the rows to achieve it, even when the rows themselves do not force a strut with break-inside:avoid.</p>
+<div style="-webkit-columns:3; line-height: 20px; column-fill: auto; height:190px; background-color: yellow;">
+    <table>
+        <tr><td class="header">Col 1</td><td class="header">Col 2</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td class="header">Col 1</td><td class="header">Col 2</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td class="header">Col 1</td><td class="header">Col 2</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        </tbody>
+    </table>
+</div>
+
diff --git a/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead-break-inside-on-thead-only.html b/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead-break-inside-on-thead-only.html
new file mode 100644
index 0000000..534858a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead-break-inside-on-thead-only.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<style>
+table {
+    border-collapse: collapse;
+}
+td, th {
+    background-color: #ddd;
+    border: 1px solid black;
+}
+thead {
+    break-inside: avoid;
+}
+</style>
+<p>crbug.com/24826: A table header group repeats on each page and forces a strut on the rows to achieve it, even when the rows themselves do not force a strut with break-inside:avoid.</p>
+<div style="-webkit-columns:3; line-height: 20px; column-fill: auto; height:190px; background-color: yellow;">
+    <table>
+        <thead>
+            <tr>
+                <th>Col 1</th>
+                <th>Col 2</th>
+            </tr>
+        </thead>
+        <tbody>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        </tbody>
+    </table>
+</div>
+
diff --git a/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead-expected.html b/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead-expected.html
new file mode 100644
index 0000000..079f35d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead-expected.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<style>
+table {
+    border-collapse: collapse;
+}
+td, th {
+    background-color: #ddd;
+    border: 1px solid black;
+}
+tr {
+    break-inside: avoid;
+}
+.header {
+    font-weight: bold;
+    text-align: -internal-center
+}
+</style>
+<p>crbug.com/24826: A table header group repeats on each page.</p>
+<div style="-webkit-columns:3; line-height: 20px; column-fill: auto; height:190px; background-color: yellow;">
+    <table>
+        <tr><td class="header">Col 1</td><td class="header">Col 2</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td class="header">Col 1</td><td class="header">Col 2</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td class="header">Col 1</td><td class="header">Col 2</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        </tbody>
+    </table>
+</div>
+
diff --git a/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead-starts-middle-of-page-expected.html b/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead-starts-middle-of-page-expected.html
new file mode 100644
index 0000000..6639c13
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead-starts-middle-of-page-expected.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<style>
+table {
+    border-collapse: collapse;
+}
+td, th {
+    background-color: #ddd;
+    border: 1px solid black;
+}
+tr {
+    break-inside: avoid;
+}
+.header {
+    font-weight: bold;
+    text-align: -internal-center
+}
+</style>
+<p>crbug.com/24826: A table header group repeats on each page, even when the first one starts in the middle of the first page.</p>
+<div style="-webkit-columns:3; line-height: 20px; column-fill: auto; height:190px; background-color: yellow;">
+    <br>
+    <br>
+    <br>
+    <table>
+        <tr><td class="header">Col 1</td><td class="header">Col 2</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td class="header">Col 1</td><td class="header">Col 2</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td class="header">Col 1</td><td class="header">Col 2</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        </tbody>
+    </table>
+</div>
+
diff --git a/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead-starts-middle-of-page.html b/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead-starts-middle-of-page.html
new file mode 100644
index 0000000..41cc641
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead-starts-middle-of-page.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<style>
+table {
+    border-collapse: collapse;
+}
+td, th {
+    background-color: #ddd;
+    border: 1px solid black;
+}
+thead, tr {
+    break-inside: avoid;
+}
+</style>
+<p>crbug.com/24826: A table header group repeats on each page, even when the first one starts in the middle of the first page.</p>
+<div style="-webkit-columns:3; line-height: 20px; column-fill: auto; height:190px; background-color: yellow;">
+    <br>
+    <br>
+    <br>
+    <table>
+        <thead>
+            <tr>
+                <th>Col 1</th>
+                <th>Col 2</th>
+            </tr>
+        </thead>
+        <tbody>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        </tbody>
+    </table>
+</div>
+
diff --git a/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead.html b/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead.html
new file mode 100644
index 0000000..fd02654
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<style>
+table {
+    border-collapse: collapse;
+}
+td, th {
+    background-color: #ddd;
+    border: 1px solid black;
+}
+thead, tr {
+    break-inside: avoid;
+}
+</style>
+<p>crbug.com/24826: A table header group repeats on each page.</p>
+<div style="-webkit-columns:3; line-height: 20px; column-fill: auto; height:190px; background-color: yellow;">
+    <table>
+        <thead>
+            <tr>
+                <th>Col 1</th>
+                <th>Col 2</th>
+            </tr>
+        </thead>
+        <tbody>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        </tbody>
+    </table>
+</div>
+
diff --git a/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-self-painting-thead-break-inside-on-thead-only-expected.html b/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-self-painting-thead-break-inside-on-thead-only-expected.html
new file mode 100644
index 0000000..ac33fd4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-self-painting-thead-break-inside-on-thead-only-expected.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<style>
+table {
+    border-collapse: collapse;
+}
+td, th {
+    background-color: #ddd;
+    border: 1px solid black;
+}
+thead {
+    position: absolute;
+}
+</style>
+<p>crbug.com/24826: A self-painting table header group does not repeat on each page, even with break-inside:avoid specified.</p>
+<div style="-webkit-columns:3; line-height: 20px; column-fill: auto; height:190px; background-color: yellow;">
+    <table>
+        <thead>
+            <tr>
+                <th>Col 1</th>
+                <th>Col 2</th>
+            </tr>
+        </thead>
+        <tbody>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        </tbody>
+    </table>
+</div>
+
diff --git a/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-self-painting-thead-break-inside-on-thead-only.html b/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-self-painting-thead-break-inside-on-thead-only.html
new file mode 100644
index 0000000..3211991
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/single-line-cells-self-painting-thead-break-inside-on-thead-only.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<style>
+table {
+    border-collapse: collapse;
+}
+td, th {
+    background-color: #ddd;
+    border: 1px solid black;
+}
+thead {
+    break-inside: avoid;
+    position: absolute;
+}
+</style>
+<p>crbug.com/24826: A self-painting table header group does not repeat on each page, even with break-inside:avoid specified.</p>
+<div style="-webkit-columns:3; line-height: 20px; column-fill: auto; height:190px; background-color: yellow;">
+    <table>
+        <thead>
+            <tr>
+                <th>Col 1</th>
+                <th>Col 2</th>
+            </tr>
+        </thead>
+        <tbody>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        <tr><td>Te</td><td>xt</td></tr>
+        </tbody>
+    </table>
+</div>
+
diff --git a/third_party/WebKit/LayoutTests/platform/linux/printing/thead-repeats-at-top-of-each-page-expected.png b/third_party/WebKit/LayoutTests/platform/linux/printing/thead-repeats-at-top-of-each-page-expected.png
new file mode 100644
index 0000000..c67b75a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/printing/thead-repeats-at-top-of-each-page-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/printing/thead-repeats-at-top-of-each-page-expected.txt b/third_party/WebKit/LayoutTests/printing/thead-repeats-at-top-of-each-page-expected.txt
new file mode 100644
index 0000000..d6de75899
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/printing/thead-repeats-at-top-of-each-page-expected.txt
@@ -0,0 +1,368 @@
+layer at (0,0) size 1046x799 scrollHeight 1548
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x1548 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x1548
+    LayoutBlockFlow {BODY} at (8,8) size 1030x1532
+      LayoutTable {TABLE} at (0,0) size 449x1532
+        LayoutTableSection {THEAD} at (0,0) size 449x44
+          LayoutTableRow {TR} at (0,2) size 449x40
+            LayoutTableCell {TH} at (2,2) size 147x40 [r=0 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 145x37
+                text run at (1,1) width 145: "Column 1"
+            LayoutTableCell {TH} at (151,2) size 147x40 [r=0 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 145x37
+                text run at (1,1) width 145: "Column 2"
+            LayoutTableCell {TH} at (300,2) size 147x40 [r=0 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 145x37
+                text run at (1,1) width 145: "Column 3"
+        LayoutTableSection {TBODY} at (0,44) size 449x1488
+          LayoutTableRow {TR} at (0,0) size 449x39
+            LayoutTableCell {TD} at (2,0) size 147x39 [r=0 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "1-1"
+            LayoutTableCell {TD} at (151,0) size 147x39 [r=0 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "2-1"
+            LayoutTableCell {TD} at (300,0) size 147x39 [r=0 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "3-1"
+          LayoutTableRow {TR} at (0,41) size 449x39
+            LayoutTableCell {TD} at (2,41) size 147x39 [r=1 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "1-2"
+            LayoutTableCell {TD} at (151,41) size 147x39 [r=1 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "2-2"
+            LayoutTableCell {TD} at (300,41) size 147x39 [r=1 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "3-2"
+          LayoutTableRow {TR} at (0,82) size 449x39
+            LayoutTableCell {TD} at (2,82) size 147x39 [r=2 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "1-3"
+            LayoutTableCell {TD} at (151,82) size 147x39 [r=2 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "2-3"
+            LayoutTableCell {TD} at (300,82) size 147x39 [r=2 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "3-3"
+          LayoutTableRow {TR} at (0,123) size 449x39
+            LayoutTableCell {TD} at (2,123) size 147x39 [r=3 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "1-4"
+            LayoutTableCell {TD} at (151,123) size 147x39 [r=3 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "2-4"
+            LayoutTableCell {TD} at (300,123) size 147x39 [r=3 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "3-4"
+          LayoutTableRow {TR} at (0,164) size 449x39
+            LayoutTableCell {TD} at (2,164) size 147x39 [r=4 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "1-5"
+            LayoutTableCell {TD} at (151,164) size 147x39 [r=4 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "2-5"
+            LayoutTableCell {TD} at (300,164) size 147x39 [r=4 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "3-5"
+          LayoutTableRow {TR} at (0,205) size 449x39
+            LayoutTableCell {TD} at (2,205) size 147x39 [r=5 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "1-6"
+            LayoutTableCell {TD} at (151,205) size 147x39 [r=5 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "2-6"
+            LayoutTableCell {TD} at (300,205) size 147x39 [r=5 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "3-6"
+          LayoutTableRow {TR} at (0,246) size 449x39
+            LayoutTableCell {TD} at (2,246) size 147x39 [r=6 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "1-7"
+            LayoutTableCell {TD} at (151,246) size 147x39 [r=6 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "2-7"
+            LayoutTableCell {TD} at (300,246) size 147x39 [r=6 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "3-7"
+          LayoutTableRow {TR} at (0,287) size 449x39
+            LayoutTableCell {TD} at (2,287) size 147x39 [r=7 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "1-8"
+            LayoutTableCell {TD} at (151,287) size 147x39 [r=7 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "2-8"
+            LayoutTableCell {TD} at (300,287) size 147x39 [r=7 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "3-8"
+          LayoutTableRow {TR} at (0,328) size 449x39
+            LayoutTableCell {TD} at (2,328) size 147x39 [r=8 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "1-9"
+            LayoutTableCell {TD} at (151,328) size 147x39 [r=8 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "2-9"
+            LayoutTableCell {TD} at (300,328) size 147x39 [r=8 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 47x36
+                text run at (1,1) width 47: "3-9"
+          LayoutTableRow {TR} at (0,369) size 449x39
+            LayoutTableCell {TD} at (2,369) size 147x39 [r=9 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-10"
+            LayoutTableCell {TD} at (151,369) size 147x39 [r=9 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-10"
+            LayoutTableCell {TD} at (300,369) size 147x39 [r=9 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-10"
+          LayoutTableRow {TR} at (0,410) size 449x39
+            LayoutTableCell {TD} at (2,410) size 147x39 [r=10 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 63x36
+                text run at (1,1) width 63: "1-11"
+            LayoutTableCell {TD} at (151,410) size 147x39 [r=10 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 63x36
+                text run at (1,1) width 63: "2-11"
+            LayoutTableCell {TD} at (300,410) size 147x39 [r=10 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 63x36
+                text run at (1,1) width 63: "3-11"
+          LayoutTableRow {TR} at (0,451) size 449x39
+            LayoutTableCell {TD} at (2,451) size 147x39 [r=11 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-12"
+            LayoutTableCell {TD} at (151,451) size 147x39 [r=11 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-12"
+            LayoutTableCell {TD} at (300,451) size 147x39 [r=11 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-12"
+          LayoutTableRow {TR} at (0,492) size 449x39
+            LayoutTableCell {TD} at (2,492) size 147x39 [r=12 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-13"
+            LayoutTableCell {TD} at (151,492) size 147x39 [r=12 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-13"
+            LayoutTableCell {TD} at (300,492) size 147x39 [r=12 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-13"
+          LayoutTableRow {TR} at (0,533) size 449x39
+            LayoutTableCell {TD} at (2,533) size 147x39 [r=13 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-14"
+            LayoutTableCell {TD} at (151,533) size 147x39 [r=13 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-14"
+            LayoutTableCell {TD} at (300,533) size 147x39 [r=13 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-14"
+          LayoutTableRow {TR} at (0,574) size 449x39
+            LayoutTableCell {TD} at (2,574) size 147x39 [r=14 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-15"
+            LayoutTableCell {TD} at (151,574) size 147x39 [r=14 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-15"
+            LayoutTableCell {TD} at (300,574) size 147x39 [r=14 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-15"
+          LayoutTableRow {TR} at (0,615) size 449x39
+            LayoutTableCell {TD} at (2,615) size 147x39 [r=15 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-16"
+            LayoutTableCell {TD} at (151,615) size 147x39 [r=15 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-16"
+            LayoutTableCell {TD} at (300,615) size 147x39 [r=15 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-16"
+          LayoutTableRow {TR} at (0,656) size 449x39
+            LayoutTableCell {TD} at (2,656) size 147x39 [r=16 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-17"
+            LayoutTableCell {TD} at (151,656) size 147x39 [r=16 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-17"
+            LayoutTableCell {TD} at (300,656) size 147x39 [r=16 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-17"
+          LayoutTableRow {TR} at (0,697) size 449x39
+            LayoutTableCell {TD} at (2,697) size 147x39 [r=17 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-18"
+            LayoutTableCell {TD} at (151,697) size 147x39 [r=17 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-18"
+            LayoutTableCell {TD} at (300,697) size 147x39 [r=17 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-18"
+          LayoutTableRow {TR} at (0,738) size 449x47
+            LayoutTableCell {TD} at (2,791) size 147x39 [r=18 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-19"
+            LayoutTableCell {TD} at (151,791) size 147x39 [r=18 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-19"
+            LayoutTableCell {TD} at (300,791) size 147x39 [r=18 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-19"
+          LayoutTableRow {TR} at (0,832) size 449x39
+            LayoutTableCell {TD} at (2,832) size 147x39 [r=19 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-20"
+            LayoutTableCell {TD} at (151,832) size 147x39 [r=19 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-20"
+            LayoutTableCell {TD} at (300,832) size 147x39 [r=19 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-20"
+          LayoutTableRow {TR} at (0,873) size 449x39
+            LayoutTableCell {TD} at (2,873) size 147x39 [r=20 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-21"
+            LayoutTableCell {TD} at (151,873) size 147x39 [r=20 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-21"
+            LayoutTableCell {TD} at (300,873) size 147x39 [r=20 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-21"
+          LayoutTableRow {TR} at (0,914) size 449x39
+            LayoutTableCell {TD} at (2,914) size 147x39 [r=21 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-22"
+            LayoutTableCell {TD} at (151,914) size 147x39 [r=21 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-22"
+            LayoutTableCell {TD} at (300,914) size 147x39 [r=21 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-22"
+          LayoutTableRow {TR} at (0,955) size 449x39
+            LayoutTableCell {TD} at (2,955) size 147x39 [r=22 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-23"
+            LayoutTableCell {TD} at (151,955) size 147x39 [r=22 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-23"
+            LayoutTableCell {TD} at (300,955) size 147x39 [r=22 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-23"
+          LayoutTableRow {TR} at (0,996) size 449x39
+            LayoutTableCell {TD} at (2,996) size 147x39 [r=23 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-24"
+            LayoutTableCell {TD} at (151,996) size 147x39 [r=23 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-24"
+            LayoutTableCell {TD} at (300,996) size 147x39 [r=23 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-24"
+          LayoutTableRow {TR} at (0,1037) size 449x39
+            LayoutTableCell {TD} at (2,1037) size 147x39 [r=24 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-25"
+            LayoutTableCell {TD} at (151,1037) size 147x39 [r=24 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-25"
+            LayoutTableCell {TD} at (300,1037) size 147x39 [r=24 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-25"
+          LayoutTableRow {TR} at (0,1078) size 449x39
+            LayoutTableCell {TD} at (2,1078) size 147x39 [r=25 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-26"
+            LayoutTableCell {TD} at (151,1078) size 147x39 [r=25 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-26"
+            LayoutTableCell {TD} at (300,1078) size 147x39 [r=25 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-26"
+          LayoutTableRow {TR} at (0,1119) size 449x39
+            LayoutTableCell {TD} at (2,1119) size 147x39 [r=26 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-27"
+            LayoutTableCell {TD} at (151,1119) size 147x39 [r=26 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-27"
+            LayoutTableCell {TD} at (300,1119) size 147x39 [r=26 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-27"
+          LayoutTableRow {TR} at (0,1160) size 449x39
+            LayoutTableCell {TD} at (2,1160) size 147x39 [r=27 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-28"
+            LayoutTableCell {TD} at (151,1160) size 147x39 [r=27 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-28"
+            LayoutTableCell {TD} at (300,1160) size 147x39 [r=27 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-28"
+          LayoutTableRow {TR} at (0,1201) size 449x39
+            LayoutTableCell {TD} at (2,1201) size 147x39 [r=28 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-29"
+            LayoutTableCell {TD} at (151,1201) size 147x39 [r=28 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-29"
+            LayoutTableCell {TD} at (300,1201) size 147x39 [r=28 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-29"
+          LayoutTableRow {TR} at (0,1242) size 449x39
+            LayoutTableCell {TD} at (2,1242) size 147x39 [r=29 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-30"
+            LayoutTableCell {TD} at (151,1242) size 147x39 [r=29 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-30"
+            LayoutTableCell {TD} at (300,1242) size 147x39 [r=29 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-30"
+          LayoutTableRow {TR} at (0,1283) size 449x39
+            LayoutTableCell {TD} at (2,1283) size 147x39 [r=30 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-31"
+            LayoutTableCell {TD} at (151,1283) size 147x39 [r=30 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-31"
+            LayoutTableCell {TD} at (300,1283) size 147x39 [r=30 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-31"
+          LayoutTableRow {TR} at (0,1324) size 449x39
+            LayoutTableCell {TD} at (2,1324) size 147x39 [r=31 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-32"
+            LayoutTableCell {TD} at (151,1324) size 147x39 [r=31 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-32"
+            LayoutTableCell {TD} at (300,1324) size 147x39 [r=31 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-32"
+          LayoutTableRow {TR} at (0,1365) size 449x39
+            LayoutTableCell {TD} at (2,1365) size 147x39 [r=32 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-33"
+            LayoutTableCell {TD} at (151,1365) size 147x39 [r=32 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-33"
+            LayoutTableCell {TD} at (300,1365) size 147x39 [r=32 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-33"
+          LayoutTableRow {TR} at (0,1406) size 449x39
+            LayoutTableCell {TD} at (2,1406) size 147x39 [r=33 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-34"
+            LayoutTableCell {TD} at (151,1406) size 147x39 [r=33 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-34"
+            LayoutTableCell {TD} at (300,1406) size 147x39 [r=33 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-34"
+          LayoutTableRow {TR} at (0,1447) size 449x39
+            LayoutTableCell {TD} at (2,1447) size 147x39 [r=34 c=0 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "1-35"
+            LayoutTableCell {TD} at (151,1447) size 147x39 [r=34 c=1 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "2-35"
+            LayoutTableCell {TD} at (300,1447) size 147x39 [r=34 c=2 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 65x36
+                text run at (1,1) width 65: "3-35"
diff --git a/third_party/WebKit/LayoutTests/printing/thead-repeats-at-top-of-each-page.html b/third_party/WebKit/LayoutTests/printing/thead-repeats-at-top-of-each-page.html
new file mode 100644
index 0000000..92c9faa1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/printing/thead-repeats-at-top-of-each-page.html
@@ -0,0 +1,198 @@
+<!DOCTYPE html>
+<title>crbug.com/24826: When printing, table header groups repeat at the top of each page.</title>
+<style>
+    table {font-family: Helvetica, Arial, Verdana; font-size: 24pt
+    }
+    @media print {
+        thead {display: table-header-group;}
+    }
+</style>
+<script>
+    if (window.testRunner)
+        testRunner.setPrinting();
+</script>
+<table>
+<thead>
+    <tr>
+        <th>Column 1</th>
+        <th>Column 2</th>
+        <th>Column 3</th>
+    </tr>
+</thead>
+<tbody>
+    <tr>
+        <td>1-1</td>
+        <td>2-1</td>
+        <td>3-1</td>
+    </tr>
+    <tr>
+        <td>1-2</td>
+        <td>2-2</td>
+        <td>3-2</td>
+    </tr>
+    <tr>
+        <td>1-3</td>
+        <td>2-3</td>
+        <td>3-3</td>
+    </tr>
+    <tr>
+        <td>1-4</td>
+        <td>2-4</td>
+        <td>3-4</td>
+    </tr>
+    <tr>
+        <td>1-5</td>
+        <td>2-5</td>
+        <td>3-5</td>
+    </tr>
+    <tr>
+        <td>1-6</td>
+        <td>2-6</td>
+        <td>3-6</td>
+    </tr>
+    <tr>
+        <td>1-7</td>
+        <td>2-7</td>
+        <td>3-7</td>
+    </tr>
+    <tr>
+        <td>1-8</td>
+        <td>2-8</td>
+        <td>3-8</td>
+    </tr>
+    <tr>
+        <td>1-9</td>
+        <td>2-9</td>
+        <td>3-9</td>
+    </tr>
+    <tr>
+        <td>1-10</td>
+        <td>2-10</td>
+        <td>3-10</td>
+    </tr>
+    <tr>
+        <td>1-11</td>
+        <td>2-11</td>
+        <td>3-11</td>
+    </tr>
+    <tr>
+        <td>1-12</td>
+        <td>2-12</td>
+        <td>3-12</td>
+    </tr>
+    <tr>
+        <td>1-13</td>
+        <td>2-13</td>
+        <td>3-13</td>
+    </tr>
+    <tr>
+        <td>1-14</td>
+        <td>2-14</td>
+        <td>3-14</td>
+    </tr>
+    <tr>
+        <td>1-15</td>
+        <td>2-15</td>
+        <td>3-15</td>
+    </tr>
+    <tr>
+        <td>1-16</td>
+        <td>2-16</td>
+        <td>3-16</td>
+    </tr>
+    <tr>
+        <td>1-17</td>
+        <td>2-17</td>
+        <td>3-17</td>
+    </tr>
+    <tr>
+        <td>1-18</td>
+        <td>2-18</td>
+        <td>3-18</td>
+    </tr>
+    <tr>
+        <td>1-19</td>
+        <td>2-19</td>
+        <td>3-19</td>
+    </tr>
+    <tr>
+        <td>1-20</td>
+        <td>2-20</td>
+        <td>3-20</td>
+    </tr>
+    <tr>
+        <td>1-21</td>
+        <td>2-21</td>
+        <td>3-21</td>
+    </tr>
+    <tr>
+        <td>1-22</td>
+        <td>2-22</td>
+        <td>3-22</td>
+    </tr>
+    <tr>
+        <td>1-23</td>
+        <td>2-23</td>
+        <td>3-23</td>
+    </tr>
+    <tr>
+        <td>1-24</td>
+        <td>2-24</td>
+        <td>3-24</td>
+    </tr>
+    <tr>
+        <td>1-25</td>
+        <td>2-25</td>
+        <td>3-25</td>
+    </tr>
+    <tr>
+        <td>1-26</td>
+        <td>2-26</td>
+        <td>3-26</td>
+    </tr>
+    <tr>
+        <td>1-27</td>
+        <td>2-27</td>
+        <td>3-27</td>
+    </tr>
+    <tr>
+        <td>1-28</td>
+        <td>2-28</td>
+        <td>3-28</td>
+    </tr>
+    <tr>
+        <td>1-29</td>
+        <td>2-29</td>
+        <td>3-29</td>
+    </tr>
+    <tr>
+        <td>1-30</td>
+        <td>2-30</td>
+        <td>3-30</td>
+    </tr>
+    <tr>
+        <td>1-31</td>
+        <td>2-31</td>
+        <td>3-31</td>
+    </tr>
+    <tr>
+        <td>1-32</td>
+        <td>2-32</td>
+        <td>3-32</td>
+    </tr>
+    <tr>
+        <td>1-33</td>
+        <td>2-33</td>
+        <td>3-33</td>
+    </tr>
+    <tr>
+        <td>1-34</td>
+        <td>2-34</td>
+        <td>3-34</td>
+    </tr>
+    <tr>
+        <td>1-35</td>
+        <td>2-35</td>
+        <td>3-35</td>
+    </tr>
+</tbody>
diff --git a/third_party/WebKit/Source/core/css/html.css b/third_party/WebKit/Source/core/css/html.css
index 56f68f09..c301bbb 100644
--- a/third_party/WebKit/Source/core/css/html.css
+++ b/third_party/WebKit/Source/core/css/html.css
@@ -1113,5 +1113,10 @@
     border-width: 0px;
 }
 
+/* Allows thead sections to print at the top of each page. */
+@media print {
+    thead { break-inside:avoid; }
+}
+
 /* noscript is handled internally, as it depends on settings. */
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index 3cf425f..1cbedca 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -4835,7 +4835,7 @@
     LayoutView* layoutView = view();
     LayoutFlowThread* flowThread = flowThreadContainingBlock();
     if (!flowThread)
-        return layoutView->layoutState()->pageLogicalHeight();
+        return layoutView->pageLogicalHeight();
     return flowThread->pageLogicalHeightForOffset(offset + offsetFromLogicalTopOfFirstPage());
 }
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
index e957a75..3307098 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
@@ -984,6 +984,11 @@
             if (isPaginated) {
                 paginationStrutOnRow = paginationStrutForRow(rowLayoutObject, LayoutUnit(m_rowPos[r]));
                 if (paginationStrutOnRow) {
+                    LayoutTableSection* header = table()->header();
+                    // If we have a header group we will paint it at the top of each page, move the rows
+                    // down to accomodate it.
+                    if (header && header != this)
+                        paginationStrutOnRow += header->logicalHeight().toInt();
                     for (unsigned rowIndex = r; rowIndex <= totalRows; rowIndex++)
                         m_rowPos[rowIndex] += paginationStrutOnRow;
                 }
@@ -1111,7 +1116,10 @@
 
 int LayoutTableSection::paginationStrutForRow(LayoutTableRow* row, LayoutUnit logicalOffset) const
 {
-    if (row->getPaginationBreakability() == AllowAnyBreaks)
+    // Even if the row allows us to break-inside, we will want to put a strut on the row if we have a header
+    // group that wants to appear at the top of each page.
+    bool tableHeaderForcesStrut = table()->header() ? table()->header()->getPaginationBreakability() != AllowAnyBreaks : false;
+    if (row->getPaginationBreakability() == AllowAnyBreaks && !tableHeaderForcesStrut)
         return 0;
     LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
     if (!pageLogicalHeight)
diff --git a/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp b/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
index 8065aa7..0b22c83 100644
--- a/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
@@ -35,8 +35,44 @@
     return cell;
 }
 
+void TableSectionPainter::paintRepeatingHeaderGroup(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue, ItemToPaint itemToPaint)
+{
+    if (m_layoutTableSection.getPaginationBreakability() == LayoutBox::AllowAnyBreaks)
+        return;
+    // TODO(rhogan): Should we paint a header repeatedly if it's self-painting?
+    if (m_layoutTableSection.hasSelfPaintingLayer())
+        return;
+    LayoutTable* table = m_layoutTableSection.table();
+    LayoutUnit pageHeight = table->pageLogicalHeightForOffset(LayoutUnit());
+    if (!pageHeight)
+        return;
+
+    LayoutPoint paginationOffset = paintOffset;
+    // Move paginationOffset to the top of the second page.
+    paginationOffset.move(0, pageHeight - table->pageLogicalOffset());
+    // Now move paginationOffset to the top of the page the cull rect starts on.
+    if (paintInfo.cullRect().m_rect.y() > paginationOffset.y())
+        paginationOffset.move(0, pageHeight * static_cast<int>((paintInfo.cullRect().m_rect.y() - paginationOffset.y()) / pageHeight));
+    LayoutUnit bottomBound = std::min(LayoutUnit(paintInfo.cullRect().m_rect.maxY()), paintOffset.y() + table->logicalHeight());
+    while (paginationOffset.y() < bottomBound) {
+        if (itemToPaint == PaintCollapsedBorders)
+            paintCollapsedSectionBorders(paintInfo, paginationOffset, currentBorderValue);
+        else
+            paintSection(paintInfo, paginationOffset);
+        paginationOffset.move(0, pageHeight);
+    }
+}
+
 void TableSectionPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
+    paintSection(paintInfo, paintOffset);
+    LayoutTable* table = m_layoutTableSection.table();
+    if (table->header() == m_layoutTableSection)
+        paintRepeatingHeaderGroup(paintInfo, paintOffset, CollapsedBorderValue(), PaintSection);
+}
+
+void TableSectionPainter::paintSection(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
+{
     DCHECK(!m_layoutTableSection.needsLayout());
     // avoid crashing on bugs that cause us to paint with dirty layout
     if (m_layoutTableSection.needsLayout())
@@ -78,6 +114,14 @@
 
 void TableSectionPainter::paintCollapsedBorders(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue)
 {
+    paintCollapsedSectionBorders(paintInfo, paintOffset, currentBorderValue);
+    LayoutTable* table = m_layoutTableSection.table();
+    if (table->header() == m_layoutTableSection)
+        paintRepeatingHeaderGroup(paintInfo, paintOffset, currentBorderValue, PaintCollapsedBorders);
+}
+
+void TableSectionPainter::paintCollapsedSectionBorders(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue)
+{
     if (!m_layoutTableSection.numRows() || !m_layoutTableSection.table()->effectiveColumns().size())
         return;
 
diff --git a/third_party/WebKit/Source/core/paint/TableSectionPainter.h b/third_party/WebKit/Source/core/paint/TableSectionPainter.h
index 772a4e3..3f72b76 100644
--- a/third_party/WebKit/Source/core/paint/TableSectionPainter.h
+++ b/third_party/WebKit/Source/core/paint/TableSectionPainter.h
@@ -39,6 +39,14 @@
     // dirtiedRows and dirtiedColumns.
     const LayoutTableCell* primaryCellToPaint(unsigned row, unsigned column, const CellSpan& dirtiedRows, const CellSpan& dirtiedColumns) const;
 
+    enum ItemToPaint {
+        PaintCollapsedBorders,
+        PaintSection
+    };
+    void paintRepeatingHeaderGroup(const PaintInfo&, const LayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue, ItemToPaint);
+    void paintSection(const PaintInfo&, const LayoutPoint&);
+    void paintCollapsedSectionBorders(const PaintInfo&, const LayoutPoint&, const CollapsedBorderValue&);
+
     const LayoutTableSection& m_layoutTableSection;
 };