[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

mitz at apple.com mitz at apple.com
Wed Dec 22 15:29:57 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 8010bbae7d39674e50ee08b75196f9c3118b5b24
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 5 02:43:17 2010 +0000

    WebCore: Made table layout and painting work with all writing modes. Hit-testing, repainting, tables
    where some elements have their own layers, and cells whose writing mode differs from the
    table’s are not supported yet.
    
    Reviewed by Dave Hyatt.
    
    Make tables work with vertical text
    https://bugs.webkit.org/show_bug.cgi?id=46417
    
    Tests: fast/table/027-vertical.html
           fast/table/028-vertical.html
           fast/table/035-vertical.html
           fast/table/038-vertical.html
           fast/table/040-vertical.html
           fast/table/auto-with-percent-height-vertical.html
           fast/table/border-collapsing/001-vertical.html
           fast/table/border-collapsing/002-vertical.html
           fast/table/border-collapsing/003-vertical.html
           fast/table/border-collapsing/004-vertical.html
           fast/table/border-collapsing/border-collapsing-head-foot-vertical.html
           fast/table/border-collapsing/equal-precedence-resolution-vertical.html
           fast/table/border-collapsing/rtl-border-collapsing-vertical.html
           fast/table/colspanMinWidth-vertical.html
           fast/table/fixed-with-auto-with-colspan-vertical.html
           fast/table/growCellForImageQuirk-vertical.html
           fast/table/height-percent-test-vertical.html
           fast/table/percent-widths-stretch-vertical.html
           fast/table/rowspan-paint-order-vertical.html
           fast/table/table-display-types-vertical.html
    
    * css/CSSStyleSelector.cpp:
    (WebCore::CSSStyleSelector::adjustRenderStyle): Changed to allow all writing modes for tables,
    make row groups, rows, column groups and columns inherit the table’s writing mode. For now,
    make cells do this too.
    * html/HTMLTableElement.cpp:
    (WebCore::HTMLTableElement::parseMappedAttribute): Map align=center using logical properties.
    * rendering/RenderTable.cpp:
    (WebCore::RenderTable::RenderTable): Initialize m_borderStart and m_borderEnd.
    (WebCore::RenderTable::styleDidChange): Changed the rule for when to use auto layout to look
    at the logical width instead of the width.
    (WebCore::RenderTable::computeLogicalWidth): Uses logical widths and works with perpendicular
    containing blocks.
    (WebCore::RenderTable::layout): Use logical lengths.
    (WebCore::RenderTable::setCellLogicalWidths): Renamed setCellWidths() to this and updated for
    the renaming of RenderTableSection::setCellWidths().
    (WebCore::RenderTable::paintObject): Account for flipped modes.
    (WebCore::RenderTable::subtractCaptionRect): Added this helper method the considers writing modes.
    (WebCore::RenderTable::paintBoxDecorations): Adopted subtractCaptionRect().
    (WebCore::RenderTable::paintMask): Ditto.
    (WebCore::RenderTable::computePreferredLogicalWidths): Updated for the renaming of
    recalcHorizontalBorders().
    (WebCore::RenderTable::calcBorderStart): Renamed calcBorderLeft() to this and changed it to use
    borderStart(). Splits odd number of pixels based on the physical side.
    (WebCore::RenderTable::calcBorderEnd): Similar.
    (WebCore::RenderTable::recalcBordersInRowDirection): Renamed recalcHorizontalBorders() to this
    and updated for other renames.
    (WebCore::RenderTable::borderBefore): Replaced borderTop() with this.
    (WebCore::RenderTable::borderAfter): Similar.
    (WebCore::RenderTable::outerBorderBefore): Similar.
    (WebCore::RenderTable::outerBorderAfter): Similar.
    (WebCore::RenderTable::outerBorderStart): Similar.
    (WebCore::RenderTable::outerBorderEnd): Similar.
    (WebCore::RenderTable::firstLineBoxBaseline): Changed to use logical heights.
    (WebCore::RenderTable::overflowClipRect): Account for writing modes.
    * rendering/RenderTable.h:
    (WebCore::RenderTable::borderStart):
    (WebCore::RenderTable::borderEnd):
    (WebCore::RenderTable::borderLeft):
    (WebCore::RenderTable::borderRight):
    (WebCore::RenderTable::borderTop):
    (WebCore::RenderTable::borderBottom):
    (WebCore::RenderTable::outerBorderLeft):
    (WebCore::RenderTable::outerBorderRight):
    (WebCore::RenderTable::outerBorderTop):
    (WebCore::RenderTable::outerBorderBottom):
    (WebCore::RenderTable::bordersPaddingAndSpacingInRowDirection): Changed to match its name.
    * rendering/RenderTableRow.cpp:
    (WebCore::RenderTableRow::styleWillChange): Changed to detect changes to logical height.
    * rendering/RenderTableSection.cpp:
    (WebCore::setRowLogicalHeightToRowStyleLogicalHeightIfNotRelative): Renamed and changed to use
    logical heights.
    (WebCore::RenderTableSection::RenderTableSection): Updated initializers for new member variables.
    (WebCore::RenderTableSection::addChild): Updated for rename.
    (WebCore::RenderTableSection::ensureRows): Ditto.
    (WebCore::RenderTableSection::addCell): Ditto. Also use logical heights.
    (WebCore::RenderTableSection::setCellLogicalWidths): Renamed setCellWidths() to this, changed
    to use logical widths.
    (WebCore::RenderTableSection::calcRowLogicalHeight): Added “logical” to the name. Updated with
    logical heights.
    (WebCore::RenderTableSection::layoutRows):
    (WebCore::RenderTableSection::calcOuterBorderBefore):
    (WebCore::RenderTableSection::calcOuterBorderAfter):
    (WebCore::RenderTableSection::calcOuterBorderStart):
    (WebCore::RenderTableSection::calcOuterBorderEnd):
    (WebCore::RenderTableSection::recalcOuterBorder):
    (WebCore::RenderTableSection::firstLineBoxBaseline):
    (WebCore::RenderTableSection::paintCell):
    (WebCore::RenderTableSection::recalcCells):
    * rendering/RenderTableSection.h:
    (WebCore::RenderTableSection::outerBorderBefore):
    (WebCore::RenderTableSection::outerBorderAfter):
    (WebCore::RenderTableSection::outerBorderStart):
    (WebCore::RenderTableSection::outerBorderEnd):
    
    LayoutTests: Make tables work with vertical text
    https://bugs.webkit.org/show_bug.cgi?id=46417
    
    Reviewed by Dave Hyatt.
    
    * fast/table/027-vertical.html: Copied from LayoutTests/fast/table/027.html.
    * fast/table/028-vertical.html: Copied from LayoutTests/fast/table/028.html.
    * fast/table/035-vertical.html: Copied from LayoutTests/fast/table/035.html.
    * fast/table/038-vertical.html: Copied from LayoutTests/fast/table/038.html.
    * fast/table/040-vertical.html: Copied from LayoutTests/fast/table/040.html.
    * fast/table/auto-with-percent-height-vertical.html: Copied from LayoutTests/fast/table/auto-with-percent-height.html.
    * fast/table/border-collapsing/001-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/001.html.
    * fast/table/border-collapsing/002-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/002.html.
    * fast/table/border-collapsing/003-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/003.html.
    * fast/table/border-collapsing/004-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/004.html.
    * fast/table/border-collapsing/border-collapsing-head-foot-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/border-collapsing-head-foot.html.
    * fast/table/border-collapsing/equal-precedence-resolution-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/equal-precedence-resolution.html.
    * fast/table/border-collapsing/rtl-border-collapsing-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/rtl-border-collapsing.html.
    * fast/table/colspanMinWidth-vertical.html: Copied from LayoutTests/fast/table/colspanMinWidth.html.
    * fast/table/fixed-with-auto-with-colspan-vertical.html: Copied from LayoutTests/fast/table/fixed-with-auto-with-colspan.html.
    * fast/table/growCellForImageQuirk-vertical.html: Copied from LayoutTests/fast/table/growCellForImageQuirk.html.
    * fast/table/height-percent-test-vertical.html: Copied from LayoutTests/fast/table/height-percent-test.html.
    * fast/table/percent-widths-stretch-vertical.html: Copied from LayoutTests/fast/table/percent-widths-stretch.html.
    * fast/table/rowspan-paint-order-vertical.html: Copied from LayoutTests/fast/table/rowspan-paint-order.html.
    * fast/table/table-display-types-vertical.html: Copied from LayoutTests/fast/table/table-display-types.html.
    * platform/mac/fast/table/027-vertical-expected.checksum: Added.
    * platform/mac/fast/table/027-vertical-expected.png: Added.
    * platform/mac/fast/table/027-vertical-expected.txt: Added.
    * platform/mac/fast/table/028-vertical-expected.checksum: Added.
    * platform/mac/fast/table/028-vertical-expected.png: Added.
    * platform/mac/fast/table/028-vertical-expected.txt: Added.
    * platform/mac/fast/table/035-vertical-expected.checksum: Added.
    * platform/mac/fast/table/035-vertical-expected.png: Added.
    * platform/mac/fast/table/035-vertical-expected.txt: Added.
    * platform/mac/fast/table/038-vertical-expected.checksum: Added.
    * platform/mac/fast/table/038-vertical-expected.png: Added.
    * platform/mac/fast/table/038-vertical-expected.txt: Added.
    * platform/mac/fast/table/040-vertical-expected.checksum: Added.
    * platform/mac/fast/table/040-vertical-expected.png: Added.
    * platform/mac/fast/table/040-vertical-expected.txt: Added.
    * platform/mac/fast/table/auto-with-percent-height-vertical-expected.checksum: Added.
    * platform/mac/fast/table/auto-with-percent-height-vertical-expected.png: Added.
    * platform/mac/fast/table/auto-with-percent-height-vertical-expected.txt: Added.
    * platform/mac/fast/table/border-collapsing/001-vertical-expected.checksum: Added.
    * platform/mac/fast/table/border-collapsing/001-vertical-expected.png: Added.
    * platform/mac/fast/table/border-collapsing/001-vertical-expected.txt: Added.
    * platform/mac/fast/table/border-collapsing/002-vertical-expected.checksum: Added.
    * platform/mac/fast/table/border-collapsing/002-vertical-expected.png: Added.
    * platform/mac/fast/table/border-collapsing/002-vertical-expected.txt: Added.
    * platform/mac/fast/table/border-collapsing/003-vertical-expected.checksum: Added.
    * platform/mac/fast/table/border-collapsing/003-vertical-expected.png: Added.
    * platform/mac/fast/table/border-collapsing/003-vertical-expected.txt: Added.
    * platform/mac/fast/table/border-collapsing/004-vertical-expected.checksum: Added.
    * platform/mac/fast/table/border-collapsing/004-vertical-expected.png: Added.
    * platform/mac/fast/table/border-collapsing/004-vertical-expected.txt: Added.
    * platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.checksum: Added.
    * platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.png: Added.
    * platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.txt: Added.
    * platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.checksum: Added.
    * platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.png: Added.
    * platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.txt: Added.
    * platform/mac/fast/table/border-collapsing/rtl-border-collapsing-vertical-expected.checksum: Added.
    * platform/mac/fast/table/border-collapsing/rtl-border-collapsing-vertical-expected.png: Added.
    * platform/mac/fast/table/border-collapsing/rtl-border-collapsing-vertical-expected.txt: Added.
    * platform/mac/fast/table/colspanMinWidth-vertical-expected.checksum: Added.
    * platform/mac/fast/table/colspanMinWidth-vertical-expected.png: Added.
    * platform/mac/fast/table/colspanMinWidth-vertical-expected.txt: Added.
    * platform/mac/fast/table/fixed-with-auto-with-colspan-vertical-expected.checksum: Added.
    * platform/mac/fast/table/fixed-with-auto-with-colspan-vertical-expected.png: Added.
    * platform/mac/fast/table/fixed-with-auto-with-colspan-vertical-expected.txt: Added.
    * platform/mac/fast/table/growCellForImageQuirk-vertical-expected.checksum: Added.
    * platform/mac/fast/table/growCellForImageQuirk-vertical-expected.png: Added.
    * platform/mac/fast/table/growCellForImageQuirk-vertical-expected.txt: Added.
    * platform/mac/fast/table/height-percent-test-vertical-expected.checksum: Added.
    * platform/mac/fast/table/height-percent-test-vertical-expected.png: Added.
    * platform/mac/fast/table/height-percent-test-vertical-expected.txt: Added.
    * platform/mac/fast/table/percent-widths-stretch-vertical-expected.checksum: Added.
    * platform/mac/fast/table/percent-widths-stretch-vertical-expected.png: Added.
    * platform/mac/fast/table/percent-widths-stretch-vertical-expected.txt: Added.
    * platform/mac/fast/table/rowspan-paint-order-vertical-expected.checksum: Added.
    * platform/mac/fast/table/rowspan-paint-order-vertical-expected.png: Added.
    * platform/mac/fast/table/rowspan-paint-order-vertical-expected.txt: Added.
    * platform/mac/fast/table/table-display-types-vertical-expected.checksum: Added.
    * platform/mac/fast/table/table-display-types-vertical-expected.png: Added.
    * platform/mac/fast/table/table-display-types-vertical-expected.txt: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71382 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 1da0a05..c99ced1 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,91 @@
+2010-11-04  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        Make tables work with vertical text
+        https://bugs.webkit.org/show_bug.cgi?id=46417
+
+        * fast/table/027-vertical.html: Copied from LayoutTests/fast/table/027.html.
+        * fast/table/028-vertical.html: Copied from LayoutTests/fast/table/028.html.
+        * fast/table/035-vertical.html: Copied from LayoutTests/fast/table/035.html.
+        * fast/table/038-vertical.html: Copied from LayoutTests/fast/table/038.html.
+        * fast/table/040-vertical.html: Copied from LayoutTests/fast/table/040.html.
+        * fast/table/auto-with-percent-height-vertical.html: Copied from LayoutTests/fast/table/auto-with-percent-height.html.
+        * fast/table/border-collapsing/001-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/001.html.
+        * fast/table/border-collapsing/002-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/002.html.
+        * fast/table/border-collapsing/003-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/003.html.
+        * fast/table/border-collapsing/004-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/004.html.
+        * fast/table/border-collapsing/border-collapsing-head-foot-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/border-collapsing-head-foot.html.
+        * fast/table/border-collapsing/equal-precedence-resolution-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/equal-precedence-resolution.html.
+        * fast/table/border-collapsing/rtl-border-collapsing-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/rtl-border-collapsing.html.
+        * fast/table/colspanMinWidth-vertical.html: Copied from LayoutTests/fast/table/colspanMinWidth.html.
+        * fast/table/fixed-with-auto-with-colspan-vertical.html: Copied from LayoutTests/fast/table/fixed-with-auto-with-colspan.html.
+        * fast/table/growCellForImageQuirk-vertical.html: Copied from LayoutTests/fast/table/growCellForImageQuirk.html.
+        * fast/table/height-percent-test-vertical.html: Copied from LayoutTests/fast/table/height-percent-test.html.
+        * fast/table/percent-widths-stretch-vertical.html: Copied from LayoutTests/fast/table/percent-widths-stretch.html.
+        * fast/table/rowspan-paint-order-vertical.html: Copied from LayoutTests/fast/table/rowspan-paint-order.html.
+        * fast/table/table-display-types-vertical.html: Copied from LayoutTests/fast/table/table-display-types.html.
+        * platform/mac/fast/table/027-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/027-vertical-expected.png: Added.
+        * platform/mac/fast/table/027-vertical-expected.txt: Added.
+        * platform/mac/fast/table/028-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/028-vertical-expected.png: Added.
+        * platform/mac/fast/table/028-vertical-expected.txt: Added.
+        * platform/mac/fast/table/035-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/035-vertical-expected.png: Added.
+        * platform/mac/fast/table/035-vertical-expected.txt: Added.
+        * platform/mac/fast/table/038-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/038-vertical-expected.png: Added.
+        * platform/mac/fast/table/038-vertical-expected.txt: Added.
+        * platform/mac/fast/table/040-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/040-vertical-expected.png: Added.
+        * platform/mac/fast/table/040-vertical-expected.txt: Added.
+        * platform/mac/fast/table/auto-with-percent-height-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/auto-with-percent-height-vertical-expected.png: Added.
+        * platform/mac/fast/table/auto-with-percent-height-vertical-expected.txt: Added.
+        * platform/mac/fast/table/border-collapsing/001-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/border-collapsing/001-vertical-expected.png: Added.
+        * platform/mac/fast/table/border-collapsing/001-vertical-expected.txt: Added.
+        * platform/mac/fast/table/border-collapsing/002-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/border-collapsing/002-vertical-expected.png: Added.
+        * platform/mac/fast/table/border-collapsing/002-vertical-expected.txt: Added.
+        * platform/mac/fast/table/border-collapsing/003-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/border-collapsing/003-vertical-expected.png: Added.
+        * platform/mac/fast/table/border-collapsing/003-vertical-expected.txt: Added.
+        * platform/mac/fast/table/border-collapsing/004-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/border-collapsing/004-vertical-expected.png: Added.
+        * platform/mac/fast/table/border-collapsing/004-vertical-expected.txt: Added.
+        * platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.png: Added.
+        * platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.txt: Added.
+        * platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.png: Added.
+        * platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.txt: Added.
+        * platform/mac/fast/table/border-collapsing/rtl-border-collapsing-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/border-collapsing/rtl-border-collapsing-vertical-expected.png: Added.
+        * platform/mac/fast/table/border-collapsing/rtl-border-collapsing-vertical-expected.txt: Added.
+        * platform/mac/fast/table/colspanMinWidth-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/colspanMinWidth-vertical-expected.png: Added.
+        * platform/mac/fast/table/colspanMinWidth-vertical-expected.txt: Added.
+        * platform/mac/fast/table/fixed-with-auto-with-colspan-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/fixed-with-auto-with-colspan-vertical-expected.png: Added.
+        * platform/mac/fast/table/fixed-with-auto-with-colspan-vertical-expected.txt: Added.
+        * platform/mac/fast/table/growCellForImageQuirk-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/growCellForImageQuirk-vertical-expected.png: Added.
+        * platform/mac/fast/table/growCellForImageQuirk-vertical-expected.txt: Added.
+        * platform/mac/fast/table/height-percent-test-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/height-percent-test-vertical-expected.png: Added.
+        * platform/mac/fast/table/height-percent-test-vertical-expected.txt: Added.
+        * platform/mac/fast/table/percent-widths-stretch-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/percent-widths-stretch-vertical-expected.png: Added.
+        * platform/mac/fast/table/percent-widths-stretch-vertical-expected.txt: Added.
+        * platform/mac/fast/table/rowspan-paint-order-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/rowspan-paint-order-vertical-expected.png: Added.
+        * platform/mac/fast/table/rowspan-paint-order-vertical-expected.txt: Added.
+        * platform/mac/fast/table/table-display-types-vertical-expected.checksum: Added.
+        * platform/mac/fast/table/table-display-types-vertical-expected.png: Added.
+        * platform/mac/fast/table/table-display-types-vertical-expected.txt: Added.
+
 2010-11-04  MORITA Hajime  <morrita at google.com>
 
         Reviewed by Kent Tamura.
diff --git a/LayoutTests/fast/table/027-vertical.html b/LayoutTests/fast/table/027-vertical.html
new file mode 100644
index 0000000..05af33c
--- /dev/null
+++ b/LayoutTests/fast/table/027-vertical.html
@@ -0,0 +1,50 @@
+<html>
+<head>
+<style>
+td { border: 1px solid green }
+</style>
+</head>
+<body>
+<table height=100% cellspacing=0 cellpadding=3 border=0 style="-webkit-writing-mode: vertical-rl;">
+<tr>
+    <td colspan=3 nowrap>
+                                        &nbsp;&nbsp;&nbsp;Join Now&nbsp;&nbsp;&nbsp;Sign In&nbsp;&nbsp;
+                            
+                                &nbsp;&nbsp; Personalize:&nbsp;<a>Settings</a>&nbsp;&#149;&nbsp;<a>Content</a>&nbsp;&#149;&nbsp;<a>Layout</a>&nbsp;&#149;&nbsp;<a>Colors & Themes</a>&nbsp;&#149;&nbsp;<a>Sign In</a>&nbsp; 
+                            
+                                &nbsp;&nbsp; My Links:&nbsp;&nbsp; 
+                            &nbsp;&nbsp;Lite&nbsp;&#149;&nbsp;Email
+                        </td>
+</tr>
+<tr>
+    <td height=28%></td>
+    <td height=44%>
+        <table height=100%>
+            <tr>
+                <td>
+                    <table>
+                        <tr>
+                            <td height=50%>
+                            </td>
+                            <td>
+                                                            This guy should have the really big maxwidth.  It
+                                                            should be big enough to really really screw things up.
+                                                            That is what I think will work.
+                            </td>
+                            <td height=50%>
+                            </td>
+                        </tr>
+                    </table>
+                </td>
+            </tr>
+        </table>
+    
+    </td>
+    <td height=28%>
+        <img height=212 width=18>
+        
+    </td>
+</tr>
+</table>
+</body>
+</html>
diff --git a/LayoutTests/fast/table/028-vertical.html b/LayoutTests/fast/table/028-vertical.html
new file mode 100644
index 0000000..5a003fe
--- /dev/null
+++ b/LayoutTests/fast/table/028-vertical.html
@@ -0,0 +1,42 @@
+
+<head>
+<style>
+img { background-color: orange }
+td { border: 1px solid green }
+</style>
+</head>
+<body>
+These two tables should be the same height.
+<div style="-webkit-writing-mode: vertical-rl;">
+            <table border=0 cellspacing=0 cellpadding=0 height=320>
+                <tr>
+                    <td height=70 valign=top >
+                        1
+                    </td>
+                    <td height=246 valign=top >
+                                        2
+                    
+                                    
+                    </td>
+                    <td height=4><img height=4 width=20></td>
+                </tr>
+            </table>
+            <p></p>
+        
+            <table border=0 cellspacing=0 cellpadding=0 height=320 width=10>
+                <tr>
+                    <td height=66 width=10>1</td>
+                    <td height=254 width=10><img  height=254 width=10 ></td>
+                </tr>
+                <tr>
+                    <td colspan=3>1</td>
+                </tr>
+            </table>
+            
+
+
+
+
+
+
+</div>
diff --git a/LayoutTests/fast/table/035-vertical.html b/LayoutTests/fast/table/035-vertical.html
new file mode 100644
index 0000000..b273e1d
--- /dev/null
+++ b/LayoutTests/fast/table/035-vertical.html
@@ -0,0 +1,18 @@
+<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
+        "http://www.w3.org/TR/html4/loose.dtd">
+<html><body style="-webkit-writing-mode: vertical-rl;">
+
+This test should have two centered tables and two centered divs.
+
+<table align="center" border=1 cellspacing=0 cellpadding=0>
+<tr><td>This table is aligned "center"</td></tr>
+</table>
+
+<table align="CENTER" border=1 cellspacing=0 cellpadding=0>
+<tr><td>This table is aligned "CENTER"</td></tr>
+</table>
+
+<div align="center">This div is aligned "center"</div>
+<div align="CENTER">This div is aligned "CENTER"</div>
+
+</body></html>
diff --git a/LayoutTests/fast/table/038-vertical.html b/LayoutTests/fast/table/038-vertical.html
new file mode 100644
index 0000000..d8ae98d
--- /dev/null
+++ b/LayoutTests/fast/table/038-vertical.html
@@ -0,0 +1,12 @@
+The two rows below should look identical.  In both, the spanning cells in columns 2-3 should consume as
+much width as possible, while column 1 should be tiny.
+
+<table border=2 height=100% style="-webkit-writing-mode: vertical-rl;">
+        <tr>
+            <td>1<td colspan=2>2-3
+        </tr>
+        <tr>
+            <td>1</td>
+            <td colspan=2 height=100%>2-3</td>
+        </tr>
+    </table>
diff --git a/LayoutTests/fast/table/040-vertical.html b/LayoutTests/fast/table/040-vertical.html
new file mode 100644
index 0000000..188388c
--- /dev/null
+++ b/LayoutTests/fast/table/040-vertical.html
@@ -0,0 +1,108 @@
+
+<head>
+<style>
+.one {
+  background-color: cyan;
+}
+
+.two {
+  background-color: yellow;
+}
+
+.three {
+  background-color: lime;
+}
+
+.span {
+  background-color: pink;
+}
+
+td {
+  width: 20px;
+}
+
+table {
+  -webkit-writing-mode: vertical-rl;
+}
+</style>
+
+<script>
+function dumpHeights(table)
+{ 
+  var cell1 = document.getElementById(table + "-one");
+  var cell2 = document.getElementById(table + "-two");
+  document.write("<p>");
+  document.write("The table height is: " + document.getElementById(table).offsetHeight + "<br>");
+  document.write("Column One is: " + Math.round(100*cell1.offsetHeight/(cell1.offsetHeight+cell2.offsetHeight)) + "%");
+  document.write("<br>");
+  document.write("Column Two is: " + Math.round(100*cell2.offsetHeight/(cell1.offsetHeight+cell2.offsetHeight)) + "%");
+  document.write("</p><hr>");
+}
+</script>
+</head>
+
+<h1>Fixed Columns, Auto Span, Minheight Table</h1>
+
+<table height="1" id="one" cellpadding=0 cellspacing=0>
+<tr>
+<td height=100 id="one-one" class="one">
+<td height=200 id="one-two" class="two">
+</tr>
+<tr>
+<td colspan=2 class="span">
+<div style="height:100px"></div>
+</td>
+</tr>
+</table>
+
+<script>
+dumpHeights("one");
+</script>
+
+<table height="1" id="two" cellpadding=0 cellspacing=0>
+<tr>
+<td height=100 id="two-one" class="one">
+<td height=200 id="two-two" class="two">
+</tr>
+<tr>
+<td colspan=2 class="span">
+<div style="height:600px"></div>
+</td>
+</tr>
+</table>
+
+<script>
+dumpHeights("two");
+</script>
+
+<table height="1" id="three" cellpadding=0 cellspacing=0>
+<tr>
+<td height=100 id="three-one" class="one">Fixed cell in column one with some text.
+<td height=200 id="three-two" class="two">Fixed cell in column two with a lot more text. Will the ratios be preserved?
+</tr>
+<tr>
+<td colspan=2 class="span">
+<div style="height:600px"></div>
+</td>
+</tr>
+</table>
+
+<script>
+dumpHeights("three");
+</script>
+
+<table height="1" id="four" cellpadding=0 cellspacing=0>
+<tr>
+<td height=50 id="four-one" class="one"><div style="height:100px"></div>
+<td height=100 id="four-two" class="two"><div style="height:250px"></div>
+</tr>
+<tr>
+<td colspan=2 class="span">
+<div style="height:600px"></div>
+</td>
+</tr>
+</table>
+
+<script>
+dumpHeights("four");
+</script>
diff --git a/LayoutTests/fast/table/auto-with-percent-height-vertical.html b/LayoutTests/fast/table/auto-with-percent-height-vertical.html
new file mode 100644
index 0000000..d566d07
--- /dev/null
+++ b/LayoutTests/fast/table/auto-with-percent-height-vertical.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<style>
+.table {
+  background-color: purple;
+  color: white;
+  width: 100%;
+}
+
+.outer {
+  border: 3px solid red;
+  margin: 1em;
+  -webkit-writing-mode: vertical-rl;
+}
+</style>
+</head>
+<body>
+
+<table class=outer>
+  <tr><td><table class=table><tr><td>Table One</table><table class=table><tr><td>Table Two</table></td></tr>
+</table>
+
+<table class=outer>
+  <tr><td><div class=table>Div One</div><div class=table>Div Two</div>
+</table>
diff --git a/LayoutTests/fast/table/border-collapsing/001-vertical.html b/LayoutTests/fast/table/border-collapsing/001-vertical.html
new file mode 100644
index 0000000..2f655b0
--- /dev/null
+++ b/LayoutTests/fast/table/border-collapsing/001-vertical.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+
+<html style="-webkit-writing-mode: vertical-rl;">
+<div style="border:10px dotted blue;">
+<table style="border-collapse:collapse; border:2px solid red">
+<tr><td height=300 style="border:10px solid green">Hello
+<tr><td style="border:30px solid blue">Goodbye
+<tr><td style="border:50px solid red">Goodbye
+</table>
+</div>
+
+
+<div style="border:1px solid green; -webkit-margin-before:10em;">
+<table style="border-collapse:collapse;"><tr><td style="border:2px solid black">Test</td></tr></table>
+</div>
diff --git a/LayoutTests/fast/table/border-collapsing/002-vertical.html b/LayoutTests/fast/table/border-collapsing/002-vertical.html
new file mode 100644
index 0000000..08c0926
--- /dev/null
+++ b/LayoutTests/fast/table/border-collapsing/002-vertical.html
@@ -0,0 +1,100 @@
+<html>
+<head>
+<style>
+table          { border-collapse: collapse;
+                 border: 5px solid yellow; }
+.col1         { border: 3px solid black; }
+td             { border: 1px solid red; padding: 1em; }
+td.solid-blue  { border: 5px dashed blue; }
+td.solid-green { border: 5px solid green; }
+</style>
+</head>
+<body>
+<P>
+<TABLE style="-webkit-writing-mode: vertical-rl;">
+<COL class="col1"><COL><COL>
+<TR>
+    <TD> 1
+    <TD> 2
+    <TD> 3
+</TR>
+<TR>
+    <TD> 4 
+    <TD class="solid-blue"> 5
+    <TD class="solid-green"> 6
+</TR>
+<TR>
+    <TD> 7
+    <TD> 8
+    <TD> 9
+</TR>
+<TR>
+    <TD> 10
+    <TD> 11
+    <TD> 12
+</TR>
+<TR>
+    <TD> 13
+    <TD> 14
+    <TD> 15
+</TR>
+</table>
+<TABLE style="-webkit-writing-mode: vertical-lr;">
+<COL class="col1"><COL><COL>
+<TR>
+    <TD> 1
+    <TD> 2
+    <TD> 3
+</TR>
+<TR>
+    <TD> 4 
+    <TD class="solid-blue"> 5
+    <TD class="solid-green"> 6
+</TR>
+<TR>
+    <TD> 7
+    <TD> 8
+    <TD> 9
+</TR>
+<TR>
+    <TD> 10
+    <TD> 11
+    <TD> 12
+</TR>
+<TR>
+    <TD> 13
+    <TD> 14
+    <TD> 15
+</TR>
+</table>
+<TABLE style="-webkit-writing-mode: horizontal-bt;">
+<COL class="col1"><COL><COL>
+<TR>
+    <TD> 1
+    <TD> 2
+    <TD> 3
+</TR>
+<TR>
+    <TD> 4 
+    <TD class="solid-blue"> 5
+    <TD class="solid-green"> 6
+</TR>
+<TR>
+    <TD> 7
+    <TD> 8
+    <TD> 9
+</TR>
+<TR>
+    <TD> 10
+    <TD> 11
+    <TD> 12
+</TR>
+<TR>
+    <TD> 13
+    <TD> 14
+    <TD> 15
+</TR>
+</table>
+</p>
+</body>
+</html>
diff --git a/LayoutTests/fast/table/border-collapsing/003-vertical.html b/LayoutTests/fast/table/border-collapsing/003-vertical.html
new file mode 100644
index 0000000..d6bd86c
--- /dev/null
+++ b/LayoutTests/fast/table/border-collapsing/003-vertical.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html lang="en">
+ <head>
+  <title>Border Collapsing Test</title>
+  <style type="text/css">
+   .b { border: solid thin blue; padding-left: 3em; margin: 2em; }
+   .t { display: table; border-collapse: collapse; }
+   .r { display: table-row; }
+   .c { display: table-cell; border: solid 20px; height: 2em; width: 2em; }
+   .r.a > .c.a { border-width: 2px; }
+  </style>
+ </head>
+ <body style="-webkit-writing-mode: vertical-rl;">
+  <p>The black border below should <i>not</i> cut through the top left corner of
+  the blue border. It would cut through with our old behavior, but 
+  <a href="https://bugs.webkit.org/show_bug.cgi?id=6838">this</a>
+  bug fix changed our behavior to match the spec.</p>
+  <div class="b">
+   <div class="t">
+    <p class="r a"> <span class="c a"></span> <span class="c b"></span> </p>
+    <p class="r b"> <span class="c a"></span> <span class="c b"></span> </p>
+   </div>
+  </div>
+ </body>
+</html>
diff --git a/LayoutTests/fast/table/border-collapsing/004-vertical.html b/LayoutTests/fast/table/border-collapsing/004-vertical.html
new file mode 100644
index 0000000..870ebe7
--- /dev/null
+++ b/LayoutTests/fast/table/border-collapsing/004-vertical.html
@@ -0,0 +1,232 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head>
+<title>Table Border Models</title>
+<style type="text/css">
+TABLE   { margin: 1em; width: auto; border: medium solid blue; }
+TD  { border: thin solid green; padding: 5px; }
+TH { border: medium solid purple; padding: 5px; }
+TABLE.one, TABLE.two { border-spacing: 1em; }
+TABLE.one { border-collapse: collapse; }
+TABLE.two { border-collapse: separate; }
+TABLE.three { border-collapse: separate; border-spacing: 0 0.5em; }
+TABLE.four { border-collapse: separate; border-spacing: 0.5em 0; }
+TABLE.five { border-collapse: separate; }
+TABLE.five, TABLE.five TD, TABLE.five TH, TABLE.five CAPTION { border: none; }
+TABLE.five TR, TABLE.five COL, TABLE.five COLGROUP, TABLE.five TBODY, TABLE.five THEAD
+    { border: medium solid red; }
+</style>
+</head>
+<body>
+<h1>Table Border Models</h1>
+
+<p>This tests tests the <a
+href="http://www.w3.org/TR/REC-CSS2/tables.html#borders">CSS2 spec
+rules on table borders</a>.  The styles applied here are:</p>
+
+<pre>
+TABLE   { margin: 1em; border: medium solid blue; }
+TD  { border: thin solid green; padding: 5px; }
+TH { border: medium solid purple; padding: 5px; }
+TABLE.one, TABLE.two { border-spacing: 1em; }
+TABLE.one { border-collapse: collapse; }
+TABLE.two { border-collapse: separate; }
+TABLE.three { border-collapse: separate; border-spacing: 0 0.5em; }
+TABLE.four { border-collapse: separate; border-spacing: 0.5em 0; }
+TABLE.five { border-collapse: separate; }
+TABLE.five, TABLE.five TD, TABLE.five TH { border: none; }
+TABLE.five TR, TABLE.five COL, TABLE.five COLGROUP, TABLE.five TBODY, TABLE.five THEAD
+    { border: medium solid red; }
+</pre>
+<div style="-webkit-writing-mode: vertical-rl;">
+<table class="one">
+ <tr>
+  <th>Header One</th>
+  <th>Header Two</th>
+  <th>Header Three</th>
+ </tr>
+ <tr>
+  <td>
+   This table uses the collapsed borders model.
+  </td>
+  <td>
+   This means that elements within the cell have no border-spacing.
+  </td>
+  <td>
+   Since it has collapsed borders, the borders on the header cells,
+   on all sides, should be medium solid purple.
+  </td>
+ </tr>
+ <tr>
+  <td>
+   The border of the table itself should be medium solid blue, except
+   where header cells override the border.
+  </td>
+  <td>
+   The borders that I haven't already mentioned (all the other internal
+   ones) should be thin solid green.
+  </td>
+  <td>
+   This table should have a 1em margin around all edges.  This margin
+   is measured from the <em>middle</em> of its border.
+  </td>
+ </tr>
+</table>
+
+
+<table class="two">
+ <tr>
+  <th>Header One</th>
+  <th>Header Two</th>
+  <th>Header Three</th>
+ </tr>
+ <tr>
+  <td>
+   This table uses the separated borders model.
+  </td>
+  <td>
+   This means that elements within the cell have border-spacing of 1em.
+  </td>
+  <td>
+   The borders on the header cells,
+   on all sides, should be medium solid purple.
+  </td>
+ </tr>
+ <tr>
+  <td>
+   The border of the table itself should be medium solid blue.
+  </td>
+  <td>
+   The borders of other cells should be thin solid green.
+  </td>
+  <td>
+   This table should have a 1em margin around all edges.  This margin
+   is measured from the <em>outer edge</em> of its border.
+  </td>
+ </tr>
+</table>
+
+
+<table class="three">
+ <tr>
+  <th>Header One</th>
+  <th>Header Two</th>
+  <th>Header Three</th>
+ </tr>
+ <tr>
+  <td>
+   This table uses the separated borders model.
+  </td>
+  <td>
+   Elements within the cell have horizontal border-spacing (i.e., width of
+   vertical lines) of 0 and vertical
+   border-spacing (i.e., height of horizontal lines) of 0.5em.
+  </td>
+  <td>
+   The borders on the header cells,
+   on all sides, should be medium solid purple.
+  </td>
+ </tr>
+ <tr>
+  <td>
+   The border of the table itself should be medium solid blue.
+   The borders of other cells should be thin solid green.
+  </td>
+  <td>
+   This table should have a 1em margin around all edges.  This margin
+   is measured from the <em>outer edge</em> of its border.
+  </td>
+  <td>
+   The table should not be wider than the room available for it unless
+   that space is very small.  Because of its margins, the width of the
+   table should be less than 100%.
+  </td>
+ </tr>
+</table>
+
+
+<table class="four">
+ <tr>
+  <th>Header One</th>
+  <th>Header Two</th>
+  <th>Header Three</th>
+ </tr>
+ <tr>
+  <td>
+   This table uses the separated borders model.
+  </td>
+  <td>
+   Elements within the cell have horizontal border-spacing of 0.5em and vertical
+   border-spacing of 0.
+  </td>
+  <td>
+   The borders on the header cells,
+   on all sides, should be medium solid purple.
+  </td>
+ </tr>
+ <tr>
+  <td>
+   The border of the table itself should be medium solid blue.
+   The borders of other cells should be thin solid green.
+  </td>
+  <td>
+   This table should have a 1em margin around all edges.  This margin
+   is measured from the <em>outer edge</em> of its border.
+  </td>
+  <td>
+   The table should not be wider than the room available for it unless
+   that space is very small.  Because of its margins, the width of the
+   table should be less than 100%.
+  </td>
+ </tr>
+</table>
+
+
+<table class="five">
+<caption>
+ This is the caption.
+</caption>
+<colgroup>
+ <col>
+</colgroup>
+<colgroup>
+ <col>
+ <col>
+</colgroup>
+<thead>
+ <tr>
+  <th>Header One</th>
+  <th>Header Two</th>
+  <th>Header Three</th>
+ </tr>
+</thead>
+<tbody>
+ <tr>
+  <td>
+   This table uses the separated borders model.
+  </td>
+  <td>
+   This means that borders are allowed only on table elements or table
+   cell elements.
+  </td>
+  <td>
+   They are not allowed on elements that represent rows,
+   row-groups, columns, or column-groups.
+  </td>
+ </tr>
+ <tr>
+  <td>
+   There should be no borders at all on this table!
+  </td>
+  <td>
+   If there are any borders shown that are not medium solid red, then
+   the problem is something other than what this test is testing.
+  </td>
+  <td>
+   This table should have a 1em margin around all edges.  This margin
+   is measured from the <em>outer edge</em> of its border.
+  </td>
+ </tr>
+</tbody>
+</table>
+</div>
+</body></html>
diff --git a/LayoutTests/fast/table/border-collapsing/border-collapsing-head-foot-vertical.html b/LayoutTests/fast/table/border-collapsing/border-collapsing-head-foot-vertical.html
new file mode 100644
index 0000000..a14d63a
--- /dev/null
+++ b/LayoutTests/fast/table/border-collapsing/border-collapsing-head-foot-vertical.html
@@ -0,0 +1,305 @@
+<html>
+<head>
+    <title></title>
+    <style type="text/css">
+    
+        .test { width: 100px; }
+        .test table { border-collapse: collapse; margin: 10px; }
+        .test td, th { border: 1px lightgray solid; }
+        
+        .example1 tfoot { -webkit-border-before: 2px solid blue;
+            -webkit-border-after: 2px solid green;
+        }
+
+        .example2 thead { -webkit-border-before: 2px solid blue;
+            -webkit-border-after: 2px solid green;
+        }
+
+        table table { -webkit-writing-mode: vertical-rl; }
+    </style>
+</head>
+<body>
+    <p>
+        Test for <i><a href="https://bugs.webkit.org/show_bug.cgi?id=8848">http://bugzilla.opendarwin.org/show_bug.cgi?id=8848</a>
+        TFOOT borders are copied to THEAD and TBODY</i>.
+    </p>
+    <hr>
+    <table><tr><td class="test">
+        <table class="example1">
+            <thead>
+                <tr>
+                    <th>Header</th>
+                </tr>
+            </thead>
+            <tbody>
+                <tr>
+                    <td>Body 1</td>
+                </tr>
+            </tbody>
+            <tbody>
+                <tr>
+                    <td>Body 2</td>
+                </tr>
+            </tbody>
+            <tfoot>
+                <tr>
+                    <td>Footer</td>
+                </tr>
+            </tfoot>
+        </table>
+    
+        <table class="example1">
+            <tbody>
+                <tr>
+                    <td>Body 1</td>
+                </tr>
+            </tbody>
+            <thead>
+                <tr>
+                    <th>Header</th>
+                </tr>
+            </thead>
+            <tbody>
+                <tr>
+                    <td>Body 2</td>
+                </tr>
+            </tbody>
+            <tfoot>
+                <tr>
+                    <td>Footer</td>
+                </tr>
+            </tfoot>
+        </table>
+    
+        <table class="example1">
+            <tbody>
+                <tr>
+                    <td>Body 1</td>
+                </tr>
+            </tbody>
+            <thead>
+                <tr>
+                    <th>Header</th>
+                </tr>
+            </thead>
+            <tfoot>
+                <tr>
+                    <td>Footer</td>
+                </tr>
+            </tfoot>
+            <tbody>
+                <tr>
+                    <td>Body 2</td>
+                </tr>
+            </tbody>
+        </table>
+    </td><td class="test">
+        <table class="example1">
+            <tbody>
+                <tr>
+                    <td>Body 1</td>
+                </tr>
+            </tbody>
+            <tfoot>
+                <tr>
+                    <td>Footer</td>
+                </tr>
+            </tfoot>
+            <thead>
+                <tr>
+                    <th>Header</th>
+                </tr>
+            </thead>
+            <tbody>
+                <tr>
+                    <td>Body 2</td>
+                </tr>
+            </tbody>
+        </table>
+    
+        <table class="example1">
+            <tfoot>
+                <tr>
+                    <td>Footer</td>
+                </tr>
+            </tfoot>
+            <tbody>
+                <tr>
+                    <td>Body 1</td>
+                </tr>
+            </tbody>
+            <thead>
+                <tr>
+                    <th>Header</th>
+                </tr>
+            </thead>
+            <tbody>
+                <tr>
+                    <td>Body 2</td>
+                </tr>
+            </tbody>
+        </table>
+    
+        <table class="example1">
+            <tbody>
+                <tr>
+                    <td>Body 1</td>
+                </tr>
+            </tbody>
+            <tbody>
+                <tr>
+                    <td>Body 2</td>
+                </tr>
+            </tbody>
+            <tfoot>
+                <tr>
+                    <td>Footer</td>
+                </tr>
+            </tfoot>
+            <thead>
+                <tr>
+                    <th>Header</th>
+                </tr>
+            </thead>
+        </table>
+    </td>
+    <td class="test">
+        <table class="example2">
+            <thead>
+                <tr>
+                    <th>Header</th>
+                </tr>
+            </thead>
+            <tbody>
+                <tr>
+                    <td>Body 1</td>
+                </tr>
+            </tbody>
+            <tbody>
+                <tr>
+                    <td>Body 2</td>
+                </tr>
+            </tbody>
+            <tfoot>
+                <tr>
+                    <td>Footer</td>
+                </tr>
+            </tfoot>
+        </table>
+    
+        <table class="example2">
+            <tbody>
+                <tr>
+                    <td>Body 1</td>
+                </tr>
+            </tbody>
+            <thead>
+                <tr>
+                    <th>Header</th>
+                </tr>
+            </thead>
+            <tbody>
+                <tr>
+                    <td>Body 2</td>
+                </tr>
+            </tbody>
+            <tfoot>
+                <tr>
+                    <td>Footer</td>
+                </tr>
+            </tfoot>
+        </table>
+    
+        <table class="example2">
+            <tbody>
+                <tr>
+                    <td>Body 1</td>
+                </tr>
+            </tbody>
+            <thead>
+                <tr>
+                    <th>Header</th>
+                </tr>
+            </thead>
+            <tfoot>
+                <tr>
+                    <td>Footer</td>
+                </tr>
+            </tfoot>
+            <tbody>
+                <tr>
+                    <td>Body 2</td>
+                </tr>
+            </tbody>
+        </table>
+    </td><td class="test">
+        <table class="example2">
+            <tbody>
+                <tr>
+                    <td>Body 1</td>
+                </tr>
+            </tbody>
+            <tfoot>
+                <tr>
+                    <td>Footer</td>
+                </tr>
+            </tfoot>
+            <thead>
+                <tr>
+                    <th>Header</th>
+                </tr>
+            </thead>
+            <tbody>
+                <tr>
+                    <td>Body 2</td>
+                </tr>
+            </tbody>
+        </table>
+    
+        <table class="example2">
+            <tfoot>
+                <tr>
+                    <td>Footer</td>
+                </tr>
+            </tfoot>
+            <tbody>
+                <tr>
+                    <td>Body 1</td>
+                </tr>
+            </tbody>
+            <thead>
+                <tr>
+                    <th>Header</th>
+                </tr>
+            </thead>
+            <tbody>
+                <tr>
+                    <td>Body 2</td>
+                </tr>
+            </tbody>
+        </table>
+    
+        <table class="example2">
+            <tbody>
+                <tr>
+                    <td>Body 1</td>
+                </tr>
+            </tbody>
+            <tbody>
+                <tr>
+                    <td>Body 2</td>
+                </tr>
+            </tbody>
+            <tfoot>
+                <tr>
+                    <td>Footer</td>
+                </tr>
+            </tfoot>
+            <thead>
+                <tr>
+                    <th>Header</th>
+                </tr>
+            </thead>
+        </table>
+    </td></tr></table>
+</body>
diff --git a/LayoutTests/fast/table/border-collapsing/equal-precedence-resolution-vertical.html b/LayoutTests/fast/table/border-collapsing/equal-precedence-resolution-vertical.html
new file mode 100644
index 0000000..3ed6d91
--- /dev/null
+++ b/LayoutTests/fast/table/border-collapsing/equal-precedence-resolution-vertical.html
@@ -0,0 +1,160 @@
+<style>
+    table { border-collapse: collapse; }
+    td { width: 25px; height: 25px; }
+</style>
+<div style="-webkit-writing-mode: vertical-rl; height: 200px; border: solid;">
+<table>
+    <colgroup span="2"><colgroup span="1" style="-webkit-border-end: 5px solid rgba(0, 127, 0, 0.5);"><colgroup span="1" style="-webkit-border-start: 5px solid red">
+    <tr>
+        <td style="-webkit-border-end: 5px solid rgba(0, 127, 0, 0.5); -webkit-border-after: 5px solid rgba(0, 127, 0, 0.5);"></td>
+        <td style="-webkit-border-start: 5px solid red;"></td>
+        <td></td>
+        <td></td>
+    </tr>
+    <tr>
+        <td style="-webkit-border-before: 5px solid red;"></td>
+        <td></td>
+        <td></td>
+        <td></td>
+    </tr>
+</table>
+<table style="direction: rtl;">
+    <colgroup span="2"><colgroup span="1" style="-webkit-border-end: 5px solid rgba(0, 127, 0, 0.5);"><colgroup span="1" style="-webkit-border-start: 5px solid red">
+    <tr>
+        <td style="-webkit-border-end: 5px solid rgba(0, 127, 0, 0.5); -webkit-border-after: 5px solid rgba(0, 127, 0, 0.5);"></td>
+        <td style="-webkit-border-start: 5px solid red;"></td>
+        <td></td>
+        <td></td>
+    </tr>
+    <tr>
+        <td style="-webkit-border-before: 5px solid red;"></td>
+        <td></td>
+        <td></td>
+        <td></td>
+    </tr>
+</table>
+<table>
+    <tr style="-webkit-border-after: 5px solid rgba(0, 127, 0, 0.5);">
+        <td></td>
+    </tr>
+    <tr style="-webkit-border-before: 5px solid red;">
+        <td></td>
+    </tr>
+</table>
+<table>
+    <tbody style="-webkit-border-after: 5px solid rgba(0, 127, 0, 0.5);">
+        <tr>
+            <td></td>
+        </tr>
+    </tbody>
+    <tbody style="-webkit-border-before: 5px solid red;">
+        <tr>
+            <td></td>
+        </tr>
+    </tbody>
+</table>
+</div>
+<div style="-webkit-writing-mode: horizontal-bt; width: 200px; border: solid;">
+<table>
+    <colgroup span="2"><colgroup span="1" style="-webkit-border-end: 5px solid rgba(0, 127, 0, 0.5);"><colgroup span="1" style="-webkit-border-start: 5px solid red">
+    <tr>
+        <td style="-webkit-border-end: 5px solid rgba(0, 127, 0, 0.5); -webkit-border-after: 5px solid rgba(0, 127, 0, 0.5);"></td>
+        <td style="-webkit-border-start: 5px solid red;"></td>
+        <td></td>
+        <td></td>
+    </tr>
+    <tr>
+        <td style="-webkit-border-before: 5px solid red;"></td>
+        <td></td>
+        <td></td>
+        <td></td>
+    </tr>
+</table>
+<table style="direction: rtl;">
+    <colgroup span="2"><colgroup span="1" style="-webkit-border-end: 5px solid rgba(0, 127, 0, 0.5);"><colgroup span="1" style="-webkit-border-start: 5px solid red">
+    <tr>
+        <td style="-webkit-border-end: 5px solid rgba(0, 127, 0, 0.5); -webkit-border-after: 5px solid rgba(0, 127, 0, 0.5);"></td>
+        <td style="-webkit-border-start: 5px solid red;"></td>
+        <td></td>
+        <td></td>
+    </tr>
+    <tr>
+        <td style="-webkit-border-before: 5px solid red;"></td>
+        <td></td>
+        <td></td>
+        <td></td>
+    </tr>
+</table>
+<table>
+    <tr style="-webkit-border-after: 5px solid rgba(0, 127, 0, 0.5);">
+        <td></td>
+    </tr>
+    <tr style="-webkit-border-before: 5px solid red;">
+        <td></td>
+    </tr>
+</table>
+<table>
+    <tbody style="-webkit-border-after: 5px solid rgba(0, 127, 0, 0.5);">
+        <tr>
+            <td></td>
+        </tr>
+    </tbody>
+    <tbody style="-webkit-border-before: 5px solid red;">
+        <tr>
+            <td></td>
+        </tr>
+    </tbody>
+</table>
+</div>
+<div style="-webkit-writing-mode: vertical-lr; height: 200px; border: solid;">
+<table>
+    <colgroup span="2"><colgroup span="1" style="-webkit-border-end: 5px solid rgba(0, 127, 0, 0.5);"><colgroup span="1" style="-webkit-border-start: 5px solid red">
+    <tr>
+        <td style="-webkit-border-end: 5px solid rgba(0, 127, 0, 0.5); -webkit-border-after: 5px solid rgba(0, 127, 0, 0.5);"></td>
+        <td style="-webkit-border-start: 5px solid red;"></td>
+        <td></td>
+        <td></td>
+    </tr>
+    <tr>
+        <td style="-webkit-border-before: 5px solid red;"></td>
+        <td></td>
+        <td></td>
+        <td></td>
+    </tr>
+</table>
+<table style="direction: rtl;">
+    <colgroup span="2"><colgroup span="1" style="-webkit-border-end: 5px solid rgba(0, 127, 0, 0.5);"><colgroup span="1" style="-webkit-border-start: 5px solid red">
+    <tr>
+        <td style="-webkit-border-end: 5px solid rgba(0, 127, 0, 0.5); -webkit-border-after: 5px solid rgba(0, 127, 0, 0.5);"></td>
+        <td style="-webkit-border-start: 5px solid red;"></td>
+        <td></td>
+        <td></td>
+    </tr>
+    <tr>
+        <td style="-webkit-border-before: 5px solid red;"></td>
+        <td></td>
+        <td></td>
+        <td></td>
+    </tr>
+</table>
+<table>
+    <tr style="-webkit-border-after: 5px solid rgba(0, 127, 0, 0.5);">
+        <td></td>
+    </tr>
+    <tr style="-webkit-border-before: 5px solid red;">
+        <td></td>
+    </tr>
+</table>
+<table>
+    <tbody style="-webkit-border-after: 5px solid rgba(0, 127, 0, 0.5);">
+        <tr>
+            <td></td>
+        </tr>
+    </tbody>
+    <tbody style="-webkit-border-before: 5px solid red;">
+        <tr>
+            <td></td>
+        </tr>
+    </tbody>
+</table>
+</div>
diff --git a/LayoutTests/fast/table/border-collapsing/rtl-border-collapsing-vertical.html b/LayoutTests/fast/table/border-collapsing/rtl-border-collapsing-vertical.html
new file mode 100644
index 0000000..101790f
--- /dev/null
+++ b/LayoutTests/fast/table/border-collapsing/rtl-border-collapsing-vertical.html
@@ -0,0 +1,59 @@
+<p>
+This tests for a regression against
+<i><a href="https://bugs.webkit.org/show_bug.cgi?id=6888">http://bugzilla.opendarwin.org/show_bug.cgi?id=6888</a>
+Collapsed borders appear on the wrong side or on the wrong cell in RTL tables</i>.
+</p>
+<p>
+The RTL table should be a mirror image of the LTR table.
+</p>
+<hr>
+<table cellpadding="4" cellspacing="0" style="text-align: center; -webkit-writing-mode: vertical-rl;">
+<tr>
+<td style="-webkit-border-end: 1px solid black;">RTL</td>
+<td>LTR</td>
+</tr>
+<tr>
+<td style="-webkit-border-end: 1px solid black;">
+    <table style="direction:rtl; border-collapse: collapse; -webkit-border-start: 2px solid red; -webkit-border-end: 2px solid blue;">
+        <col>
+        <col>
+        <col style="background: yellow; -webkit-border-end: 2px green dotted; -webkit-border-start: solid 1px;">
+        <col style="background: silver;">
+        <tr>
+            <td>&nbsp;&nbsp;</td>
+            <td>&nbsp;&nbsp;</td>
+            <td colspan="2" style="">&nbsp;&nbsp;</td>
+            <td>&nbsp;&nbsp;</td>
+        </tr>
+        <tr>
+            <td style="-webkit-border-end: 4px solid maroon;">&nbsp;&nbsp;</td>
+            <td>&nbsp;&nbsp;</td>
+            <td>&nbsp;&nbsp;</td>
+            <td>&nbsp;&nbsp;</td>
+            <td>&nbsp;&nbsp;</td>
+        </tr>
+    </table>
+</td>
+<td>    
+    <table style="direction:ltr; border-collapse: collapse; -webkit-border-start: 2px solid red; -webkit-border-end: 2px solid blue;">
+        <col>
+        <col>
+        <col style="background: yellow; -webkit-border-end: 2px green dotted; -webkit-border-start: solid 1px;">
+        <col style="background: silver;">
+        <tr>
+            <td>&nbsp;&nbsp;</td>
+            <td>&nbsp;&nbsp;</td>
+            <td colspan="2" style="">&nbsp;&nbsp;</td>
+            <td>&nbsp;&nbsp;</td>
+        </tr>
+        <tr>
+            <td style="-webkit-border-end: 4px solid maroon;">&nbsp;&nbsp;</td>
+            <td>&nbsp;&nbsp;</td>
+            <td>&nbsp;&nbsp;</td>
+            <td>&nbsp;&nbsp;</td>
+            <td>&nbsp;&nbsp;</td>
+        </tr>
+    </table>
+</td>
+</tr>
+</table>
diff --git a/LayoutTests/fast/table/colspanMinWidth-vertical.html b/LayoutTests/fast/table/colspanMinWidth-vertical.html
new file mode 100644
index 0000000..4f81fe7
--- /dev/null
+++ b/LayoutTests/fast/table/colspanMinWidth-vertical.html
@@ -0,0 +1,27 @@
+<html>
+<body>
+<table style="-webkit-writing-mode: vertical-rl;">
+<tr>
+<td id="A" height='1' style="background:blue"></td>
+</tr>
+<tr>
+<td id="B" colspan='2' rowspan='2' style="background:green"></td>
+</tr>
+<tr>
+<td id="C" rowspan='2' style="background:red"></td>
+</tr>
+<tr>
+<td id="D" colspan='2' style="background:cyan">
+<table>
+<tr>
+<td id="E" style="background:magenta"></td>
+<td id="F" style="background:yellow">
+<input type='text' />
+</td>
+</tr>
+</table>
+</td>
+</tr>
+</table>
+</body>
+</html>
diff --git a/LayoutTests/fast/table/fixed-with-auto-with-colspan-vertical.html b/LayoutTests/fast/table/fixed-with-auto-with-colspan-vertical.html
new file mode 100644
index 0000000..be67a15
--- /dev/null
+++ b/LayoutTests/fast/table/fixed-with-auto-with-colspan-vertical.html
@@ -0,0 +1,69 @@
+<style>
+    table { border-spacing: 5px 0; table-layout: fixed; height: 445px; -webkit-margin-before: 5px; }
+    td { width: 50px; }
+    #ref td { background-color: red; }
+    #test td { background-color: green; }
+</style>
+<div id="ref" style="position: absolute; top: 0; left: 0; -webkit-writing-mode: vertical-rl;">
+    <table><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
+    <table><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
+    <table><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
+    <table><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
+    <table><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
+    <table><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
+    <table><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
+</div>
+<div id="test" style="position: absolute; top: 0; left: 0; -webkit-writing-mode: vertical-rl;">
+    <table>
+        <tr>
+            <td></td>
+            <td></td>
+            <td></td>
+            <td></td>
+            <td></td>
+            <td></td>
+            <td></td>
+            <td></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td colspan="3"></td>
+            <td colspan="5"></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td colspan="2"></td>
+            <td></td>
+            <td colspan="5"></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td colspan="2"></td>
+            <td colspan="6"></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td></td>
+            <td colspan="7"></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td></td>
+            <td colspan="2"></td>
+            <td colspan="5"></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td colspan="2"></td>
+            <td colspan="4"></td>
+            <td></td>
+            <td></td>
+        </tr>
+    </table>
+</div>
diff --git a/LayoutTests/fast/table/growCellForImageQuirk-vertical.html b/LayoutTests/fast/table/growCellForImageQuirk-vertical.html
new file mode 100644
index 0000000..de474e4
--- /dev/null
+++ b/LayoutTests/fast/table/growCellForImageQuirk-vertical.html
@@ -0,0 +1,10 @@
+<style>
+    img { background-color: lightblue; height: 75px; width: 50px; }
+</style>
+<TABLE style="height: 155px; background: silver; -webkit-writing-mode: vertical-rl;">
+    <TR> 
+        <TD>
+            <IMG><IMG>
+        </TD>
+    </TR>
+</TABLE>
diff --git a/LayoutTests/fast/table/height-percent-test-vertical.html b/LayoutTests/fast/table/height-percent-test-vertical.html
new file mode 100644
index 0000000..ba670ca
--- /dev/null
+++ b/LayoutTests/fast/table/height-percent-test-vertical.html
@@ -0,0 +1,18 @@
+<div style="-webkit-writing-mode: vertical-rl;">
+<div style="margin: 1em; width: 24px; border: 1px solid black;"><div style="float:left">
+<div style="height: 100px; background-color:green; width:100%"></div>
+
+</div></div>
+
+<div style="margin: 1em; width: 24px; border: 1px solid black;"><div style="float:left">
+<table bgcolor=red width=100% cellpadding=0 cellspacing=0><tr><td><img border=0 width=22 height=96 style="background-color:green"></td></tr></table>
+</div></div>
+
+<div style="margin: 1em; border: 1px solid black;"><div>
+<div style="height: 100px; background-color:green; width:100%"></div>
+</div></div>
+
+<div style="margin: 1em; border: 1px solid black;"><div>
+<table bgcolor=red width=100% cellpadding=0 cellspacing=0><tr><td><img border=0 width=22 height=96 style="background-color:green"></td></tr></table>
+</div></div>
+</div>
diff --git a/LayoutTests/fast/table/percent-widths-stretch-vertical.html b/LayoutTests/fast/table/percent-widths-stretch-vertical.html
new file mode 100644
index 0000000..f509af5
--- /dev/null
+++ b/LayoutTests/fast/table/percent-widths-stretch-vertical.html
@@ -0,0 +1,112 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+    <style>
+        table { border-collapse: collapse; }
+        td { background-color: green; padding: 0; }
+        div { background-color: orange; width: 4px; height: 1px; }
+    </style>
+<head>
+<body style="-webkit-writing-mode: vertical-rl;">
+    <table>
+        <tr>
+            <td height="1%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="2%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="3%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="4%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="5%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="10%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="20%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="30%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="40%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="50%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="60%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="70%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="80%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="90%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="95%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="96%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="97%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="98%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="99%"><div></div></td>
+        </tr>
+    </table>
+    <table>
+        <tr>
+            <td height="100%"><div></div></td>
+        </tr>
+    </table>
+</body>
+</html>
diff --git a/LayoutTests/fast/table/rowspan-paint-order-vertical.html b/LayoutTests/fast/table/rowspan-paint-order-vertical.html
new file mode 100644
index 0000000..7c6c1a3
--- /dev/null
+++ b/LayoutTests/fast/table/rowspan-paint-order-vertical.html
@@ -0,0 +1,30 @@
+<html>
+<body>
+
+<table height="580" width="100" border="2" cellspacing="0" cellpadding="0" style="-webkit-writing-mode: vertical-rl;">
+
+<tr >
+<td bgcolor=#aaaaaa rowspan="3" >Left (3 rows)</td>
+<td rowspan="2" height="50%"   bgcolor="#000000">&nbsp;</td>
+<td colspan="10" align="center" nowrap valign="top" width="22" >Middle (1 row)</td>
+<td rowspan="2" height="50%"  bgcolor="#000000">&nbsp;</td>
+<td rowspan="3" bgcolor=#aaaaaa align="right" >Right (3 rows)
+</td>
+</tr>
+<!-- begin SF.net main navbar -->
+<tr> <td bgcolor="#eeeeee" align="left" valign="middle">&nbsp;</td>
+ <td bgcolor="#eeeeee" align="left" valign="middle">&nbsp;</td>
+ <td bgcolor="#eeeeee" align="left" valign="middle">&nbsp;</td>
+ <td bgcolor="#eeeeee" align="left" valign="middle">&nbsp;</td>
+ <td bgcolor="#eeeeee" align="left" valign="middle">&nbsp;</td>
+ <td bgcolor="#eeeeee" align="left" valign="middle">&nbsp;</td>
+ <td bgcolor="#eeeeee" align="left" valign="middle">&nbsp;</td>
+ <td bgcolor="#eeeeee" align="left" valign="middle">&nbsp;</td>
+ <td bgcolor="#eeeeee" align="left" valign="middle">&nbsp;</td>
+
+</tr>
+<tr>
+<td  colspan="13" bgcolor="green" align="right">Bottom Row Overlaps with the Right Cell!</td>
+</tr>
+</table>
+<!-- end SF.net header -->
\ No newline at end of file
diff --git a/LayoutTests/fast/table/table-display-types-vertical.html b/LayoutTests/fast/table/table-display-types-vertical.html
new file mode 100644
index 0000000..b0e850e
--- /dev/null
+++ b/LayoutTests/fast/table/table-display-types-vertical.html
@@ -0,0 +1,79 @@
+<html>
+<head>
+  <style type="text/css" media="screen">
+    table {
+      border: 1px solid black;
+      display: block;
+      margin: 10px;
+      -webkit-writing-mode: vertical-rl;
+    }
+    
+    .test tr, .test thead, .test tfoot {
+      display: table-cell;
+    }
+    
+    .test td {
+      display: inline;
+    }
+
+    .test2 tr, .test2 thead, .test2 tfoot {
+      display: block;
+    }
+    
+    .para {
+      height: 300px;
+      width: 100px;
+      border: 1px solid black;
+      display: table-cell;
+      -webkit-writing-mode: vertical-rl;
+    }
+  </style>
+</head>
+<body>
+  
+  <table>
+    <thead>
+      <tr><td>Head 1</td><td>Head 2</td></tr>
+    </thead>
+    <tfoot>
+      <tr><td>Footer 1</td><td>Footer 2</td></tr>
+    </tfoot>
+    <tbody>
+      <tr><td>Cell 1</td><td>Cell 2</td></tr>
+      <tr><td>Cell 3</td><td>Cell 4</td></tr>
+    </tbody>
+  </table>
+
+  <p>Row groups have display:table-cell</p>
+  <table class="test">
+    <thead>
+      <tr><td>Head 1</td><td>Head 2</td></tr>
+    </thead>
+    <tfoot>
+      <tr><td>Footer 1</td><td>Footer 2</td></tr>
+    </tfoot>
+    <tbody>
+      <tr><td>Cell 1</td><td>Cell 2</td></tr>
+      <tr><td>Cell 3</td><td>Cell 4</td></tr>
+    </tbody>
+  </table>
+
+  <p>Row groups have display:block</p>
+  <table class="test2">
+    <thead>
+      <tr><td>Head 1</td><td>Head 2</td></tr>
+    </thead>
+    <tfoot>
+      <tr><td>Footer 1</td><td>Footer 2</td></tr>
+    </tfoot>
+    <tbody>
+      <tr><td>Cell 1</td><td>Cell 2</td></tr>
+      <tr><td>Cell 3</td><td>Cell 4</td></tr>
+    </tbody>
+  </table>
+
+  <p class="para">
+    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+    </p>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/027-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/027-vertical-expected.checksum
new file mode 100644
index 0000000..160ebe9
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/027-vertical-expected.checksum
@@ -0,0 +1 @@
+a4088286d6806131d492e2eeb49a9182
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/027-vertical-expected.png b/LayoutTests/platform/mac/fast/table/027-vertical-expected.png
new file mode 100644
index 0000000..903fa13
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/027-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/027-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/027-vertical-expected.txt
new file mode 100644
index 0000000..3ff78c3
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/027-vertical-expected.txt
@@ -0,0 +1,73 @@
+layer at (0,0) size 785x801
+  RenderView at (0,0) size 785x600
+layer at (0,0) size 785x801
+  RenderBlock {HTML} at (0,0) size 785x801
+    RenderBody {BODY} at (8,8) size 769x785
+      RenderTable {TABLE} at (0,0) size 338x785
+        RenderTableSection {TBODY} at (0,0) size 338x785
+          RenderTableRow {TR} at (0,0) size 26x785
+            RenderTableCell {TD} at (0,0) size 26x785 [border: (1px solid #008000)] [r=0 c=0 rs=1 cs=3]
+              RenderText {#text} at (4,4) size 18x236
+                text run at (4,4) width 144: "   Join Now   Sign In   "
+                text run at (4,148) width 92: "   Personalize: "
+              RenderInline {A} at (0,0) size 18x50
+                RenderText {#text} at (4,240) size 18x50
+                  text run at (4,240) width 50: "Settings"
+              RenderText {#text} at (4,290) size 18x14
+                text run at (4,290) width 14: " \x{2022} "
+              RenderInline {A} at (0,0) size 18x50
+                RenderText {#text} at (4,304) size 18x50
+                  text run at (4,304) width 50: "Content"
+              RenderText {#text} at (4,354) size 18x14
+                text run at (4,354) width 14: " \x{2022} "
+              RenderInline {A} at (0,0) size 18x45
+                RenderText {#text} at (4,368) size 18x45
+                  text run at (4,368) width 45: "Layout"
+              RenderText {#text} at (4,413) size 18x14
+                text run at (4,413) width 14: " \x{2022} "
+              RenderInline {A} at (0,0) size 18x112
+                RenderText {#text} at (4,427) size 18x112
+                  text run at (4,427) width 112: "Colors & Themes"
+              RenderText {#text} at (4,539) size 18x14
+                text run at (4,539) width 14: " \x{2022} "
+              RenderInline {A} at (0,0) size 18x46
+                RenderText {#text} at (4,553) size 18x46
+                  text run at (4,553) width 46: "Sign In"
+              RenderText {#text} at (4,599) size 18x182
+                text run at (4,599) width 8: "  "
+                text run at (4,607) width 90: "   My Links:   "
+                text run at (4,697) width 84: "  Lite \x{2022} Email"
+          RenderTableRow {TR} at (0,26) size 312x785
+            RenderTableCell {TD} at (26,152) size 312x-296 [border: (1px solid #008000)] [r=1 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (26,8) size 312x557 [border: (1px solid #008000)] [r=1 c=1 rs=1 cs=1]
+              RenderTable {TABLE} at (4,4) size 304x549
+                RenderTableSection {TBODY} at (0,0) size 304x549
+                  RenderTableRow {TR} at (0,2) size 300x549
+                    RenderTableCell {TD} at (2,2) size 300x545 [border: (1px solid #008000)] [r=0 c=0 rs=1 cs=1]
+                      RenderTable {TABLE} at (2,2) size 296x541
+                        RenderTableSection {TBODY} at (0,0) size 296x541
+                          RenderTableRow {TR} at (0,2) size 292x541
+                            RenderTableCell {TD} at (2,146) size 292x-57 [border: (1px solid #008000)] [r=0 c=0 rs=1 cs=1]
+                            RenderTableCell {TD} at (2,235) size 292x71 [border: (1px solid #008000)] [r=0 c=1 rs=1 cs=1]
+                              RenderText {#text} at (2,2) size 288x67
+                                text run at (2,2) width 56: "This guy"
+                                text run at (20,2) width 42: "should"
+                                text run at (38,2) width 53: "have the"
+                                text run at (56,2) width 59: "really big"
+                                text run at (74,2) width 67: "maxwidth."
+                                text run at (92,2) width 13: "It "
+                                text run at (92,15) width 42: "should"
+                                text run at (110,2) width 39: "be big"
+                                text run at (128,2) width 63: "enough to"
+                                text run at (146,2) width 35: "really"
+                                text run at (164,2) width 35: "really"
+                                text run at (182,2) width 37: "screw"
+                                text run at (200,2) width 62: "things up."
+                                text run at (218,2) width 43: "That is"
+                                text run at (236,2) width 40: "what I"
+                                text run at (254,2) width 60: "think will"
+                                text run at (272,2) width 37: "work."
+                            RenderTableCell {TD} at (2,452) size 292x-57 [border: (1px solid #008000)] [r=0 c=2 rs=1 cs=1]
+            RenderTableCell {TD} at (26,708) size 312x-66 [border: (1px solid #008000)] [r=1 c=2 rs=1 cs=1]
+              RenderImage {IMG} at (147,-139) size 18x212
+              RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/table/028-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/028-vertical-expected.checksum
new file mode 100644
index 0000000..72c8615
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/028-vertical-expected.checksum
@@ -0,0 +1 @@
+7744d6e3bc5f3d7bd6e6a0f05270e8b2
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/028-vertical-expected.png b/LayoutTests/platform/mac/fast/table/028-vertical-expected.png
new file mode 100644
index 0000000..f6aa89e
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/028-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/028-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/028-vertical-expected.txt
new file mode 100644
index 0000000..337ce48
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/028-vertical-expected.txt
@@ -0,0 +1,33 @@
+layer at (0,0) size 785x634
+  RenderView at (0,0) size 785x600
+layer at (0,0) size 785x634
+  RenderBlock {HTML} at (0,0) size 785x634
+    RenderBody {BODY} at (8,8) size 769x618
+      RenderBlock (anonymous) at (0,0) size 769x18
+        RenderText {#text} at (0,0) size 277x18
+          text run at (0,0) width 277: "These two tables should be the same height."
+      RenderBlock {DIV} at (0,18) size 62x600
+        RenderTable {TABLE} at (0,0) size 22x320
+          RenderTableSection {TBODY} at (0,0) size 22x320
+            RenderTableRow {TR} at (0,0) size 22x320
+              RenderTableCell {TD} at (0,0) size 22x68 [border: (1px solid #008000)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (1,1) size 18x8
+                  text run at (1,1) width 8: "1"
+              RenderTableCell {TD} at (0,70) size 22x242 [border: (1px solid #008000)] [r=0 c=1 rs=1 cs=1]
+                RenderText {#text} at (1,1) size 18x8
+                  text run at (1,1) width 8: "2"
+              RenderTableCell {TD} at (0,314) size 22x6 [border: (1px solid #008000)] [r=0 c=2 rs=1 cs=1]
+                RenderImage {IMG} at (1,1) size 20x4 [bgcolor=#FFA500]
+        RenderBlock {P} at (22,16) size 0x568
+        RenderTable {TABLE} at (22,0) size 40x320
+          RenderTableSection {TBODY} at (0,0) size 40x320
+            RenderTableRow {TR} at (0,0) size 20x320
+              RenderTableCell {TD} at (0,0) size 20x64 [border: (1px solid #008000)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (1,1) size 18x8
+                  text run at (1,1) width 8: "1"
+              RenderTableCell {TD} at (0,68) size 20x248 [border: (1px solid #008000)] [r=0 c=1 rs=1 cs=1]
+                RenderImage {IMG} at (5,-3) size 10x254 [bgcolor=#FFA500]
+            RenderTableRow {TR} at (0,20) size 20x320
+              RenderTableCell {TD} at (20,0) size 20x320 [border: (1px solid #008000)] [r=1 c=0 rs=1 cs=3]
+                RenderText {#text} at (1,1) size 18x8
+                  text run at (1,1) width 8: "1"
diff --git a/LayoutTests/platform/mac/fast/table/035-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/035-vertical-expected.checksum
new file mode 100644
index 0000000..1f410c2
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/035-vertical-expected.checksum
@@ -0,0 +1 @@
+175ddb1a74978dc81543833ebb1df022
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/035-vertical-expected.png b/LayoutTests/platform/mac/fast/table/035-vertical-expected.png
new file mode 100644
index 0000000..20c3a8d
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/035-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/035-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/035-vertical-expected.txt
new file mode 100644
index 0000000..0b90905
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/035-vertical-expected.txt
@@ -0,0 +1,26 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (686,0) size 114x600
+  RenderBlock {HTML} at (0,0) size 114x600
+    RenderBody {BODY} at (8,8) size 98x584
+      RenderBlock (anonymous) at (0,0) size 18x584
+        RenderText {#text} at (0,0) size 18x404
+          text run at (0,0) width 404: "This test should have two centered tables and two centered divs."
+      RenderTable {TABLE} at (18,199) size 22x186 [border: (1px outset #808080)]
+        RenderTableSection {TBODY} at (1,1) size 20x184
+          RenderTableRow {TR} at (0,0) size 20x184
+            RenderTableCell {TD} at (0,0) size 20x184 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              RenderText {#text} at (1,1) size 18x182
+                text run at (1,1) width 182: "This table is aligned \"center\""
+      RenderTable {TABLE} at (40,186) size 22x212 [border: (1px outset #808080)]
+        RenderTableSection {TBODY} at (1,1) size 20x210
+          RenderTableRow {TR} at (0,0) size 20x210
+            RenderTableCell {TD} at (0,0) size 20x210 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              RenderText {#text} at (1,1) size 18x208
+                text run at (1,1) width 208: "This table is aligned \"CENTER\""
+      RenderBlock {DIV} at (62,0) size 18x584
+        RenderText {#text} at (0,206) size 18x172
+          text run at (0,206) width 172: "This div is aligned \"center\""
+      RenderBlock {DIV} at (80,0) size 18x584
+        RenderText {#text} at (0,193) size 18x198
+          text run at (0,193) width 198: "This div is aligned \"CENTER\""
diff --git a/LayoutTests/platform/mac/fast/table/038-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/038-vertical-expected.checksum
new file mode 100644
index 0000000..ed075af
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/038-vertical-expected.checksum
@@ -0,0 +1 @@
+34cfb892dba7000af335595c9751adba
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/038-vertical-expected.png b/LayoutTests/platform/mac/fast/table/038-vertical-expected.png
new file mode 100644
index 0000000..2a20cac
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/038-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/038-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/038-vertical-expected.txt
new file mode 100644
index 0000000..ab898e8
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/038-vertical-expected.txt
@@ -0,0 +1,26 @@
+layer at (0,0) size 785x652
+  RenderView at (0,0) size 785x600
+layer at (0,0) size 785x652
+  RenderBlock {HTML} at (0,0) size 785x652
+    RenderBody {BODY} at (8,8) size 769x636
+      RenderBlock (anonymous) at (0,0) size 769x36
+        RenderText {#text} at (0,0) size 756x36
+          text run at (0,0) width 274: "The two rows below should look identical. "
+          text run at (274,0) width 482: "In both, the spanning cells in columns 2-3 should consume as much width as"
+          text run at (0,18) width 254: "possible, while column 1 should be tiny."
+      RenderTable {TABLE} at (0,36) size 54x600 [border: (2px outset #808080)]
+        RenderTableSection {TBODY} at (2,2) size 50x596
+          RenderTableRow {TR} at (0,2) size 22x596
+            RenderTableCell {TD} at (2,2) size 22x12 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              RenderText {#text} at (2,2) size 18x8
+                text run at (2,2) width 8: "1"
+            RenderTableCell {TD} at (2,16) size 22x578 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=2]
+              RenderText {#text} at (2,2) size 18x21
+                text run at (2,2) width 21: "2-3"
+          RenderTableRow {TR} at (0,26) size 22x596
+            RenderTableCell {TD} at (26,2) size 22x12 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+              RenderText {#text} at (2,2) size 18x8
+                text run at (2,2) width 8: "1"
+            RenderTableCell {TD} at (26,16) size 22x578 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=2]
+              RenderText {#text} at (2,2) size 18x21
+                text run at (2,2) width 21: "2-3"
diff --git a/LayoutTests/platform/mac/fast/table/040-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/040-vertical-expected.checksum
new file mode 100644
index 0000000..299eca7
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/040-vertical-expected.checksum
@@ -0,0 +1 @@
+2b8572c2deab76be4d5922857a775fd9
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/040-vertical-expected.png b/LayoutTests/platform/mac/fast/table/040-vertical-expected.png
new file mode 100644
index 0000000..e4a45c3
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/040-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/040-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/040-vertical-expected.txt
new file mode 100644
index 0000000..87ab62b
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/040-vertical-expected.txt
@@ -0,0 +1,88 @@
+layer at (0,0) size 785x2350
+  RenderView at (0,0) size 785x600
+layer at (0,0) size 785x2350
+  RenderBlock {HTML} at (0,0) size 785x2350
+    RenderBody {BODY} at (8,8) size 769x2334
+      RenderBlock {H1} at (0,0) size 769x37
+        RenderText {#text} at (0,0) size 615x37
+          text run at (0,0) width 615: "Fixed Columns, Auto Span, Minheight Table"
+      RenderTable {TABLE} at (0,58) size 40x100
+        RenderTableSection {TBODY} at (0,0) size 40x100
+          RenderTableRow {TR} at (0,0) size 20x100
+            RenderTableCell {TD} at (0,10) size 20x13 [bgcolor=#00FFFF] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (0,43) size 20x47 [bgcolor=#FFFF00] [r=0 c=1 rs=1 cs=1]
+          RenderTableRow {TR} at (0,20) size 20x100
+            RenderTableCell {TD} at (20,10) size 20x80 [bgcolor=#FFC0CB] [r=1 c=0 rs=1 cs=2]
+              RenderBlock {DIV} at (10,-10) size 0x100
+      RenderBlock {P} at (0,174) size 769x54
+        RenderText {#text} at (0,0) size 148x18
+          text run at (0,0) width 148: "The table height is: 100"
+        RenderBR {BR} at (148,14) size 0x0
+        RenderText {#text} at (0,18) size 133x18
+          text run at (0,18) width 133: "Column One is: 33%"
+        RenderBR {BR} at (133,32) size 0x0
+        RenderText {#text} at (0,36) size 136x18
+          text run at (0,36) width 136: "Column Two is: 67%"
+      RenderBlock {HR} at (0,244) size 769x2 [border: (1px inset #000000)]
+      RenderTable {TABLE} at (0,254) size 40x600
+        RenderTableSection {TBODY} at (0,0) size 40x600
+          RenderTableRow {TR} at (0,0) size 20x600
+            RenderTableCell {TD} at (0,10) size 20x180 [bgcolor=#00FFFF] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (0,210) size 20x380 [bgcolor=#FFFF00] [r=0 c=1 rs=1 cs=1]
+          RenderTableRow {TR} at (0,20) size 20x600
+            RenderTableCell {TD} at (20,10) size 20x580 [bgcolor=#FFC0CB] [r=1 c=0 rs=1 cs=2]
+              RenderBlock {DIV} at (10,-10) size 0x600
+      RenderBlock {P} at (0,870) size 769x54
+        RenderText {#text} at (0,0) size 148x18
+          text run at (0,0) width 148: "The table height is: 600"
+        RenderBR {BR} at (148,14) size 0x0
+        RenderText {#text} at (0,18) size 133x18
+          text run at (0,18) width 133: "Column One is: 33%"
+        RenderBR {BR} at (133,32) size 0x0
+        RenderText {#text} at (0,36) size 136x18
+          text run at (0,36) width 136: "Column Two is: 67%"
+      RenderBlock {HR} at (0,940) size 769x2 [border: (1px inset #000000)]
+      RenderTable {TABLE} at (0,950) size 56x600
+        RenderTableSection {TBODY} at (0,0) size 56x600
+          RenderTableRow {TR} at (0,0) size 36x600
+            RenderTableCell {TD} at (0,0) size 36x200 [bgcolor=#00FFFF] [r=0 c=0 rs=1 cs=1]
+              RenderText {#text} at (0,0) size 36x188
+                text run at (0,0) width 188: "Fixed cell in column one with"
+                text run at (18,0) width 64: "some text."
+            RenderTableCell {TD} at (0,200) size 36x400 [bgcolor=#FFFF00] [r=0 c=1 rs=1 cs=1]
+              RenderText {#text} at (0,0) size 36x398
+                text run at (0,0) width 398: "Fixed cell in column two with a lot more text. Will the ratios be"
+                text run at (18,0) width 68: "preserved?"
+          RenderTableRow {TR} at (0,36) size 20x600
+            RenderTableCell {TD} at (36,10) size 20x580 [bgcolor=#FFC0CB] [r=1 c=0 rs=1 cs=2]
+              RenderBlock {DIV} at (10,-10) size 0x600
+      RenderBlock {P} at (0,1566) size 769x54
+        RenderText {#text} at (0,0) size 148x18
+          text run at (0,0) width 148: "The table height is: 600"
+        RenderBR {BR} at (148,14) size 0x0
+        RenderText {#text} at (0,18) size 133x18
+          text run at (0,18) width 133: "Column One is: 33%"
+        RenderBR {BR} at (133,32) size 0x0
+        RenderText {#text} at (0,36) size 136x18
+          text run at (0,36) width 136: "Column Two is: 67%"
+      RenderBlock {HR} at (0,1636) size 769x2 [border: (1px inset #000000)]
+      RenderTable {TABLE} at (0,1646) size 40x600
+        RenderTableSection {TBODY} at (0,0) size 40x600
+          RenderTableRow {TR} at (0,0) size 20x600
+            RenderTableCell {TD} at (0,10) size 20x180 [bgcolor=#00FFFF] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (10,-10) size 0x100
+            RenderTableCell {TD} at (0,210) size 20x380 [bgcolor=#FFFF00] [r=0 c=1 rs=1 cs=1]
+              RenderBlock {DIV} at (10,-10) size 0x250
+          RenderTableRow {TR} at (0,20) size 20x600
+            RenderTableCell {TD} at (20,10) size 20x580 [bgcolor=#FFC0CB] [r=1 c=0 rs=1 cs=2]
+              RenderBlock {DIV} at (10,-10) size 0x600
+      RenderBlock {P} at (0,2262) size 769x54
+        RenderText {#text} at (0,0) size 148x18
+          text run at (0,0) width 148: "The table height is: 600"
+        RenderBR {BR} at (148,14) size 0x0
+        RenderText {#text} at (0,18) size 133x18
+          text run at (0,18) width 133: "Column One is: 33%"
+        RenderBR {BR} at (133,32) size 0x0
+        RenderText {#text} at (0,36) size 136x18
+          text run at (0,36) width 136: "Column Two is: 67%"
+      RenderBlock {HR} at (0,2332) size 769x2 [border: (1px inset #000000)]
diff --git a/LayoutTests/platform/mac/fast/table/auto-with-percent-height-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/auto-with-percent-height-vertical-expected.checksum
new file mode 100644
index 0000000..e00e108
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/auto-with-percent-height-vertical-expected.checksum
@@ -0,0 +1 @@
+d2f3af8978f22cf6ffa5477cf4757618
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/auto-with-percent-height-vertical-expected.png b/LayoutTests/platform/mac/fast/table/auto-with-percent-height-vertical-expected.png
new file mode 100644
index 0000000..ce36f07
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/auto-with-percent-height-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/auto-with-percent-height-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/auto-with-percent-height-vertical-expected.txt
new file mode 100644
index 0000000..595d882
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/auto-with-percent-height-vertical-expected.txt
@@ -0,0 +1,31 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x206
+  RenderBlock {HTML} at (0,0) size 800x206
+    RenderBody {BODY} at (8,16) size 784x174
+      RenderTable {TABLE} at (16,0) size 60x88 [border: (3px solid #FF0000)]
+        RenderTableSection {TBODY} at (3,3) size 54x82
+          RenderTableRow {TR} at (0,2) size 50x82
+            RenderTableCell {TD} at (2,2) size 50x78 [r=0 c=0 rs=1 cs=1]
+              RenderTable {TABLE} at (1,1) size 24x73 [color=#FFFFFF] [bgcolor=#800080]
+                RenderTableSection {TBODY} at (0,0) size 24x73
+                  RenderTableRow {TR} at (0,2) size 20x73
+                    RenderTableCell {TD} at (2,2) size 20x69 [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,1) size 18x67
+                        text run at (1,1) width 67: "Table One"
+              RenderTable {TABLE} at (25,1) size 24x76 [color=#FFFFFF] [bgcolor=#800080]
+                RenderTableSection {TBODY} at (0,0) size 24x76
+                  RenderTableRow {TR} at (0,2) size 20x76
+                    RenderTableCell {TD} at (2,2) size 20x72 [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,1) size 18x70
+                        text run at (1,1) width 70: "Table Two"
+      RenderTable {TABLE} at (16,104) size 48x70 [border: (3px solid #FF0000)]
+        RenderTableSection {TBODY} at (3,3) size 42x64
+          RenderTableRow {TR} at (0,2) size 38x64
+            RenderTableCell {TD} at (2,2) size 38x60 [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (1,1) size 18x58 [color=#FFFFFF] [bgcolor=#800080]
+                RenderText {#text} at (0,0) size 18x55
+                  text run at (0,0) width 55: "Div One"
+              RenderBlock {DIV} at (19,1) size 18x58 [color=#FFFFFF] [bgcolor=#800080]
+                RenderText {#text} at (0,0) size 18x58
+                  text run at (0,0) width 58: "Div Two"
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/001-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/border-collapsing/001-vertical-expected.checksum
new file mode 100644
index 0000000..68ca94c
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/border-collapsing/001-vertical-expected.checksum
@@ -0,0 +1 @@
+313812db2a28cc377c7db72015b5a884
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/001-vertical-expected.png b/LayoutTests/platform/mac/fast/table/border-collapsing/001-vertical-expected.png
new file mode 100644
index 0000000..4e83fdb
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/border-collapsing/001-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/001-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/border-collapsing/001-vertical-expected.txt
new file mode 100644
index 0000000..16989c1
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/border-collapsing/001-vertical-expected.txt
@@ -0,0 +1,27 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (378,0) size 422x600
+  RenderBlock {HTML} at (0,0) size 422x600
+    RenderBody {BODY} at (8,8) size 406x584
+      RenderBlock {DIV} at (0,0) size 220x584 [border: (10px dotted #0000FF)]
+        RenderTable {TABLE} at (10,10) size 200x322 [border: (5px solid #FF0000)]
+          RenderTableSection {TBODY} at (5,5) size 170x312
+            RenderTableRow {TR} at (0,0) size 40x312
+              RenderTableCell {TD} at (0,0) size 40x312 [border: (5px solid #008000)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (6,6) size 18x35
+                  text run at (6,6) width 35: "Hello"
+            RenderTableRow {TR} at (0,40) size 60x312
+              RenderTableCell {TD} at (40,0) size 60x312 [border: (15px solid #0000FF)] [r=1 c=0 rs=1 cs=1]
+                RenderText {#text} at (16,16) size 18x59
+                  text run at (16,16) width 59: "Goodbye"
+            RenderTableRow {TR} at (0,100) size 70x312
+              RenderTableCell {TD} at (100,0) size 70x312 [border: (25px solid #FF0000)] [r=2 c=0 rs=1 cs=1]
+                RenderText {#text} at (26,26) size 18x59
+                  text run at (26,26) width 59: "Goodbye"
+      RenderBlock {DIV} at (380,0) size 26x584 [border: (1px solid #008000)]
+        RenderTable {TABLE} at (1,1) size 24x33 [border: (1px none #808080)]
+          RenderTableSection {TBODY} at (1,1) size 22x31
+            RenderTableRow {TR} at (0,0) size 22x31
+              RenderTableCell {TD} at (0,0) size 22x31 [border: (1px solid #000000)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 18x27
+                  text run at (2,2) width 27: "Test"
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/002-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/border-collapsing/002-vertical-expected.checksum
new file mode 100644
index 0000000..8632e6b
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/border-collapsing/002-vertical-expected.checksum
@@ -0,0 +1 @@
+6902ede03dd74b82564a8f99bb1950d4
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/002-vertical-expected.png b/LayoutTests/platform/mac/fast/table/border-collapsing/002-vertical-expected.png
new file mode 100644
index 0000000..773e426
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/border-collapsing/002-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/002-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/border-collapsing/002-vertical-expected.txt
new file mode 100644
index 0000000..5ec2aa2
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/border-collapsing/002-vertical-expected.txt
@@ -0,0 +1,174 @@
+layer at (0,0) size 785x612
+  RenderView at (0,0) size 785x600
+layer at (0,0) size 785x612
+  RenderBlock {HTML} at (0,0) size 785x612
+    RenderBody {BODY} at (8,8) size 769x588
+      RenderBlock {P} at (0,0) size 769x588
+        RenderTable {TABLE} at (0,0) size 272x158 [border: (2px solid #FFFF00)]
+          RenderTableCol {COLGROUP} at (0,0) size 0x0
+            RenderTableCol {COL} at (0,0) size 0x0 [border: (3px solid #000000)]
+            RenderTableCol {COL} at (0,0) size 0x0
+            RenderTableCol {COL} at (0,0) size 0x0
+          RenderTableSection {TBODY} at (2,2) size 267x153
+            RenderTableRow {TR} at (0,0) size 55x153
+              RenderTableCell {TD} at (0,1) size 55x50 [border: (3px solid #FF0000)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (19,18) size 18x8
+                  text run at (19,18) width 8: "1"
+              RenderTableCell {TD} at (0,52) size 55x50 [border: (2px solid #FF0000)] [r=0 c=1 rs=1 cs=1]
+                RenderText {#text} at (18,18) size 18x8
+                  text run at (18,18) width 8: "2"
+              RenderTableCell {TD} at (0,102) size 55x51 [border: (1px solid #FF0000)] [r=0 c=2 rs=1 cs=1]
+                RenderText {#text} at (18,17) size 18x8
+                  text run at (18,17) width 8: "3"
+            RenderTableRow {TR} at (0,55) size 55x153
+              RenderTableCell {TD} at (55,2) size 55x48 [border: (3px solid #FF0000)] [r=1 c=0 rs=1 cs=1]
+                RenderText {#text} at (18,17) size 18x8
+                  text run at (18,17) width 8: "4"
+              RenderTableCell {TD} at (55,52) size 55x50 [border: (3px dashed #0000FF)] [r=1 c=1 rs=1 cs=1]
+                RenderText {#text} at (18,19) size 18x8
+                  text run at (18,19) width 8: "5"
+              RenderTableCell {TD} at (55,102) size 55x51 [border: (3px solid #008000)] [r=1 c=2 rs=1 cs=1]
+                RenderText {#text} at (18,19) size 18x8
+                  text run at (18,19) width 8: "6"
+            RenderTableRow {TR} at (0,110) size 53x153
+              RenderTableCell {TD} at (110,1) size 53x50 [border: (3px solid #FF0000)] [r=2 c=0 rs=1 cs=1]
+                RenderText {#text} at (17,18) size 18x8
+                  text run at (17,18) width 8: "7"
+              RenderTableCell {TD} at (110,52) size 53x50 [border: (2px solid #FF0000)] [r=2 c=1 rs=1 cs=1]
+                RenderText {#text} at (18,18) size 18x8
+                  text run at (18,18) width 8: "8"
+              RenderTableCell {TD} at (110,102) size 53x51 [border: (1px solid #FF0000)] [r=2 c=2 rs=1 cs=1]
+                RenderText {#text} at (18,17) size 18x8
+                  text run at (18,17) width 8: "9"
+            RenderTableRow {TR} at (0,163) size 51x153
+              RenderTableCell {TD} at (163,0) size 51x52 [border: (3px solid #FF0000)] [r=3 c=0 rs=1 cs=1]
+                RenderText {#text} at (16,19) size 18x16
+                  text run at (16,19) width 16: "10"
+              RenderTableCell {TD} at (163,52) size 51x50 [border: (2px solid #FF0000)] [r=3 c=1 rs=1 cs=1]
+                RenderText {#text} at (16,18) size 18x16
+                  text run at (16,18) width 16: "11"
+              RenderTableCell {TD} at (163,102) size 51x51 [border: (1px solid #FF0000)] [r=3 c=2 rs=1 cs=1]
+                RenderText {#text} at (16,17) size 18x16
+                  text run at (16,17) width 16: "12"
+            RenderTableRow {TR} at (0,214) size 53x153
+              RenderTableCell {TD} at (214,0) size 53x52 [border: (3px solid #FF0000)] [r=4 c=0 rs=1 cs=1]
+                RenderText {#text} at (16,19) size 18x16
+                  text run at (16,19) width 16: "13"
+              RenderTableCell {TD} at (214,52) size 53x50 [border: (2px solid #FF0000)] [r=4 c=1 rs=1 cs=1]
+                RenderText {#text} at (16,18) size 18x16
+                  text run at (16,18) width 16: "14"
+              RenderTableCell {TD} at (214,102) size 53x51 [border: (1px solid #FF0000)] [r=4 c=2 rs=1 cs=1]
+                RenderText {#text} at (16,17) size 18x16
+                  text run at (16,17) width 16: "15"
+        RenderTable {TABLE} at (0,158) size 272x158 [border: (2px solid #FFFF00)]
+          RenderTableCol {COLGROUP} at (0,0) size 0x0
+            RenderTableCol {COL} at (0,0) size 0x0 [border: (3px solid #000000)]
+            RenderTableCol {COL} at (0,0) size 0x0
+            RenderTableCol {COL} at (0,0) size 0x0
+          RenderTableSection {TBODY} at (2,2) size 267x153
+            RenderTableRow {TR} at (0,0) size 55x153
+              RenderTableCell {TD} at (0,1) size 55x50 [border: (3px solid #FF0000)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (20,18) size 18x8
+                  text run at (20,18) width 8: "1"
+              RenderTableCell {TD} at (0,52) size 55x50 [border: (2px solid #FF0000)] [r=0 c=1 rs=1 cs=1]
+                RenderText {#text} at (19,18) size 18x8
+                  text run at (19,18) width 8: "2"
+              RenderTableCell {TD} at (0,102) size 55x51 [border: (1px solid #FF0000)] [r=0 c=2 rs=1 cs=1]
+                RenderText {#text} at (19,17) size 18x8
+                  text run at (19,17) width 8: "3"
+            RenderTableRow {TR} at (0,55) size 55x153
+              RenderTableCell {TD} at (55,2) size 55x48 [border: (3px solid #FF0000)] [r=1 c=0 rs=1 cs=1]
+                RenderText {#text} at (19,17) size 18x8
+                  text run at (19,17) width 8: "4"
+              RenderTableCell {TD} at (55,52) size 55x50 [border: (3px dashed #0000FF)] [r=1 c=1 rs=1 cs=1]
+                RenderText {#text} at (19,19) size 18x8
+                  text run at (19,19) width 8: "5"
+              RenderTableCell {TD} at (55,102) size 55x51 [border: (3px solid #008000)] [r=1 c=2 rs=1 cs=1]
+                RenderText {#text} at (19,19) size 18x8
+                  text run at (19,19) width 8: "6"
+            RenderTableRow {TR} at (0,110) size 53x153
+              RenderTableCell {TD} at (110,1) size 53x50 [border: (3px solid #FF0000)] [r=2 c=0 rs=1 cs=1]
+                RenderText {#text} at (18,18) size 18x8
+                  text run at (18,18) width 8: "7"
+              RenderTableCell {TD} at (110,52) size 53x50 [border: (2px solid #FF0000)] [r=2 c=1 rs=1 cs=1]
+                RenderText {#text} at (19,18) size 18x8
+                  text run at (19,18) width 8: "8"
+              RenderTableCell {TD} at (110,102) size 53x51 [border: (1px solid #FF0000)] [r=2 c=2 rs=1 cs=1]
+                RenderText {#text} at (19,17) size 18x8
+                  text run at (19,17) width 8: "9"
+            RenderTableRow {TR} at (0,163) size 51x153
+              RenderTableCell {TD} at (163,0) size 51x52 [border: (3px solid #FF0000)] [r=3 c=0 rs=1 cs=1]
+                RenderText {#text} at (17,19) size 18x16
+                  text run at (17,19) width 16: "10"
+              RenderTableCell {TD} at (163,52) size 51x50 [border: (2px solid #FF0000)] [r=3 c=1 rs=1 cs=1]
+                RenderText {#text} at (17,18) size 18x16
+                  text run at (17,18) width 16: "11"
+              RenderTableCell {TD} at (163,102) size 51x51 [border: (1px solid #FF0000)] [r=3 c=2 rs=1 cs=1]
+                RenderText {#text} at (17,17) size 18x16
+                  text run at (17,17) width 16: "12"
+            RenderTableRow {TR} at (0,214) size 53x153
+              RenderTableCell {TD} at (214,0) size 53x52 [border: (3px solid #FF0000)] [r=4 c=0 rs=1 cs=1]
+                RenderText {#text} at (17,19) size 18x16
+                  text run at (17,19) width 16: "13"
+              RenderTableCell {TD} at (214,52) size 53x50 [border: (2px solid #FF0000)] [r=4 c=1 rs=1 cs=1]
+                RenderText {#text} at (17,18) size 18x16
+                  text run at (17,18) width 16: "14"
+              RenderTableCell {TD} at (214,102) size 53x51 [border: (1px solid #FF0000)] [r=4 c=2 rs=1 cs=1]
+                RenderText {#text} at (17,17) size 18x16
+                  text run at (17,17) width 16: "15"
+        RenderTable {TABLE} at (0,316) size 158x272 [border: (3px solid #FFFF00)]
+          RenderTableCol {COLGROUP} at (0,0) size 0x0
+            RenderTableCol {COL} at (0,0) size 0x0 [border: (3px solid #000000)]
+            RenderTableCol {COL} at (0,0) size 0x0
+            RenderTableCol {COL} at (0,0) size 0x0
+          RenderTableSection {TBODY} at (2,2) size 153x267
+            RenderTableRow {TR} at (0,0) size 153x55
+              RenderTableCell {TD} at (0,1) size 52x53 [border: (1px solid #FF0000)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (19,18) size 8x18
+                  text run at (19,18) width 8: "1"
+              RenderTableCell {TD} at (52,0) size 50x55 [border: (3px solid #FF0000)] [r=0 c=1 rs=1 cs=1]
+                RenderText {#text} at (18,18) size 8x18
+                  text run at (18,18) width 8: "2"
+              RenderTableCell {TD} at (102,0) size 51x55 [border: (3px solid #FF0000)] [r=0 c=2 rs=1 cs=1]
+                RenderText {#text} at (17,18) size 8x18
+                  text run at (17,18) width 8: "3"
+            RenderTableRow {TR} at (0,55) size 153x55
+              RenderTableCell {TD} at (0,57) size 52x51 [border: (1px solid #FF0000)] [r=1 c=0 rs=1 cs=1]
+                RenderText {#text} at (19,16) size 8x18
+                  text run at (19,16) width 8: "4"
+              RenderTableCell {TD} at (52,55) size 50x55 [border: (3px dashed #0000FF)] [r=1 c=1 rs=1 cs=1]
+                RenderText {#text} at (19,18) size 8x18
+                  text run at (19,18) width 8: "5"
+              RenderTableCell {TD} at (102,55) size 51x55 [border: (3px solid #008000)] [r=1 c=2 rs=1 cs=1]
+                RenderText {#text} at (19,18) size 8x18
+                  text run at (19,18) width 8: "6"
+            RenderTableRow {TR} at (0,110) size 153x53
+              RenderTableCell {TD} at (0,111) size 52x51 [border: (1px solid #FF0000)] [r=2 c=0 rs=1 cs=1]
+                RenderText {#text} at (19,16) size 8x18
+                  text run at (19,16) width 8: "7"
+              RenderTableCell {TD} at (52,110) size 50x53 [border: (1px solid #FF0000)] [r=2 c=1 rs=1 cs=1]
+                RenderText {#text} at (18,18) size 8x18
+                  text run at (18,18) width 8: "8"
+              RenderTableCell {TD} at (102,110) size 51x53 [border: (1px solid #FF0000)] [r=2 c=2 rs=1 cs=1]
+                RenderText {#text} at (17,18) size 8x18
+                  text run at (17,18) width 8: "9"
+            RenderTableRow {TR} at (0,163) size 153x51
+              RenderTableCell {TD} at (0,163) size 52x51 [border: (1px solid #FF0000)] [r=3 c=0 rs=1 cs=1]
+                RenderText {#text} at (19,16) size 16x18
+                  text run at (19,16) width 16: "10"
+              RenderTableCell {TD} at (52,163) size 50x51 [border: (1px solid #FF0000)] [r=3 c=1 rs=1 cs=1]
+                RenderText {#text} at (18,16) size 16x18
+                  text run at (18,16) width 16: "11"
+              RenderTableCell {TD} at (102,163) size 51x51 [border: (1px solid #FF0000)] [r=3 c=2 rs=1 cs=1]
+                RenderText {#text} at (17,16) size 16x18
+                  text run at (17,16) width 16: "12"
+            RenderTableRow {TR} at (0,214) size 153x53
+              RenderTableCell {TD} at (0,214) size 52x53 [border: (3px solid #FF0000)] [r=4 c=0 rs=1 cs=1]
+                RenderText {#text} at (19,16) size 16x18
+                  text run at (19,16) width 16: "13"
+              RenderTableCell {TD} at (52,214) size 50x53 [border: (3px solid #FF0000)] [r=4 c=1 rs=1 cs=1]
+                RenderText {#text} at (18,16) size 16x18
+                  text run at (18,16) width 16: "14"
+              RenderTableCell {TD} at (102,214) size 51x53 [border: (3px solid #FF0000)] [r=4 c=2 rs=1 cs=1]
+                RenderText {#text} at (17,16) size 16x18
+                  text run at (17,16) width 16: "15"
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/003-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/border-collapsing/003-vertical-expected.checksum
new file mode 100644
index 0000000..a94c67d
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/border-collapsing/003-vertical-expected.checksum
@@ -0,0 +1 @@
+1e78a087163479e287af20ae72a2fd67
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/003-vertical-expected.png b/LayoutTests/platform/mac/fast/table/border-collapsing/003-vertical-expected.png
new file mode 100644
index 0000000..b332f37
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/border-collapsing/003-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/003-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/border-collapsing/003-vertical-expected.txt
new file mode 100644
index 0000000..04532bb
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/border-collapsing/003-vertical-expected.txt
@@ -0,0 +1,31 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (404,0) size 396x600
+  RenderBlock {HTML} at (0,0) size 396x600
+    RenderBody {BODY} at (8,8) size 356x584
+      RenderBlock {P} at (0,16) size 54x552
+        RenderText {#text} at (0,0) size 18x201
+          text run at (0,0) width 201: "The black border below should "
+        RenderInline {I} at (0,0) size 18x20
+          RenderText {#text} at (0,201) size 18x20
+            text run at (0,201) width 20: "not"
+        RenderText {#text} at (0,221) size 36x545
+          text run at (0,221) width 212: " cut through the top left corner of "
+          text run at (0,433) width 112: "the blue border. It"
+          text run at (18,0) width 288: "would cut through with our old behavior, but "
+        RenderInline {A} at (0,0) size 18x22 [color=#0000EE]
+          RenderText {#text} at (18,288) size 18x22
+            text run at (18,288) width 22: "this"
+        RenderText {#text} at (18,310) size 36x516
+          text run at (18,310) width 4: " "
+          text run at (18,314) width 202: "bug fix changed our behavior to"
+          text run at (36,0) width 97: "match the spec."
+      RenderBlock {DIV} at (86,32) size 270x520 [border: (1px solid #0000FF)]
+        RenderTable {DIV} at (1,1) size 220x115 [border:]
+          RenderTableSection (anonymous) at (10,1) size 200x104
+            RenderTableRow {P} at (0,0) size 100x104
+              RenderTableCell {SPAN} at (0,0) size 100x-37 [border: (1px solid #000000)] [r=0 c=0 rs=1 cs=1]
+              RenderTableCell {SPAN} at (0,52) size 100x20 [border: (10px solid #000000)] [r=0 c=1 rs=1 cs=1]
+            RenderTableRow {P} at (0,100) size 100x104 [border: (1px solid #0000FF)]
+              RenderTableCell {SPAN} at (100,0) size 100x-28 [border: (10px solid #000000)] [r=1 c=0 rs=1 cs=1]
+              RenderTableCell {SPAN} at (100,52) size 100x20 [border: (10px solid #000000)] [r=1 c=1 rs=1 cs=1]
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/004-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/border-collapsing/004-vertical-expected.checksum
new file mode 100644
index 0000000..263002e
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/border-collapsing/004-vertical-expected.checksum
@@ -0,0 +1 @@
+03541e288195fa64ab979033ac6a397c
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/004-vertical-expected.png b/LayoutTests/platform/mac/fast/table/border-collapsing/004-vertical-expected.png
new file mode 100644
index 0000000..f07fc2a
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/border-collapsing/004-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/004-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/border-collapsing/004-vertical-expected.txt
new file mode 100644
index 0000000..11d7f4e
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/border-collapsing/004-vertical-expected.txt
@@ -0,0 +1,352 @@
+layer at (0,0) size 1444x914
+  RenderView at (0,0) size 785x585
+layer at (0,0) size 1444x914
+  RenderBlock {HTML} at (0,0) size 785x914
+    RenderBody {BODY} at (8,21) size 769x885
+      RenderBlock {H1} at (0,0) size 769x37
+        RenderText {#text} at (0,0) size 290x37
+          text run at (0,0) width 290: "Table Border Models"
+      RenderBlock {P} at (0,58) size 769x18
+        RenderText {#text} at (0,0) size 117x18
+          text run at (0,0) width 117: "This tests tests the "
+        RenderInline {A} at (0,0) size 208x18 [color=#0000EE]
+          RenderText {#text} at (117,0) size 208x18
+            text run at (117,0) width 208: "CSS2 spec rules on table borders"
+        RenderText {#text} at (325,0) size 180x18
+          text run at (325,0) width 8: ". "
+          text run at (333,0) width 172: "The styles applied here are:"
+      RenderBlock {PRE} at (0,92) size 769x180
+        RenderText {#text} at (0,0) size 688x180
+          text run at (0,0) width 408: "TABLE\x{9}{ margin: 1em; border: medium solid blue; }"
+          text run at (408,0) width 0: " "
+          text run at (0,15) width 408: "TD\x{9}{ border: thin solid green; padding: 5px; }"
+          text run at (408,15) width 0: " "
+          text run at (0,30) width 392: "TH { border: medium solid purple; padding: 5px; }"
+          text run at (392,30) width 0: " "
+          text run at (0,45) width 360: "TABLE.one, TABLE.two { border-spacing: 1em; }"
+          text run at (360,45) width 0: " "
+          text run at (0,60) width 320: "TABLE.one { border-collapse: collapse; }"
+          text run at (320,60) width 0: " "
+          text run at (0,75) width 320: "TABLE.two { border-collapse: separate; }"
+          text run at (320,75) width 0: " "
+          text run at (0,90) width 536: "TABLE.three { border-collapse: separate; border-spacing: 0 0.5em; }"
+          text run at (536,90) width 0: " "
+          text run at (0,105) width 528: "TABLE.four { border-collapse: separate; border-spacing: 0.5em 0; }"
+          text run at (528,105) width 0: " "
+          text run at (0,120) width 328: "TABLE.five { border-collapse: separate; }"
+          text run at (328,120) width 0: " "
+          text run at (0,135) width 464: "TABLE.five, TABLE.five TD, TABLE.five TH { border: none; }"
+          text run at (464,135) width 0: " "
+          text run at (0,150) width 688: "TABLE.five TR, TABLE.five COL, TABLE.five COLGROUP, TABLE.five TBODY, TABLE.five THEAD"
+          text run at (688,150) width 0: " "
+          text run at (0,165) width 296: "\x{9}{ border: medium solid red; }"
+          text run at (296,165) width 0: " "
+      RenderBlock {DIV} at (0,285) size 1436x600
+        RenderTable {TABLE} at (16,16) size 238x568 [border: (1px solid #0000FF)]
+          RenderTableSection {TBODY} at (1,1) size 235x565
+            RenderTableRow {TR} at (0,0) size 31x565
+              RenderTableCell {TH} at (0,0) size 31x189 [border: (2px solid #800080)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (6,54) size 18x82
+                  text run at (6,54) width 82: "Header One"
+              RenderTableCell {TH} at (0,189) size 31x178 [border: (2px solid #800080)] [r=0 c=1 rs=1 cs=1]
+                RenderText {#text} at (6,47) size 18x85
+                  text run at (6,47) width 85: "Header Two"
+              RenderTableCell {TH} at (0,367) size 31x198 [border: (2px solid #800080)] [r=0 c=2 rs=1 cs=1]
+                RenderText {#text} at (6,52) size 18x95
+                  text run at (6,52) width 95: "Header Three"
+            RenderTableRow {TR} at (0,31) size 102x565
+              RenderTableCell {TD} at (31,27) size 102x135 [border: (2px solid #008000)] [r=1 c=0 rs=1 cs=1]
+                RenderText {#text} at (33,-20) size 36x157
+                  text run at (33,-20) width 116: "This table uses the"
+                  text run at (51,-20) width 157: "collapsed borders model."
+              RenderTableCell {TD} at (31,207) size 102x142 [border: (1px solid #008000)] [r=1 c=1 rs=1 cs=1]
+                RenderText {#text} at (24,-12) size 54x158
+                  text run at (24,-12) width 158: "This means that elements"
+                  text run at (42,-12) width 143: "within the cell have no"
+                  text run at (60,-12) width 98: "border-spacing."
+              RenderTableCell {TD} at (31,367) size 102x198 [border: (1px solid #008000)] [r=1 c=2 rs=1 cs=1]
+                RenderText {#text} at (6,6) size 90x168
+                  text run at (6,6) width 135: "Since it has collapsed"
+                  text run at (24,6) width 168: "borders, the borders on the"
+                  text run at (42,6) width 82: "header cells, "
+                  text run at (42,88) width 74: "on all sides,"
+                  text run at (60,6) width 150: "should be medium solid"
+                  text run at (78,6) width 44: "purple."
+            RenderTableRow {TR} at (0,133) size 102x565
+              RenderTableCell {TD} at (133,0) size 102x189 [border: (2px solid #008000)] [r=2 c=0 rs=1 cs=1]
+                RenderText {#text} at (5,7) size 90x153
+                  text run at (5,7) width 144: "The border of the table"
+                  text run at (23,7) width 150: "itself should be medium"
+                  text run at (41,7) width 114: "solid blue, except "
+                  text run at (41,121) width 39: "where"
+                  text run at (59,7) width 153: "header cells override the"
+                  text run at (77,7) width 45: "border."
+              RenderTableCell {TD} at (133,198) size 102x160 [border: (1px solid #008000)] [r=2 c=1 rs=1 cs=1]
+                RenderText {#text} at (14,-3) size 72x167
+                  text run at (14,-3) width 161: "The borders that I haven't"
+                  text run at (32,-3) width 163: "already mentioned (all the"
+                  text run at (50,-3) width 87: "other internal "
+                  text run at (50,84) width 80: "ones) should"
+                  text run at (68,-3) width 120: "be thin solid green."
+              RenderTableCell {TD} at (133,376) size 102x180 [border: (1px solid #008000)] [r=2 c=2 rs=1 cs=1]
+                RenderText {#text} at (14,-3) size 72x184
+                  text run at (14,-3) width 184: "This table should have a 1em"
+                  text run at (32,-3) width 155: "margin around all edges."
+                  text run at (50,-3) width 80: "This margin "
+                  text run at (50,77) width 74: "is measured"
+                  text run at (68,-3) width 57: "from the "
+                RenderInline {EM} at (0,0) size 18x43
+                  RenderText {#text} at (68,54) size 18x43
+                    text run at (68,54) width 43: "middle"
+                RenderText {#text} at (68,97) size 18x84
+                  text run at (68,97) width 84: " of its border."
+        RenderTable {TABLE} at (270,16) size 290x568 [border: (3px solid #0000FF)]
+          RenderTableSection {TBODY} at (3,3) size 284x562
+            RenderTableRow {TR} at (0,16) size 34x562
+              RenderTableCell {TH} at (16,16) size 34x121 [border: (3px solid #800080)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (8,19) size 18x82
+                  text run at (8,19) width 82: "Header One"
+              RenderTableCell {TH} at (16,153) size 34x143 [border: (3px solid #800080)] [r=0 c=1 rs=1 cs=1]
+                RenderText {#text} at (8,29) size 18x85
+                  text run at (8,29) width 85: "Header Two"
+              RenderTableCell {TH} at (16,312) size 34x234 [border: (3px solid #800080)] [r=0 c=2 rs=1 cs=1]
+                RenderText {#text} at (8,69) size 18x95
+                  text run at (8,69) width 95: "Header Three"
+            RenderTableRow {TR} at (0,66) size 84x562
+              RenderTableCell {TD} at (66,25) size 84x103 [border: (1px solid #008000)] [r=1 c=0 rs=1 cs=1]
+                RenderText {#text} at (15,-3) size 54x94
+                  text run at (15,-3) width 93: "This table uses"
+                  text run at (33,-3) width 82: "the separated"
+                  text run at (51,-3) width 94: "borders model."
+              RenderTableCell {TD} at (66,153) size 84x143 [border: (1px solid #008000)] [r=1 c=1 rs=1 cs=1]
+                RenderText {#text} at (6,6) size 72x122
+                  text run at (6,6) width 99: "This means that"
+                  text run at (24,6) width 122: "elements within the"
+                  text run at (42,6) width 106: "cell have border-"
+                  text run at (60,6) width 100: "spacing of 1em."
+              RenderTableCell {TD} at (66,321) size 84x216 [border: (1px solid #008000)] [r=1 c=2 rs=1 cs=1]
+                RenderText {#text} at (15,-3) size 54x221
+                  text run at (15,-3) width 205: "The borders on the header cells, "
+                  text run at (15,202) width 16: "on"
+                  text run at (33,-3) width 208: "all sides, should be medium solid"
+                  text run at (51,-3) width 44: "purple."
+            RenderTableRow {TR} at (0,166) size 102x562
+              RenderTableCell {TD} at (166,16) size 102x121 [border: (1px solid #008000)] [r=2 c=0 rs=1 cs=1]
+                RenderText {#text} at (6,6) size 90x87
+                  text run at (6,6) width 87: "The border of"
+                  text run at (24,6) width 87: "the table itself"
+                  text run at (42,6) width 61: "should be"
+                  text run at (60,6) width 85: "medium solid"
+                  text run at (78,6) width 31: "blue."
+              RenderTableCell {TD} at (166,171) size 102x107 [border: (1px solid #008000)] [r=2 c=1 rs=1 cs=1]
+                RenderText {#text} at (24,-12) size 54x129
+                  text run at (24,-12) width 129: "The borders of other"
+                  text run at (42,-12) width 121: "cells should be thin"
+                  text run at (60,-12) width 73: "solid green."
+              RenderTableCell {TD} at (166,321) size 102x216 [border: (1px solid #008000)] [r=2 c=2 rs=1 cs=1]
+                RenderText {#text} at (15,-3) size 54x187
+                  text run at (15,-3) width 184: "This table should have a 1em"
+                  text run at (33,-3) width 159: "margin around all edges. "
+                  text run at (33,156) width 28: "This"
+                  text run at (51,-3) width 48: "margin "
+                  text run at (51,45) width 135: "is measured from the "
+                RenderInline {EM} at (0,0) size 36x216
+                  RenderText {#text} at (51,180) size 36x216
+                    text run at (51,180) width 33: "outer"
+                    text run at (69,-3) width 30: "edge"
+                RenderText {#text} at (69,27) size 18x84
+                  text run at (69,27) width 84: " of its border."
+        RenderTable {TABLE} at (576,16) size 312x568 [border: (3px solid #0000FF)]
+          RenderTableSection {TBODY} at (3,3) size 306x562
+            RenderTableRow {TR} at (0,8) size 34x562
+              RenderTableCell {TH} at (8,0) size 34x145 [border: (3px solid #800080)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (8,31) size 18x82
+                  text run at (8,31) width 82: "Header One"
+              RenderTableCell {TH} at (8,145) size 34x205 [border: (3px solid #800080)] [r=0 c=1 rs=1 cs=1]
+                RenderText {#text} at (8,60) size 18x85
+                  text run at (8,60) width 85: "Header Two"
+              RenderTableCell {TH} at (8,350) size 34x212 [border: (3px solid #800080)] [r=0 c=2 rs=1 cs=1]
+                RenderText {#text} at (8,58) size 18x95
+                  text run at (8,58) width 95: "Header Three"
+            RenderTableRow {TR} at (0,50) size 120x562
+              RenderTableCell {TD} at (50,27) size 120x91 [border: (1px solid #008000)] [r=1 c=0 rs=1 cs=1]
+                RenderText {#text} at (33,-21) size 54x116
+                  text run at (33,-21) width 116: "This table uses the"
+                  text run at (51,-21) width 110: "separated borders"
+                  text run at (69,-21) width 43: "model."
+              RenderTableCell {TD} at (50,145) size 120x205 [border: (1px solid #008000)] [r=1 c=1 rs=1 cs=1]
+                RenderText {#text} at (6,6) size 108x193
+                  text run at (6,6) width 185: "Elements within the cell have"
+                  text run at (24,6) width 193: "horizontal border-spacing (i.e.,"
+                  text run at (42,6) width 57: "width of "
+                  text run at (42,63) width 113: "vertical lines) of 0"
+                  text run at (60,6) width 77: "and vertical "
+                  text run at (60,83) width 94: "border-spacing"
+                  text run at (78,6) width 193: "(i.e., height of horizontal lines)"
+                  text run at (96,6) width 60: "of 0.5em."
+              RenderTableCell {TD} at (50,377) size 120x158 [border: (1px solid #008000)] [r=1 c=2 rs=1 cs=1]
+                RenderText {#text} at (33,-21) size 54x175
+                  text run at (33,-21) width 165: "The borders on the header"
+                  text run at (51,-21) width 36: "cells, "
+                  text run at (51,15) width 139: "on all sides, should be"
+                  text run at (69,-21) width 133: "medium solid purple."
+            RenderTableRow {TR} at (0,178) size 120x562
+              RenderTableCell {TD} at (178,0) size 120x145 [border: (1px solid #008000)] [r=2 c=0 rs=1 cs=1]
+                RenderText {#text} at (6,6) size 108x129
+                  text run at (6,6) width 110: "The border of the"
+                  text run at (24,6) width 129: "table itself should be"
+                  text run at (42,6) width 120: "medium solid blue."
+                  text run at (60,6) width 129: "The borders of other"
+                  text run at (78,6) width 121: "cells should be thin"
+                  text run at (96,6) width 73: "solid green."
+              RenderTableCell {TD} at (178,163) size 120x169 [border: (1px solid #008000)] [r=2 c=1 rs=1 cs=1]
+                RenderText {#text} at (24,-12) size 54x187
+                  text run at (24,-12) width 184: "This table should have a 1em"
+                  text run at (42,-12) width 159: "margin around all edges. "
+                  text run at (42,147) width 28: "This"
+                  text run at (60,-12) width 48: "margin "
+                  text run at (60,36) width 131: "is measured from the"
+                RenderInline {EM} at (0,0) size 18x67
+                  RenderText {#text} at (78,-12) size 18x67
+                    text run at (78,-12) width 67: "outer edge"
+                RenderText {#text} at (78,55) size 18x84
+                  text run at (78,55) width 84: " of its border."
+              RenderTableCell {TD} at (178,350) size 120x212 [border: (1px solid #008000)] [r=2 c=2 rs=1 cs=1]
+                RenderText {#text} at (6,6) size 108x192
+                  text run at (6,6) width 188: "The table should not be wider"
+                  text run at (24,6) width 181: "than the room available for it"
+                  text run at (42,6) width 43: "unless "
+                  text run at (42,49) width 149: "that space is very small."
+                  text run at (60,6) width 169: "Because of its margins, the"
+                  text run at (78,6) width 80: "width of the "
+                  text run at (78,86) width 95: "table should be"
+                  text run at (96,6) width 99: "less than 100%."
+        RenderTable {TABLE} at (904,16) size 262x568 [border: (3px solid #0000FF)]
+          RenderTableSection {TBODY} at (3,3) size 256x562
+            RenderTableRow {TR} at (0,0) size 34x562
+              RenderTableCell {TH} at (0,8) size 34x152 [border: (3px solid #800080)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (8,35) size 18x82
+                  text run at (8,35) width 82: "Header One"
+              RenderTableCell {TH} at (0,168) size 34x155 [border: (3px solid #800080)] [r=0 c=1 rs=1 cs=1]
+                RenderText {#text} at (8,35) size 18x85
+                  text run at (8,35) width 85: "Header Two"
+              RenderTableCell {TH} at (0,331) size 34x223 [border: (3px solid #800080)] [r=0 c=2 rs=1 cs=1]
+                RenderText {#text} at (8,64) size 18x95
+                  text run at (8,64) width 95: "Header Three"
+            RenderTableRow {TR} at (0,34) size 102x562
+              RenderTableCell {TD} at (34,26) size 102x116 [border: (1px solid #008000)] [r=1 c=0 rs=1 cs=1]
+                RenderText {#text} at (24,-12) size 54x116
+                  text run at (24,-12) width 116: "This table uses the"
+                  text run at (42,-12) width 110: "separated borders"
+                  text run at (60,-12) width 43: "model."
+              RenderTableCell {TD} at (34,168) size 102x155 [border: (1px solid #008000)] [r=1 c=1 rs=1 cs=1]
+                RenderText {#text} at (6,6) size 90x127
+                  text run at (6,6) width 125: "Elements within the"
+                  text run at (24,6) width 123: "cell have horizontal"
+                  text run at (42,6) width 111: "border-spacing of"
+                  text run at (60,6) width 116: "0.5em and vertical"
+                  text run at (78,6) width 127: "border-spacing of 0."
+              RenderTableCell {TD} at (34,349) size 102x187 [border: (1px solid #008000)] [r=1 c=2 rs=1 cs=1]
+                RenderText {#text} at (24,-12) size 54x201
+                  text run at (24,-12) width 201: "The borders on the header cells,"
+                  text run at (42,-12) width 194: "on all sides, should be medium"
+                  text run at (60,-12) width 78: "solid purple."
+            RenderTableRow {TR} at (0,136) size 120x562
+              RenderTableCell {TD} at (136,8) size 120x152 [border: (1px solid #008000)] [r=2 c=0 rs=1 cs=1]
+                RenderText {#text} at (6,6) size 108x129
+                  text run at (6,6) width 110: "The border of the"
+                  text run at (24,6) width 129: "table itself should be"
+                  text run at (42,6) width 120: "medium solid blue."
+                  text run at (60,6) width 129: "The borders of other"
+                  text run at (78,6) width 121: "cells should be thin"
+                  text run at (96,6) width 73: "solid green."
+              RenderTableCell {TD} at (136,168) size 120x155 [border: (1px solid #008000)] [r=2 c=1 rs=1 cs=1]
+                RenderText {#text} at (6,6) size 72x142
+                  text run at (6,6) width 142: "This table should have"
+                  text run at (24,6) width 134: "a 1em margin around"
+                  text run at (42,6) width 63: "all edges. "
+                  text run at (42,69) width 76: "This margin"
+                  text run at (60,6) width 131: "is measured from the"
+                RenderInline {EM} at (0,0) size 18x67
+                  RenderText {#text} at (78,6) size 18x67
+                    text run at (78,6) width 67: "outer edge"
+                RenderText {#text} at (78,73) size 36x102
+                  text run at (78,73) width 35: " of its"
+                  text run at (96,6) width 45: "border."
+              RenderTableCell {TD} at (136,331) size 120x223 [border: (1px solid #008000)] [r=2 c=2 rs=1 cs=1]
+                RenderText {#text} at (6,6) size 108x209
+                  text run at (6,6) width 188: "The table should not be wider"
+                  text run at (24,6) width 181: "than the room available for it"
+                  text run at (42,6) width 43: "unless "
+                  text run at (42,49) width 149: "that space is very small."
+                  text run at (60,6) width 209: "Because of its margins, the width"
+                  text run at (78,6) width 40: "of the "
+                  text run at (78,46) width 153: "table should be less than"
+                  text run at (96,6) width 41: "100%."
+        RenderTable {TABLE} at (1182,16) size 238x568
+          RenderBlock {CAPTION} at (0,0) size 18x568
+            RenderText {#text} at (0,224) size 18x119
+              text run at (0,224) width 119: "This is the caption."
+          RenderTableCol {COLGROUP} at (0,0) size 0x0 [border: (3px solid #FF0000)]
+            RenderTableCol {COL} at (0,0) size 0x0 [border: (3px solid #FF0000)]
+          RenderTableCol {COLGROUP} at (0,0) size 0x0 [border: (3px solid #FF0000)]
+            RenderTableCol {COL} at (0,0) size 0x0 [border: (3px solid #FF0000)]
+            RenderTableCol {COL} at (0,0) size 0x0 [border: (3px solid #FF0000)]
+          RenderTableSection {THEAD} at (18,0) size 32x568 [border: (3px solid #FF0000)]
+            RenderTableRow {TR} at (0,2) size 28x568 [border: (3px solid #FF0000)]
+              RenderTableCell {TH} at (2,2) size 28x92 [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (5,5) size 18x82
+                  text run at (5,5) width 82: "Header One"
+              RenderTableCell {TH} at (2,96) size 28x246 [r=0 c=1 rs=1 cs=1]
+                RenderText {#text} at (5,80) size 18x85
+                  text run at (5,80) width 85: "Header Two"
+              RenderTableCell {TH} at (2,344) size 28x222 [r=0 c=2 rs=1 cs=1]
+                RenderText {#text} at (5,63) size 18x95
+                  text run at (5,63) width 95: "Header Three"
+          RenderTableSection {TBODY} at (50,0) size 188x568 [border: (3px solid #FF0000)]
+            RenderTableRow {TR} at (0,2) size 100x568 [border: (3px solid #FF0000)]
+              RenderTableCell {TD} at (2,2) size 100x92 [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (5,5) size 90x62
+                  text run at (5,5) width 62: "This table"
+                  text run at (23,5) width 50: "uses the"
+                  text run at (41,5) width 59: "separated"
+                  text run at (59,5) width 47: "borders"
+                  text run at (77,5) width 43: "model."
+              RenderTableCell {TD} at (2,114) size 100x210 [r=0 c=1 rs=1 cs=1]
+                RenderText {#text} at (23,-13) size 54x227
+                  text run at (23,-13) width 227: "This means that borders are allowed"
+                  text run at (41,-13) width 196: "only on table elements or table "
+                  text run at (41,183) width 22: "cell"
+                  text run at (59,-13) width 59: "elements."
+              RenderTableCell {TD} at (2,353) size 100x204 [r=0 c=2 rs=1 cs=1]
+                RenderText {#text} at (14,-4) size 72x211
+                  text run at (14,-4) width 154: "They are not allowed on"
+                  text run at (32,-4) width 182: "elements that represent rows,"
+                  text run at (50,-4) width 211: "row-groups, columns, or column-"
+                  text run at (68,-4) width 47: "groups."
+            RenderTableRow {TR} at (0,104) size 82x568 [border: (3px solid #FF0000)]
+              RenderTableCell {TD} at (104,2) size 82x92 [r=1 c=0 rs=1 cs=1]
+                RenderText {#text} at (5,5) size 72x81
+                  text run at (5,5) width 37: "There"
+                  text run at (23,5) width 81: "should be no"
+                  text run at (41,5) width 81: "borders at all"
+                  text run at (59,5) width 81: "on this table!"
+              RenderTableCell {TD} at (104,96) size 82x246 [r=1 c=1 rs=1 cs=1]
+                RenderText {#text} at (5,5) size 72x219
+                  text run at (5,5) width 219: "If there are any borders shown that"
+                  text run at (23,5) width 195: "are not medium solid red, then "
+                  text run at (23,200) width 19: "the"
+                  text run at (41,5) width 202: "problem is something other than"
+                  text run at (59,5) width 145: "what this test is testing."
+              RenderTableCell {TD} at (104,344) size 82x222 [r=1 c=2 rs=1 cs=1]
+                RenderText {#text} at (5,5) size 54x187
+                  text run at (5,5) width 184: "This table should have a 1em"
+                  text run at (23,5) width 159: "margin around all edges. "
+                  text run at (23,164) width 28: "This"
+                  text run at (41,5) width 48: "margin "
+                  text run at (41,53) width 131: "is measured from the"
+                RenderInline {EM} at (0,0) size 18x67
+                  RenderText {#text} at (59,5) size 18x67
+                    text run at (59,5) width 67: "outer edge"
+                RenderText {#text} at (59,72) size 18x84
+                  text run at (59,72) width 84: " of its border."
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.checksum
new file mode 100644
index 0000000..6cfb83c
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.checksum
@@ -0,0 +1 @@
+2fe60cf436fab9ba5f2ea0bb4ca080ec
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.png b/LayoutTests/platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.png
new file mode 100644
index 0000000..c461882
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.txt
new file mode 100644
index 0000000..38c9de8
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.txt
@@ -0,0 +1,277 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 53x18
+          text run at (0,0) width 53: "Test for "
+        RenderInline {I} at (0,0) size 685x18
+          RenderInline {A} at (0,0) size 348x18 [color=#0000EE]
+            RenderText {#text} at (53,0) size 348x18
+              text run at (53,0) width 348: "http://bugzilla.opendarwin.org/show_bug.cgi?id=8848"
+          RenderText {#text} at (401,0) size 337x18
+            text run at (401,0) width 4: " "
+            text run at (405,0) width 333: "TFOOT borders are copied to THEAD and TBODY"
+        RenderText {#text} at (738,0) size 4x18
+          text run at (738,0) width 4: "."
+      RenderBlock {HR} at (0,34) size 784x2 [border: (1px inset #000000)]
+      RenderTable {TABLE} at (0,44) size 418x208
+        RenderTableSection {TBODY} at (0,0) size 418x208
+          RenderTableRow {TR} at (0,2) size 418x204
+            RenderTableCell {TD} at (2,2) size 102x204 [r=0 c=0 rs=1 cs=1]
+              RenderTable {TABLE} at (11,11) size 86x54 [border: none]
+                RenderTableSection {THEAD} at (0,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TH} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x50
+                        text run at (1,2) width 50: "Header"
+                RenderTableSection {TBODY} at (21,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x47
+                        text run at (1,2) width 47: "Body 1"
+                RenderTableSection {TBODY} at (42,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x47
+                        text run at (1,2) width 47: "Body 2"
+                RenderTableSection {TFOOT} at (63,0) size 22x53 [border: none (2px solid #0000FF) none (2px solid #008000)]
+                  RenderTableRow {TR} at (0,0) size 22x53
+                    RenderTableCell {TD} at (0,0) size 22x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (2,2) size 18x41
+                        text run at (2,2) width 41: "Footer"
+              RenderTable {TABLE} at (11,75) size 86x54 [border: none]
+                RenderTableSection {TBODY} at (21,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x47
+                        text run at (1,2) width 47: "Body 1"
+                RenderTableSection {THEAD} at (0,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TH} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x50
+                        text run at (1,2) width 50: "Header"
+                RenderTableSection {TBODY} at (42,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x47
+                        text run at (1,2) width 47: "Body 2"
+                RenderTableSection {TFOOT} at (63,0) size 22x53 [border: none (2px solid #0000FF) none (2px solid #008000)]
+                  RenderTableRow {TR} at (0,0) size 22x53
+                    RenderTableCell {TD} at (0,0) size 22x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (2,2) size 18x41
+                        text run at (2,2) width 41: "Footer"
+              RenderTable {TABLE} at (11,139) size 86x54 [border: none]
+                RenderTableSection {TBODY} at (21,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x47
+                        text run at (1,2) width 47: "Body 1"
+                RenderTableSection {THEAD} at (0,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TH} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x50
+                        text run at (1,2) width 50: "Header"
+                RenderTableSection {TFOOT} at (63,0) size 22x53 [border: none (2px solid #0000FF) none (2px solid #008000)]
+                  RenderTableRow {TR} at (0,0) size 22x53
+                    RenderTableCell {TD} at (0,0) size 22x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (2,2) size 18x41
+                        text run at (2,2) width 41: "Footer"
+                RenderTableSection {TBODY} at (42,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x47
+                        text run at (1,2) width 47: "Body 2"
+            RenderTableCell {TD} at (106,2) size 102x204 [r=0 c=1 rs=1 cs=1]
+              RenderTable {TABLE} at (11,11) size 86x54 [border: none]
+                RenderTableSection {TBODY} at (21,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x47
+                        text run at (1,2) width 47: "Body 1"
+                RenderTableSection {TFOOT} at (63,0) size 22x53 [border: none (2px solid #0000FF) none (2px solid #008000)]
+                  RenderTableRow {TR} at (0,0) size 22x53
+                    RenderTableCell {TD} at (0,0) size 22x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (2,2) size 18x41
+                        text run at (2,2) width 41: "Footer"
+                RenderTableSection {THEAD} at (0,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TH} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x50
+                        text run at (1,2) width 50: "Header"
+                RenderTableSection {TBODY} at (42,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x47
+                        text run at (1,2) width 47: "Body 2"
+              RenderTable {TABLE} at (11,75) size 86x54 [border: none]
+                RenderTableSection {TFOOT} at (63,0) size 22x53 [border: none (2px solid #0000FF) none (2px solid #008000)]
+                  RenderTableRow {TR} at (0,0) size 22x53
+                    RenderTableCell {TD} at (0,0) size 22x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (2,2) size 18x41
+                        text run at (2,2) width 41: "Footer"
+                RenderTableSection {TBODY} at (21,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x47
+                        text run at (1,2) width 47: "Body 1"
+                RenderTableSection {THEAD} at (0,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TH} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x50
+                        text run at (1,2) width 50: "Header"
+                RenderTableSection {TBODY} at (42,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x47
+                        text run at (1,2) width 47: "Body 2"
+              RenderTable {TABLE} at (11,139) size 86x54 [border: none]
+                RenderTableSection {TBODY} at (21,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x47
+                        text run at (1,2) width 47: "Body 1"
+                RenderTableSection {TBODY} at (42,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x47
+                        text run at (1,2) width 47: "Body 2"
+                RenderTableSection {TFOOT} at (63,0) size 22x53 [border: none (2px solid #0000FF) none (2px solid #008000)]
+                  RenderTableRow {TR} at (0,0) size 22x53
+                    RenderTableCell {TD} at (0,0) size 22x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (2,2) size 18x41
+                        text run at (2,2) width 41: "Footer"
+                RenderTableSection {THEAD} at (0,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TH} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x50
+                        text run at (1,2) width 50: "Header"
+            RenderTableCell {TD} at (210,2) size 102x204 [r=0 c=2 rs=1 cs=1]
+              RenderTable {TABLE} at (11,11) size 88x54 [border: none]
+                RenderTableSection {THEAD} at (1,0) size 22x53 [border: none (2px solid #0000FF) none (2px solid #008000)]
+                  RenderTableRow {TR} at (0,0) size 22x53
+                    RenderTableCell {TH} at (0,0) size 22x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (2,2) size 18x50
+                        text run at (2,2) width 50: "Header"
+                RenderTableSection {TBODY} at (23,0) size 22x53
+                  RenderTableRow {TR} at (0,0) size 22x53
+                    RenderTableCell {TD} at (0,0) size 22x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (2,2) size 18x47
+                        text run at (2,2) width 47: "Body 1"
+                RenderTableSection {TBODY} at (45,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x47
+                        text run at (1,2) width 47: "Body 2"
+                RenderTableSection {TFOOT} at (66,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x41
+                        text run at (1,2) width 41: "Footer"
+              RenderTable {TABLE} at (11,75) size 88x54 [border: none]
+                RenderTableSection {TBODY} at (23,0) size 22x53
+                  RenderTableRow {TR} at (0,0) size 22x53
+                    RenderTableCell {TD} at (0,0) size 22x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (2,2) size 18x47
+                        text run at (2,2) width 47: "Body 1"
+                RenderTableSection {THEAD} at (1,0) size 22x53 [border: none (2px solid #0000FF) none (2px solid #008000)]
+                  RenderTableRow {TR} at (0,0) size 22x53
+                    RenderTableCell {TH} at (0,0) size 22x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (2,2) size 18x50
+                        text run at (2,2) width 50: "Header"
+                RenderTableSection {TBODY} at (45,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x47
+                        text run at (1,2) width 47: "Body 2"
+                RenderTableSection {TFOOT} at (66,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x41
+                        text run at (1,2) width 41: "Footer"
+              RenderTable {TABLE} at (11,139) size 88x54 [border: none]
+                RenderTableSection {TBODY} at (23,0) size 22x53
+                  RenderTableRow {TR} at (0,0) size 22x53
+                    RenderTableCell {TD} at (0,0) size 22x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (2,2) size 18x47
+                        text run at (2,2) width 47: "Body 1"
+                RenderTableSection {THEAD} at (1,0) size 22x53 [border: none (2px solid #0000FF) none (2px solid #008000)]
+                  RenderTableRow {TR} at (0,0) size 22x53
+                    RenderTableCell {TH} at (0,0) size 22x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (2,2) size 18x50
+                        text run at (2,2) width 50: "Header"
+                RenderTableSection {TFOOT} at (66,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x41
+                        text run at (1,2) width 41: "Footer"
+                RenderTableSection {TBODY} at (45,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x47
+                        text run at (1,2) width 47: "Body 2"
+            RenderTableCell {TD} at (314,2) size 102x204 [r=0 c=3 rs=1 cs=1]
+              RenderTable {TABLE} at (11,11) size 88x54 [border: none]
+                RenderTableSection {TBODY} at (23,0) size 22x53
+                  RenderTableRow {TR} at (0,0) size 22x53
+                    RenderTableCell {TD} at (0,0) size 22x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (2,2) size 18x47
+                        text run at (2,2) width 47: "Body 1"
+                RenderTableSection {TFOOT} at (66,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x41
+                        text run at (1,2) width 41: "Footer"
+                RenderTableSection {THEAD} at (1,0) size 22x53 [border: none (2px solid #0000FF) none (2px solid #008000)]
+                  RenderTableRow {TR} at (0,0) size 22x53
+                    RenderTableCell {TH} at (0,0) size 22x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (2,2) size 18x50
+                        text run at (2,2) width 50: "Header"
+                RenderTableSection {TBODY} at (45,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x47
+                        text run at (1,2) width 47: "Body 2"
+              RenderTable {TABLE} at (11,75) size 88x54 [border: none]
+                RenderTableSection {TFOOT} at (66,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x41
+                        text run at (1,2) width 41: "Footer"
+                RenderTableSection {TBODY} at (23,0) size 22x53
+                  RenderTableRow {TR} at (0,0) size 22x53
+                    RenderTableCell {TD} at (0,0) size 22x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (2,2) size 18x47
+                        text run at (2,2) width 47: "Body 1"
+                RenderTableSection {THEAD} at (1,0) size 22x53 [border: none (2px solid #0000FF) none (2px solid #008000)]
+                  RenderTableRow {TR} at (0,0) size 22x53
+                    RenderTableCell {TH} at (0,0) size 22x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (2,2) size 18x50
+                        text run at (2,2) width 50: "Header"
+                RenderTableSection {TBODY} at (45,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x47
+                        text run at (1,2) width 47: "Body 2"
+              RenderTable {TABLE} at (11,139) size 88x54 [border: none]
+                RenderTableSection {TBODY} at (23,0) size 22x53
+                  RenderTableRow {TR} at (0,0) size 22x53
+                    RenderTableCell {TD} at (0,0) size 22x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (2,2) size 18x47
+                        text run at (2,2) width 47: "Body 1"
+                RenderTableSection {TBODY} at (45,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x47
+                        text run at (1,2) width 47: "Body 2"
+                RenderTableSection {TFOOT} at (66,0) size 21x53
+                  RenderTableRow {TR} at (0,0) size 21x53
+                    RenderTableCell {TD} at (0,0) size 21x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x41
+                        text run at (1,2) width 41: "Footer"
+                RenderTableSection {THEAD} at (1,0) size 22x53 [border: none (2px solid #0000FF) none (2px solid #008000)]
+                  RenderTableRow {TR} at (0,0) size 22x53
+                    RenderTableCell {TH} at (0,0) size 22x53 [border: (1px solid #D3D3D3)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (2,2) size 18x50
+                        text run at (2,2) width 50: "Header"
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.checksum
new file mode 100644
index 0000000..172e0c6
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.checksum
@@ -0,0 +1 @@
+8e9f5a4d2910747d420ec62c2afb753c
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.png b/LayoutTests/platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.png
new file mode 100644
index 0000000..0c2017a
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.txt
new file mode 100644
index 0000000..3a5cb6f
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.txt
@@ -0,0 +1,137 @@
+layer at (0,0) size 785x634
+  RenderView at (0,0) size 785x600
+layer at (0,0) size 785x634
+  RenderBlock {HTML} at (0,0) size 785x634
+    RenderBody {BODY} at (8,8) size 769x618
+      RenderBlock {DIV} at (0,0) size 206x206 [border: (3px solid #000000)]
+        RenderTable {TABLE} at (3,3) size 50x118
+          RenderTableCol {COLGROUP} at (0,0) size 0x0
+          RenderTableCol {COLGROUP} at (0,0) size 0x0 [border: (5px solid #007F007F) none]
+          RenderTableCol {COLGROUP} at (0,0) size 0x0 [border: (5px solid #FF0000) none]
+          RenderTableSection {TBODY} at (0,0) size 50x118
+            RenderTableRow {TR} at (0,0) size 25x118
+              RenderTableCell {TD} at (0,10) size 25x9 [border: none (2px solid #007F007F)] [r=0 c=0 rs=1 cs=1]
+              RenderTableCell {TD} at (0,40) size 25x7 [border: (3px solid #FF0000) none] [r=0 c=1 rs=1 cs=1]
+              RenderTableCell {TD} at (0,70) size 25x6 [border: none] [r=0 c=2 rs=1 cs=1]
+              RenderTableCell {TD} at (0,99) size 25x7 [border: (3px none #000000)] [r=0 c=3 rs=1 cs=1]
+            RenderTableRow {TR} at (0,25) size 25x118
+              RenderTableCell {TD} at (25,10) size 25x8 [border: none (2px solid #FF0000) none] [r=1 c=0 rs=1 cs=1]
+              RenderTableCell {TD} at (25,40) size 25x7 [r=1 c=1 rs=1 cs=1]
+              RenderTableCell {TD} at (25,70) size 25x6 [border: none] [r=1 c=2 rs=1 cs=1]
+              RenderTableCell {TD} at (25,99) size 25x7 [border: (3px none #000000)] [r=1 c=3 rs=1 cs=1]
+        RenderTable {TABLE} at (53,3) size 50x118
+          RenderTableCol {COLGROUP} at (0,0) size 0x0
+          RenderTableCol {COLGROUP} at (0,0) size 0x0 [border: (5px solid #007F007F) none]
+          RenderTableCol {COLGROUP} at (0,0) size 0x0 [border: (5px solid #FF0000) none]
+          RenderTableSection {TBODY} at (0,0) size 50x118
+            RenderTableRow {TR} at (0,0) size 25x118
+              RenderTableCell {TD} at (0,98) size 25x10 [border: (3px solid #007F007F) none (3px solid #007F007F)] [r=0 c=0 rs=1 cs=1]
+              RenderTableCell {TD} at (0,70) size 25x6 [border: none (2px solid #FF0000) none] [r=0 c=1 rs=1 cs=1]
+              RenderTableCell {TD} at (0,40) size 25x7 [border: (3px none #000000)] [r=0 c=2 rs=1 cs=1]
+              RenderTableCell {TD} at (0,11) size 25x6 [border: none] [r=0 c=3 rs=1 cs=1]
+            RenderTableRow {TR} at (0,25) size 25x118
+              RenderTableCell {TD} at (25,98) size 25x9 [border: none (2px solid #FF0000) none] [r=1 c=0 rs=1 cs=1]
+              RenderTableCell {TD} at (25,70) size 25x6 [r=1 c=1 rs=1 cs=1]
+              RenderTableCell {TD} at (25,40) size 25x7 [border: (3px none #000000)] [r=1 c=2 rs=1 cs=1]
+              RenderTableCell {TD} at (25,11) size 25x6 [border: none] [r=1 c=3 rs=1 cs=1]
+        RenderTable {TABLE} at (103,3) size 50x27
+          RenderTableSection {TBODY} at (0,0) size 50x27
+            RenderTableRow {TR} at (0,0) size 25x27 [border: none (5px solid #007F007F)]
+              RenderTableCell {TD} at (0,10) size 25x7 [border: none] [r=0 c=0 rs=1 cs=1]
+            RenderTableRow {TR} at (0,25) size 25x27 [border: none (5px solid #FF0000) none]
+              RenderTableCell {TD} at (25,10) size 25x6 [border: none] [r=1 c=0 rs=1 cs=1]
+        RenderTable {TABLE} at (153,3) size 50x27
+          RenderTableSection {TBODY} at (0,0) size 25x27 [border: none (5px solid #007F007F)]
+            RenderTableRow {TR} at (0,0) size 25x27
+              RenderTableCell {TD} at (0,10) size 25x7 [border: none] [r=0 c=0 rs=1 cs=1]
+          RenderTableSection {TBODY} at (25,0) size 25x27 [border: none (5px solid #FF0000) none]
+            RenderTableRow {TR} at (0,0) size 25x27
+              RenderTableCell {TD} at (0,10) size 25x6 [border: none] [r=0 c=0 rs=1 cs=1]
+      RenderBlock {DIV} at (0,206) size 206x206 [border: (3px solid #000000)]
+        RenderTable {TABLE} at (3,3) size 118x50
+          RenderTableCol {COLGROUP} at (0,0) size 0x0
+          RenderTableCol {COLGROUP} at (0,0) size 0x0 [border: (5px solid #007F007F) none]
+          RenderTableCol {COLGROUP} at (0,0) size 0x0 [border: (5px solid #FF0000)]
+          RenderTableSection {TBODY} at (0,0) size 118x50
+            RenderTableRow {TR} at (0,0) size 118x25
+              RenderTableCell {TD} at (0,10) size 29x5 [border: (3px solid #007F007F) none] [r=0 c=0 rs=1 cs=1]
+              RenderTableCell {TD} at (29,11) size 30x2 [border: none (3px solid #FF0000)] [r=0 c=1 rs=1 cs=1]
+              RenderTableCell {TD} at (59,11) size 29x2 [border: none] [r=0 c=2 rs=1 cs=1]
+              RenderTableCell {TD} at (88,11) size 30x2 [border: none] [r=0 c=3 rs=1 cs=1]
+            RenderTableRow {TR} at (0,25) size 118x25
+              RenderTableCell {TD} at (0,35) size 29x4 [border: none (2px solid #FF0000) none] [r=1 c=0 rs=1 cs=1]
+              RenderTableCell {TD} at (29,36) size 30x2 [r=1 c=1 rs=1 cs=1]
+              RenderTableCell {TD} at (59,36) size 29x2 [border: none] [r=1 c=2 rs=1 cs=1]
+              RenderTableCell {TD} at (88,36) size 30x2 [border: none] [r=1 c=3 rs=1 cs=1]
+        RenderTable {TABLE} at (3,53) size 118x50
+          RenderTableCol {COLGROUP} at (0,0) size 0x0
+          RenderTableCol {COLGROUP} at (0,0) size 0x0 [border: (5px solid #007F007F)]
+          RenderTableCol {COLGROUP} at (0,0) size 0x0 [border: (5px solid #FF0000) none]
+          RenderTableSection {TBODY} at (0,0) size 118x50
+            RenderTableRow {TR} at (0,0) size 118x25
+              RenderTableCell {TD} at (88,10) size 30x5 [border: (3px solid #007F007F) none (3px solid #007F007F)] [r=0 c=0 rs=1 cs=1]
+              RenderTableCell {TD} at (59,11) size 29x2 [border: none (2px solid #FF0000) none] [r=0 c=1 rs=1 cs=1]
+              RenderTableCell {TD} at (29,11) size 30x2 [border: none] [r=0 c=2 rs=1 cs=1]
+              RenderTableCell {TD} at (0,11) size 29x2 [border: none] [r=0 c=3 rs=1 cs=1]
+            RenderTableRow {TR} at (0,25) size 118x25
+              RenderTableCell {TD} at (88,35) size 30x4 [border: none (2px solid #FF0000) none] [r=1 c=0 rs=1 cs=1]
+              RenderTableCell {TD} at (59,36) size 29x2 [r=1 c=1 rs=1 cs=1]
+              RenderTableCell {TD} at (29,36) size 30x2 [border: none] [r=1 c=2 rs=1 cs=1]
+              RenderTableCell {TD} at (0,36) size 29x2 [border: none] [r=1 c=3 rs=1 cs=1]
+        RenderTable {TABLE} at (3,103) size 27x50
+          RenderTableSection {TBODY} at (0,0) size 27x50
+            RenderTableRow {TR} at (0,0) size 27x25 [border: (5px solid #007F007F) none]
+              RenderTableCell {TD} at (0,10) size 27x5 [border: (3px none #000000)] [r=0 c=0 rs=1 cs=1]
+            RenderTableRow {TR} at (0,25) size 27x25 [border: none (5px solid #FF0000) none]
+              RenderTableCell {TD} at (0,35) size 27x4 [border: none] [r=1 c=0 rs=1 cs=1]
+        RenderTable {TABLE} at (3,153) size 27x50
+          RenderTableSection {TBODY} at (0,0) size 27x25 [border: (5px solid #007F007F) none]
+            RenderTableRow {TR} at (0,0) size 27x25
+              RenderTableCell {TD} at (0,10) size 27x5 [border: (3px none #000000)] [r=0 c=0 rs=1 cs=1]
+          RenderTableSection {TBODY} at (0,25) size 27x25 [border: none (5px solid #FF0000) none]
+            RenderTableRow {TR} at (0,0) size 27x25
+              RenderTableCell {TD} at (0,10) size 27x4 [border: none] [r=0 c=0 rs=1 cs=1]
+      RenderBlock {DIV} at (0,412) size 206x206 [border: (3px solid #000000)]
+        RenderTable {TABLE} at (3,3) size 50x118
+          RenderTableCol {COLGROUP} at (0,0) size 0x0
+          RenderTableCol {COLGROUP} at (0,0) size 0x0 [border: (5px solid #007F007F) none]
+          RenderTableCol {COLGROUP} at (0,0) size 0x0 [border: (5px solid #FF0000) none]
+          RenderTableSection {TBODY} at (0,0) size 50x118
+            RenderTableRow {TR} at (0,0) size 25x118
+              RenderTableCell {TD} at (0,10) size 25x8 [border: none (2px solid #007F007F) none] [r=0 c=0 rs=1 cs=1]
+              RenderTableCell {TD} at (0,40) size 25x7 [border: (3px solid #FF0000) none] [r=0 c=1 rs=1 cs=1]
+              RenderTableCell {TD} at (0,70) size 25x6 [border: none] [r=0 c=2 rs=1 cs=1]
+              RenderTableCell {TD} at (0,99) size 25x7 [border: (3px none #000000)] [r=0 c=3 rs=1 cs=1]
+            RenderTableRow {TR} at (0,25) size 25x118
+              RenderTableCell {TD} at (25,10) size 25x9 [border: none (3px solid #FF0000)] [r=1 c=0 rs=1 cs=1]
+              RenderTableCell {TD} at (25,40) size 25x7 [r=1 c=1 rs=1 cs=1]
+              RenderTableCell {TD} at (25,70) size 25x6 [border: none] [r=1 c=2 rs=1 cs=1]
+              RenderTableCell {TD} at (25,99) size 25x7 [border: (3px none #000000)] [r=1 c=3 rs=1 cs=1]
+        RenderTable {TABLE} at (53,3) size 50x118
+          RenderTableCol {COLGROUP} at (0,0) size 0x0
+          RenderTableCol {COLGROUP} at (0,0) size 0x0 [border: (5px solid #007F007F) none]
+          RenderTableCol {COLGROUP} at (0,0) size 0x0 [border: (5px solid #FF0000) none]
+          RenderTableSection {TBODY} at (0,0) size 50x118
+            RenderTableRow {TR} at (0,0) size 25x118
+              RenderTableCell {TD} at (0,98) size 25x9 [border: (3px solid #007F007F) none] [r=0 c=0 rs=1 cs=1]
+              RenderTableCell {TD} at (0,70) size 25x6 [border: none (2px solid #FF0000) none] [r=0 c=1 rs=1 cs=1]
+              RenderTableCell {TD} at (0,40) size 25x7 [border: (3px none #000000)] [r=0 c=2 rs=1 cs=1]
+              RenderTableCell {TD} at (0,11) size 25x6 [border: none] [r=0 c=3 rs=1 cs=1]
+            RenderTableRow {TR} at (0,25) size 25x118
+              RenderTableCell {TD} at (25,98) size 25x10 [border: none (3px solid #FF0000)] [r=1 c=0 rs=1 cs=1]
+              RenderTableCell {TD} at (25,70) size 25x6 [r=1 c=1 rs=1 cs=1]
+              RenderTableCell {TD} at (25,40) size 25x7 [border: (3px none #000000)] [r=1 c=2 rs=1 cs=1]
+              RenderTableCell {TD} at (25,11) size 25x6 [border: none] [r=1 c=3 rs=1 cs=1]
+        RenderTable {TABLE} at (103,3) size 50x27
+          RenderTableSection {TBODY} at (0,0) size 50x27
+            RenderTableRow {TR} at (0,0) size 25x27 [border: none (5px solid #007F007F) none]
+              RenderTableCell {TD} at (0,10) size 25x6 [border: none] [r=0 c=0 rs=1 cs=1]
+            RenderTableRow {TR} at (0,25) size 25x27 [border: none (5px solid #FF0000)]
+              RenderTableCell {TD} at (25,10) size 25x7 [border: none] [r=1 c=0 rs=1 cs=1]
+        RenderTable {TABLE} at (153,3) size 50x27
+          RenderTableSection {TBODY} at (0,0) size 25x27 [border: none (5px solid #007F007F) none]
+            RenderTableRow {TR} at (0,0) size 25x27
+              RenderTableCell {TD} at (0,10) size 25x6 [border: none] [r=0 c=0 rs=1 cs=1]
+          RenderTableSection {TBODY} at (25,0) size 25x27 [border: none (5px solid #FF0000)]
+            RenderTableRow {TR} at (0,0) size 25x27
+              RenderTableCell {TD} at (0,10) size 25x7 [border: none] [r=0 c=0 rs=1 cs=1]
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/rtl-border-collapsing-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/border-collapsing/rtl-border-collapsing-vertical-expected.checksum
new file mode 100644
index 0000000..a4afdda
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/border-collapsing/rtl-border-collapsing-vertical-expected.checksum
@@ -0,0 +1 @@
+5740c0ffe2058ab47f93587a44c95e89
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/rtl-border-collapsing-vertical-expected.png b/LayoutTests/platform/mac/fast/table/border-collapsing/rtl-border-collapsing-vertical-expected.png
new file mode 100644
index 0000000..c159b70
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/border-collapsing/rtl-border-collapsing-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/border-collapsing/rtl-border-collapsing-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/border-collapsing/rtl-border-collapsing-vertical-expected.txt
new file mode 100644
index 0000000..8789b73
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/border-collapsing/rtl-border-collapsing-vertical-expected.txt
@@ -0,0 +1,105 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 212x18
+          text run at (0,0) width 212: "This tests for a regression against "
+        RenderInline {I} at (0,0) size 773x36
+          RenderInline {A} at (0,0) size 348x18 [color=#0000EE]
+            RenderText {#text} at (212,0) size 348x18
+              text run at (212,0) width 348: "http://bugzilla.opendarwin.org/show_bug.cgi?id=6888"
+          RenderText {#text} at (560,0) size 773x36
+            text run at (560,0) width 213: " Collapsed borders appear on the"
+            text run at (0,18) width 291: "wrong side or on the wrong cell in RTL tables"
+        RenderText {#text} at (291,18) size 4x18
+          text run at (291,18) width 4: "."
+      RenderBlock {P} at (0,52) size 784x18
+        RenderText {#text} at (0,0) size 368x18
+          text run at (0,0) width 368: "The RTL table should be a mirror image of the LTR table."
+      RenderBlock {HR} at (0,86) size 784x2 [border: (1px inset #000000)]
+      RenderTable {TABLE} at (0,96) size 74x139
+        RenderTableSection {TBODY} at (0,0) size 74x139
+          RenderTableRow {TR} at (0,0) size 26x139
+            RenderTableCell {TD} at (0,0) size 26x70 [border: none (1px solid #000000) none] [r=0 c=0 rs=1 cs=1]
+              RenderText {#text} at (4,19) size 18x31
+                text run at (4,19) width 31: "RTL"
+            RenderTableCell {TD} at (0,70) size 26x69 [r=0 c=1 rs=1 cs=1]
+              RenderText {#text} at (4,19) size 18x31
+                text run at (4,19) width 31: "LTR"
+          RenderTableRow {TR} at (0,26) size 48x139
+            RenderTableCell {TD} at (26,0) size 48x70 [border: none (1px solid #000000) none] [r=1 c=0 rs=1 cs=1]
+              RenderTable {TABLE} at (4,4) size 40x61 [border: (1px solid #0000FF) none (1px solid #FF0000) none]
+                RenderTableCol {COLGROUP} at (0,0) size 0x0
+                  RenderTableCol {COL} at (0,0) size 0x0
+                  RenderTableCol {COL} at (0,0) size 0x0
+                  RenderTableCol {COL} at (0,0) size 0x0 [bgcolor=#FFFF00] [border: (2px dotted #008000) none (1px solid #000000) none]
+                  RenderTableCol {COL} at (0,0) size 0x0 [bgcolor=#C0C0C0]
+                RenderTableSection {TBODY} at (0,1) size 40x59
+                  RenderTableRow {TR} at (0,0) size 20x59
+                    RenderTableCell {TD} at (0,46) size 20x13 [border: none] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,3) size 18x8
+                        text run at (1,3) width 8 RTL: "  "
+                    RenderTableCell {TD} at (0,33) size 20x13 [border: (1px none #000000)] [r=0 c=1 rs=1 cs=1]
+                      RenderText {#text} at (1,4) size 18x8
+                        text run at (1,4) width 8 RTL: "  "
+                    RenderTableCell {TD} at (0,11) size 20x22 [r=0 c=2 rs=1 cs=2]
+                      RenderText {#text} at (1,13) size 18x8
+                        text run at (1,13) width 8 RTL: "  "
+                    RenderTableCell {TD} at (0,0) size 20x11 [border: (1px none #000000)] [r=0 c=4 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x8
+                        text run at (1,2) width 8 RTL: "  "
+                  RenderTableRow {TR} at (0,20) size 20x59
+                    RenderTableCell {TD} at (20,46) size 20x13 [border: (2px solid #800000) none] [r=1 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,3) size 18x8
+                        text run at (1,3) width 8 RTL: "  "
+                    RenderTableCell {TD} at (20,33) size 20x13 [border: (1px none #000000)] [r=1 c=1 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x8
+                        text run at (1,2) width 8 RTL: "  "
+                    RenderTableCell {TD} at (20,22) size 20x11 [border: (1px none #000000)] [r=1 c=2 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x8
+                        text run at (1,2) width 8 RTL: "  "
+                    RenderTableCell {TD} at (20,11) size 20x11 [border: none] [r=1 c=3 rs=1 cs=1]
+                      RenderText {#text} at (1,1) size 18x8
+                        text run at (1,1) width 8 RTL: "  "
+                    RenderTableCell {TD} at (20,0) size 20x11 [border: (1px none #000000)] [r=1 c=4 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x8
+                        text run at (1,2) width 8 RTL: "  "
+            RenderTableCell {TD} at (26,70) size 48x69 [r=1 c=1 rs=1 cs=1]
+              RenderTable {TABLE} at (4,4) size 40x61 [border: (1px solid #FF0000) none (1px solid #0000FF) none]
+                RenderTableCol {COLGROUP} at (0,0) size 0x0
+                  RenderTableCol {COL} at (0,0) size 0x0
+                  RenderTableCol {COL} at (0,0) size 0x0
+                  RenderTableCol {COL} at (0,0) size 0x0 [bgcolor=#FFFF00] [border: (1px solid #000000) none (2px dotted #008000) none]
+                  RenderTableCol {COL} at (0,0) size 0x0 [bgcolor=#C0C0C0]
+                RenderTableSection {TBODY} at (0,1) size 40x59
+                  RenderTableRow {TR} at (0,0) size 20x59
+                    RenderTableCell {TD} at (0,0) size 20x13 [border: (1px none #000000)] [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x8
+                        text run at (1,2) width 8: "  "
+                    RenderTableCell {TD} at (0,13) size 20x12 [r=0 c=1 rs=1 cs=1]
+                      RenderText {#text} at (1,1) size 18x8
+                        text run at (1,1) width 8: "  "
+                    RenderTableCell {TD} at (0,25) size 20x23 [border: (1px none #000000)] [r=0 c=2 rs=1 cs=2]
+                      RenderText {#text} at (1,2) size 18x8
+                        text run at (1,2) width 8: "  "
+                    RenderTableCell {TD} at (0,48) size 20x11 [border: none] [r=0 c=4 rs=1 cs=1]
+                      RenderText {#text} at (1,1) size 18x8
+                        text run at (1,1) width 8: "  "
+                  RenderTableRow {TR} at (0,20) size 20x59
+                    RenderTableCell {TD} at (20,0) size 20x13 [border: (1px none #000000) (2px solid #800000) none] [r=1 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x8
+                        text run at (1,2) width 8: "  "
+                    RenderTableCell {TD} at (20,13) size 20x12 [border: (2px none #000000)] [r=1 c=1 rs=1 cs=1]
+                      RenderText {#text} at (1,3) size 18x8
+                        text run at (1,3) width 8: "  "
+                    RenderTableCell {TD} at (20,25) size 20x12 [border: (1px none #000000)] [r=1 c=2 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x8
+                        text run at (1,2) width 8: "  "
+                    RenderTableCell {TD} at (20,37) size 20x11 [border: (1px none #000000)] [r=1 c=3 rs=1 cs=1]
+                      RenderText {#text} at (1,2) size 18x8
+                        text run at (1,2) width 8: "  "
+                    RenderTableCell {TD} at (20,48) size 20x11 [border: none] [r=1 c=4 rs=1 cs=1]
+                      RenderText {#text} at (1,1) size 18x8
+                        text run at (1,1) width 8: "  "
diff --git a/LayoutTests/platform/mac/fast/table/colspanMinWidth-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/colspanMinWidth-vertical-expected.checksum
new file mode 100644
index 0000000..10d4da4
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/colspanMinWidth-vertical-expected.checksum
@@ -0,0 +1 @@
+0a56791e922ec17cf524cca618a3135b
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/colspanMinWidth-vertical-expected.png b/LayoutTests/platform/mac/fast/table/colspanMinWidth-vertical-expected.png
new file mode 100644
index 0000000..c8775fb
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/colspanMinWidth-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/colspanMinWidth-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/colspanMinWidth-vertical-expected.txt
new file mode 100644
index 0000000..3d1d52d
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/colspanMinWidth-vertical-expected.txt
@@ -0,0 +1,24 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderTable {TABLE} at (0,0) size 32x149
+        RenderTableSection {TBODY} at (0,0) size 32x149
+          RenderTableRow {TR} at (0,2) size 2x149
+            RenderTableCell {TD} at (2,2) size 2x3 [bgcolor=#0000FF] [r=0 c=0 rs=1 cs=1]
+          RenderTableRow {TR} at (0,6) size 0x149
+            RenderTableCell {TD} at (6,2) size 2x141 [bgcolor=#008000] [r=1 c=0 rs=2 cs=2]
+          RenderTableRow {TR} at (0,8) size 0x149
+            RenderTableCell {TD} at (8,155) size 22x-18 [bgcolor=#FF0000] [r=2 c=2 rs=2 cs=1]
+          RenderTableRow {TR} at (0,10) size 20x149
+            RenderTableCell {TD} at (10,2) size 20x141 [bgcolor=#00FFFF] [r=3 c=0 rs=1 cs=2]
+              RenderTable {TABLE} at (1,1) size 18x139
+                RenderTableSection {TBODY} at (0,0) size 18x139
+                  RenderTableRow {TR} at (0,2) size 14x139
+                    RenderTableCell {TD} at (2,8) size 14x-10 [bgcolor=#FF00FF] [r=0 c=0 rs=1 cs=1]
+                    RenderTableCell {TD} at (2,6) size 14x131 [bgcolor=#FFFF00] [r=0 c=1 rs=1 cs=1]
+                      RenderTextControl {INPUT} at (3,3) size 8x125 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+                      RenderText {#text} at (0,0) size 0x0
+layer at (22,23) size 2x119
+  RenderBlock {DIV} at (3,3) size 2x119
diff --git a/LayoutTests/platform/mac/fast/table/fixed-with-auto-with-colspan-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/fixed-with-auto-with-colspan-vertical-expected.checksum
new file mode 100644
index 0000000..28cb528
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/fixed-with-auto-with-colspan-vertical-expected.checksum
@@ -0,0 +1 @@
+49e9262214b36e436b1dce9bfeccaa2e
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/fixed-with-auto-with-colspan-vertical-expected.png b/LayoutTests/platform/mac/fast/table/fixed-with-auto-with-colspan-vertical-expected.png
new file mode 100644
index 0000000..27a9551
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/fixed-with-auto-with-colspan-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/fixed-with-auto-with-colspan-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/fixed-with-auto-with-colspan-vertical-expected.txt
new file mode 100644
index 0000000..7dec398
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/fixed-with-auto-with-colspan-vertical-expected.txt
@@ -0,0 +1,131 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+layer at (0,0) size 385x445
+  RenderBlock (positioned) {DIV} at (0,0) size 385x0
+    RenderTable {TABLE} at (5,0) size 50x445
+      RenderTableSection {TBODY} at (0,0) size 50x445
+        RenderTableRow {TR} at (0,0) size 50x445
+          RenderTableCell {TD} at (0,29) size 50x2 [bgcolor=#FF0000] [r=0 c=0 rs=1 cs=1]
+          RenderTableCell {TD} at (0,84) size 50x2 [bgcolor=#FF0000] [r=0 c=1 rs=1 cs=1]
+          RenderTableCell {TD} at (0,139) size 50x2 [bgcolor=#FF0000] [r=0 c=2 rs=1 cs=1]
+          RenderTableCell {TD} at (0,194) size 50x2 [bgcolor=#FF0000] [r=0 c=3 rs=1 cs=1]
+          RenderTableCell {TD} at (0,249) size 50x2 [bgcolor=#FF0000] [r=0 c=4 rs=1 cs=1]
+          RenderTableCell {TD} at (0,304) size 50x2 [bgcolor=#FF0000] [r=0 c=5 rs=1 cs=1]
+          RenderTableCell {TD} at (0,359) size 50x2 [bgcolor=#FF0000] [r=0 c=6 rs=1 cs=1]
+          RenderTableCell {TD} at (0,414) size 50x2 [bgcolor=#FF0000] [r=0 c=7 rs=1 cs=1]
+    RenderTable {TABLE} at (60,0) size 50x445
+      RenderTableSection {TBODY} at (0,0) size 50x445
+        RenderTableRow {TR} at (0,0) size 50x445
+          RenderTableCell {TD} at (0,29) size 50x2 [bgcolor=#FF0000] [r=0 c=0 rs=1 cs=1]
+          RenderTableCell {TD} at (0,84) size 50x2 [bgcolor=#FF0000] [r=0 c=1 rs=1 cs=1]
+          RenderTableCell {TD} at (0,139) size 50x2 [bgcolor=#FF0000] [r=0 c=2 rs=1 cs=1]
+          RenderTableCell {TD} at (0,194) size 50x2 [bgcolor=#FF0000] [r=0 c=3 rs=1 cs=1]
+          RenderTableCell {TD} at (0,249) size 50x2 [bgcolor=#FF0000] [r=0 c=4 rs=1 cs=1]
+          RenderTableCell {TD} at (0,304) size 50x2 [bgcolor=#FF0000] [r=0 c=5 rs=1 cs=1]
+          RenderTableCell {TD} at (0,359) size 50x2 [bgcolor=#FF0000] [r=0 c=6 rs=1 cs=1]
+          RenderTableCell {TD} at (0,414) size 50x2 [bgcolor=#FF0000] [r=0 c=7 rs=1 cs=1]
+    RenderTable {TABLE} at (115,0) size 50x445
+      RenderTableSection {TBODY} at (0,0) size 50x445
+        RenderTableRow {TR} at (0,0) size 50x445
+          RenderTableCell {TD} at (0,29) size 50x2 [bgcolor=#FF0000] [r=0 c=0 rs=1 cs=1]
+          RenderTableCell {TD} at (0,84) size 50x2 [bgcolor=#FF0000] [r=0 c=1 rs=1 cs=1]
+          RenderTableCell {TD} at (0,139) size 50x2 [bgcolor=#FF0000] [r=0 c=2 rs=1 cs=1]
+          RenderTableCell {TD} at (0,194) size 50x2 [bgcolor=#FF0000] [r=0 c=3 rs=1 cs=1]
+          RenderTableCell {TD} at (0,249) size 50x2 [bgcolor=#FF0000] [r=0 c=4 rs=1 cs=1]
+          RenderTableCell {TD} at (0,304) size 50x2 [bgcolor=#FF0000] [r=0 c=5 rs=1 cs=1]
+          RenderTableCell {TD} at (0,359) size 50x2 [bgcolor=#FF0000] [r=0 c=6 rs=1 cs=1]
+          RenderTableCell {TD} at (0,414) size 50x2 [bgcolor=#FF0000] [r=0 c=7 rs=1 cs=1]
+    RenderTable {TABLE} at (170,0) size 50x445
+      RenderTableSection {TBODY} at (0,0) size 50x445
+        RenderTableRow {TR} at (0,0) size 50x445
+          RenderTableCell {TD} at (0,29) size 50x2 [bgcolor=#FF0000] [r=0 c=0 rs=1 cs=1]
+          RenderTableCell {TD} at (0,84) size 50x2 [bgcolor=#FF0000] [r=0 c=1 rs=1 cs=1]
+          RenderTableCell {TD} at (0,139) size 50x2 [bgcolor=#FF0000] [r=0 c=2 rs=1 cs=1]
+          RenderTableCell {TD} at (0,194) size 50x2 [bgcolor=#FF0000] [r=0 c=3 rs=1 cs=1]
+          RenderTableCell {TD} at (0,249) size 50x2 [bgcolor=#FF0000] [r=0 c=4 rs=1 cs=1]
+          RenderTableCell {TD} at (0,304) size 50x2 [bgcolor=#FF0000] [r=0 c=5 rs=1 cs=1]
+          RenderTableCell {TD} at (0,359) size 50x2 [bgcolor=#FF0000] [r=0 c=6 rs=1 cs=1]
+          RenderTableCell {TD} at (0,414) size 50x2 [bgcolor=#FF0000] [r=0 c=7 rs=1 cs=1]
+    RenderTable {TABLE} at (225,0) size 50x445
+      RenderTableSection {TBODY} at (0,0) size 50x445
+        RenderTableRow {TR} at (0,0) size 50x445
+          RenderTableCell {TD} at (0,29) size 50x2 [bgcolor=#FF0000] [r=0 c=0 rs=1 cs=1]
+          RenderTableCell {TD} at (0,84) size 50x2 [bgcolor=#FF0000] [r=0 c=1 rs=1 cs=1]
+          RenderTableCell {TD} at (0,139) size 50x2 [bgcolor=#FF0000] [r=0 c=2 rs=1 cs=1]
+          RenderTableCell {TD} at (0,194) size 50x2 [bgcolor=#FF0000] [r=0 c=3 rs=1 cs=1]
+          RenderTableCell {TD} at (0,249) size 50x2 [bgcolor=#FF0000] [r=0 c=4 rs=1 cs=1]
+          RenderTableCell {TD} at (0,304) size 50x2 [bgcolor=#FF0000] [r=0 c=5 rs=1 cs=1]
+          RenderTableCell {TD} at (0,359) size 50x2 [bgcolor=#FF0000] [r=0 c=6 rs=1 cs=1]
+          RenderTableCell {TD} at (0,414) size 50x2 [bgcolor=#FF0000] [r=0 c=7 rs=1 cs=1]
+    RenderTable {TABLE} at (280,0) size 50x445
+      RenderTableSection {TBODY} at (0,0) size 50x445
+        RenderTableRow {TR} at (0,0) size 50x445
+          RenderTableCell {TD} at (0,29) size 50x2 [bgcolor=#FF0000] [r=0 c=0 rs=1 cs=1]
+          RenderTableCell {TD} at (0,84) size 50x2 [bgcolor=#FF0000] [r=0 c=1 rs=1 cs=1]
+          RenderTableCell {TD} at (0,139) size 50x2 [bgcolor=#FF0000] [r=0 c=2 rs=1 cs=1]
+          RenderTableCell {TD} at (0,194) size 50x2 [bgcolor=#FF0000] [r=0 c=3 rs=1 cs=1]
+          RenderTableCell {TD} at (0,249) size 50x2 [bgcolor=#FF0000] [r=0 c=4 rs=1 cs=1]
+          RenderTableCell {TD} at (0,304) size 50x2 [bgcolor=#FF0000] [r=0 c=5 rs=1 cs=1]
+          RenderTableCell {TD} at (0,359) size 50x2 [bgcolor=#FF0000] [r=0 c=6 rs=1 cs=1]
+          RenderTableCell {TD} at (0,414) size 50x2 [bgcolor=#FF0000] [r=0 c=7 rs=1 cs=1]
+    RenderTable {TABLE} at (335,0) size 50x445
+      RenderTableSection {TBODY} at (0,0) size 50x445
+        RenderTableRow {TR} at (0,0) size 50x445
+          RenderTableCell {TD} at (0,29) size 50x2 [bgcolor=#FF0000] [r=0 c=0 rs=1 cs=1]
+          RenderTableCell {TD} at (0,84) size 50x2 [bgcolor=#FF0000] [r=0 c=1 rs=1 cs=1]
+          RenderTableCell {TD} at (0,139) size 50x2 [bgcolor=#FF0000] [r=0 c=2 rs=1 cs=1]
+          RenderTableCell {TD} at (0,194) size 50x2 [bgcolor=#FF0000] [r=0 c=3 rs=1 cs=1]
+          RenderTableCell {TD} at (0,249) size 50x2 [bgcolor=#FF0000] [r=0 c=4 rs=1 cs=1]
+          RenderTableCell {TD} at (0,304) size 50x2 [bgcolor=#FF0000] [r=0 c=5 rs=1 cs=1]
+          RenderTableCell {TD} at (0,359) size 50x2 [bgcolor=#FF0000] [r=0 c=6 rs=1 cs=1]
+          RenderTableCell {TD} at (0,414) size 50x2 [bgcolor=#FF0000] [r=0 c=7 rs=1 cs=1]
+layer at (0,0) size 385x445
+  RenderBlock (positioned) {DIV} at (0,0) size 385x0
+    RenderTable {TABLE} at (5,0) size 50x445
+      RenderTableSection {TBODY} at (0,0) size 50x445
+        RenderTableRow {TR} at (0,0) size 50x445
+          RenderTableCell {TD} at (0,29) size 50x2 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+          RenderTableCell {TD} at (0,84) size 50x2 [bgcolor=#008000] [r=0 c=1 rs=1 cs=1]
+          RenderTableCell {TD} at (0,139) size 50x2 [bgcolor=#008000] [r=0 c=2 rs=1 cs=1]
+          RenderTableCell {TD} at (0,194) size 50x2 [bgcolor=#008000] [r=0 c=3 rs=1 cs=1]
+          RenderTableCell {TD} at (0,249) size 50x2 [bgcolor=#008000] [r=0 c=4 rs=1 cs=1]
+          RenderTableCell {TD} at (0,304) size 50x2 [bgcolor=#008000] [r=0 c=5 rs=1 cs=1]
+          RenderTableCell {TD} at (0,359) size 50x2 [bgcolor=#008000] [r=0 c=6 rs=1 cs=1]
+          RenderTableCell {TD} at (0,414) size 50x2 [bgcolor=#008000] [r=0 c=7 rs=1 cs=1]
+    RenderTable {TABLE} at (60,0) size 50x445
+      RenderTableSection {TBODY} at (0,0) size 50x445
+        RenderTableRow {TR} at (0,0) size 50x445
+          RenderTableCell {TD} at (0,29) size 50x112 [bgcolor=#008000] [r=0 c=0 rs=1 cs=3]
+          RenderTableCell {TD} at (0,194) size 50x222 [bgcolor=#008000] [r=0 c=3 rs=1 cs=5]
+    RenderTable {TABLE} at (115,0) size 50x445
+      RenderTableSection {TBODY} at (0,0) size 50x445
+        RenderTableRow {TR} at (0,0) size 50x445
+          RenderTableCell {TD} at (0,29) size 50x57 [bgcolor=#008000] [r=0 c=0 rs=1 cs=2]
+          RenderTableCell {TD} at (0,139) size 50x2 [bgcolor=#008000] [r=0 c=2 rs=1 cs=1]
+          RenderTableCell {TD} at (0,194) size 50x222 [bgcolor=#008000] [r=0 c=3 rs=1 cs=5]
+    RenderTable {TABLE} at (170,0) size 50x445
+      RenderTableSection {TBODY} at (0,0) size 50x445
+        RenderTableRow {TR} at (0,0) size 50x445
+          RenderTableCell {TD} at (0,29) size 50x57 [bgcolor=#008000] [r=0 c=0 rs=1 cs=2]
+          RenderTableCell {TD} at (0,139) size 50x277 [bgcolor=#008000] [r=0 c=2 rs=1 cs=6]
+    RenderTable {TABLE} at (225,0) size 50x445
+      RenderTableSection {TBODY} at (0,0) size 50x445
+        RenderTableRow {TR} at (0,0) size 50x445
+          RenderTableCell {TD} at (0,29) size 50x2 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+          RenderTableCell {TD} at (0,84) size 50x332 [bgcolor=#008000] [r=0 c=1 rs=1 cs=7]
+    RenderTable {TABLE} at (280,0) size 50x445
+      RenderTableSection {TBODY} at (0,0) size 50x445
+        RenderTableRow {TR} at (0,0) size 50x445
+          RenderTableCell {TD} at (0,29) size 50x2 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+          RenderTableCell {TD} at (0,84) size 50x57 [bgcolor=#008000] [r=0 c=1 rs=1 cs=2]
+          RenderTableCell {TD} at (0,194) size 50x222 [bgcolor=#008000] [r=0 c=3 rs=1 cs=5]
+    RenderTable {TABLE} at (335,0) size 50x445
+      RenderTableSection {TBODY} at (0,0) size 50x445
+        RenderTableRow {TR} at (0,0) size 50x445
+          RenderTableCell {TD} at (0,29) size 50x57 [bgcolor=#008000] [r=0 c=0 rs=1 cs=2]
+          RenderTableCell {TD} at (0,139) size 50x167 [bgcolor=#008000] [r=0 c=2 rs=1 cs=4]
+          RenderTableCell {TD} at (0,359) size 50x2 [bgcolor=#008000] [r=0 c=6 rs=1 cs=1]
+          RenderTableCell {TD} at (0,414) size 50x2 [bgcolor=#008000] [r=0 c=7 rs=1 cs=1]
diff --git a/LayoutTests/platform/mac/fast/table/growCellForImageQuirk-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/growCellForImageQuirk-vertical-expected.checksum
new file mode 100644
index 0000000..2b20e1e
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/growCellForImageQuirk-vertical-expected.checksum
@@ -0,0 +1 @@
+f67a8d0a7d1428649d10c34f1b6f3875
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/growCellForImageQuirk-vertical-expected.png b/LayoutTests/platform/mac/fast/table/growCellForImageQuirk-vertical-expected.png
new file mode 100644
index 0000000..6a658d0
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/growCellForImageQuirk-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/growCellForImageQuirk-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/growCellForImageQuirk-vertical-expected.txt
new file mode 100644
index 0000000..7b28289
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/growCellForImageQuirk-vertical-expected.txt
@@ -0,0 +1,12 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderTable {TABLE} at (0,0) size 56x156 [bgcolor=#C0C0C0]
+        RenderTableSection {TBODY} at (0,0) size 56x156
+          RenderTableRow {TR} at (0,2) size 52x156
+            RenderTableCell {TD} at (2,2) size 52x152 [r=0 c=0 rs=1 cs=1]
+              RenderImage {IMG} at (1,1) size 50x75 [bgcolor=#ADD8E6]
+              RenderImage {IMG} at (1,76) size 50x75 [bgcolor=#ADD8E6]
+              RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/table/height-percent-test-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/height-percent-test-vertical-expected.checksum
new file mode 100644
index 0000000..7652dc1
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/height-percent-test-vertical-expected.checksum
@@ -0,0 +1 @@
+feed115a01dbf623a18d109647de3bff
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/height-percent-test-vertical-expected.png b/LayoutTests/platform/mac/fast/table/height-percent-test-vertical-expected.png
new file mode 100644
index 0000000..92296a1
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/height-percent-test-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/height-percent-test-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/height-percent-test-vertical-expected.txt
new file mode 100644
index 0000000..09b8ba1
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/height-percent-test-vertical-expected.txt
@@ -0,0 +1,26 @@
+layer at (0,0) size 1282x601
+  RenderView at (0,0) size 785x585
+layer at (0,0) size 1282x601
+  RenderBlock {HTML} at (0,0) size 785x601
+    RenderBody {BODY} at (8,8) size 769x585
+      RenderBlock {DIV} at (0,0) size 1274x585
+        RenderBlock {DIV} at (16,16) size 26x553 [border: (1px solid #000000)]
+          RenderBlock (floating) {DIV} at (1,1) size 24x100
+            RenderBlock {DIV} at (0,0) size 24x100 [bgcolor=#008000]
+        RenderBlock {DIV} at (58,16) size 26x553 [border: (1px solid #000000)]
+          RenderBlock (floating) {DIV} at (1,1) size 24x551
+            RenderTable {TABLE} at (0,0) size 24x96 [bgcolor=#FF0000]
+              RenderTableSection {TBODY} at (0,0) size 24x96
+                RenderTableRow {TR} at (0,0) size 24x96
+                  RenderTableCell {TD} at (0,1) size 24x94 [r=0 c=0 rs=1 cs=1]
+                    RenderImage {IMG} at (1,-1) size 22x96 [bgcolor=#008000]
+        RenderBlock {DIV} at (100,16) size 571x553 [border: (1px solid #000000)]
+          RenderBlock {DIV} at (1,1) size 569x551
+            RenderBlock {DIV} at (0,0) size 569x100 [bgcolor=#008000]
+        RenderBlock {DIV} at (687,16) size 571x553 [border: (1px solid #000000)]
+          RenderBlock {DIV} at (1,1) size 569x551
+            RenderTable {TABLE} at (0,0) size 569x96 [bgcolor=#FF0000]
+              RenderTableSection {TBODY} at (0,0) size 569x96
+                RenderTableRow {TR} at (0,0) size 569x96
+                  RenderTableCell {TD} at (0,273) size 569x-451 [r=0 c=0 rs=1 cs=1]
+                    RenderImage {IMG} at (273,-273) size 22x96 [bgcolor=#008000]
diff --git a/LayoutTests/platform/mac/fast/table/percent-widths-stretch-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/percent-widths-stretch-vertical-expected.checksum
new file mode 100644
index 0000000..e9758fc
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/percent-widths-stretch-vertical-expected.checksum
@@ -0,0 +1 @@
+6c867e6e79540e24eb205aca07e1a0ff
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/percent-widths-stretch-vertical-expected.png b/LayoutTests/platform/mac/fast/table/percent-widths-stretch-vertical-expected.png
new file mode 100644
index 0000000..aa14cc2
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/percent-widths-stretch-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/percent-widths-stretch-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/percent-widths-stretch-vertical-expected.txt
new file mode 100644
index 0000000..ba0101d
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/percent-widths-stretch-vertical-expected.txt
@@ -0,0 +1,105 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (704,0) size 96x600
+  RenderBlock {HTML} at (0,0) size 96x600
+    RenderBody {BODY} at (8,8) size 80x584
+      RenderTable {TABLE} at (0,0) size 4x100
+        RenderTableSection {TBODY} at (0,0) size 4x100
+          RenderTableRow {TR} at (0,0) size 4x100
+            RenderTableCell {TD} at (0,0) size 4x100 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (4,0) size 4x50
+        RenderTableSection {TBODY} at (0,0) size 4x50
+          RenderTableRow {TR} at (0,0) size 4x50
+            RenderTableCell {TD} at (0,0) size 4x50 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (8,0) size 4x33
+        RenderTableSection {TBODY} at (0,0) size 4x33
+          RenderTableRow {TR} at (0,0) size 4x33
+            RenderTableCell {TD} at (0,0) size 4x33 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (12,0) size 4x25
+        RenderTableSection {TBODY} at (0,0) size 4x25
+          RenderTableRow {TR} at (0,0) size 4x25
+            RenderTableCell {TD} at (0,0) size 4x25 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (16,0) size 4x20
+        RenderTableSection {TBODY} at (0,0) size 4x20
+          RenderTableRow {TR} at (0,0) size 4x20
+            RenderTableCell {TD} at (0,0) size 4x20 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (20,0) size 4x10
+        RenderTableSection {TBODY} at (0,0) size 4x10
+          RenderTableRow {TR} at (0,0) size 4x10
+            RenderTableCell {TD} at (0,0) size 4x10 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (24,0) size 4x5
+        RenderTableSection {TBODY} at (0,0) size 4x5
+          RenderTableRow {TR} at (0,0) size 4x5
+            RenderTableCell {TD} at (0,0) size 4x5 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (28,0) size 4x3
+        RenderTableSection {TBODY} at (0,0) size 4x3
+          RenderTableRow {TR} at (0,0) size 4x3
+            RenderTableCell {TD} at (0,0) size 4x3 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (32,0) size 4x2
+        RenderTableSection {TBODY} at (0,0) size 4x2
+          RenderTableRow {TR} at (0,0) size 4x2
+            RenderTableCell {TD} at (0,0) size 4x2 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (36,0) size 4x2
+        RenderTableSection {TBODY} at (0,0) size 4x2
+          RenderTableRow {TR} at (0,0) size 4x2
+            RenderTableCell {TD} at (0,0) size 4x2 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (40,0) size 4x1
+        RenderTableSection {TBODY} at (0,0) size 4x1
+          RenderTableRow {TR} at (0,0) size 4x1
+            RenderTableCell {TD} at (0,0) size 4x1 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (44,0) size 4x1
+        RenderTableSection {TBODY} at (0,0) size 4x1
+          RenderTableRow {TR} at (0,0) size 4x1
+            RenderTableCell {TD} at (0,0) size 4x1 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (48,0) size 4x1
+        RenderTableSection {TBODY} at (0,0) size 4x1
+          RenderTableRow {TR} at (0,0) size 4x1
+            RenderTableCell {TD} at (0,0) size 4x1 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (52,0) size 4x1
+        RenderTableSection {TBODY} at (0,0) size 4x1
+          RenderTableRow {TR} at (0,0) size 4x1
+            RenderTableCell {TD} at (0,0) size 4x1 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (56,0) size 4x1
+        RenderTableSection {TBODY} at (0,0) size 4x1
+          RenderTableRow {TR} at (0,0) size 4x1
+            RenderTableCell {TD} at (0,0) size 4x1 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (60,0) size 4x1
+        RenderTableSection {TBODY} at (0,0) size 4x1
+          RenderTableRow {TR} at (0,0) size 4x1
+            RenderTableCell {TD} at (0,0) size 4x1 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (64,0) size 4x1
+        RenderTableSection {TBODY} at (0,0) size 4x1
+          RenderTableRow {TR} at (0,0) size 4x1
+            RenderTableCell {TD} at (0,0) size 4x1 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (68,0) size 4x1
+        RenderTableSection {TBODY} at (0,0) size 4x1
+          RenderTableRow {TR} at (0,0) size 4x1
+            RenderTableCell {TD} at (0,0) size 4x1 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (72,0) size 4x1
+        RenderTableSection {TBODY} at (0,0) size 4x1
+          RenderTableRow {TR} at (0,0) size 4x1
+            RenderTableCell {TD} at (0,0) size 4x1 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
+      RenderTable {TABLE} at (76,0) size 4x1
+        RenderTableSection {TBODY} at (0,0) size 4x1
+          RenderTableRow {TR} at (0,0) size 4x1
+            RenderTableCell {TD} at (0,0) size 4x1 [bgcolor=#008000] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (0,0) size 4x1 [bgcolor=#FFA500]
diff --git a/LayoutTests/platform/mac/fast/table/rowspan-paint-order-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/rowspan-paint-order-vertical-expected.checksum
new file mode 100644
index 0000000..b36c48e
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/rowspan-paint-order-vertical-expected.checksum
@@ -0,0 +1 @@
+e22ce3ed03196f3f485872b51abda501
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/rowspan-paint-order-vertical-expected.png b/LayoutTests/platform/mac/fast/table/rowspan-paint-order-vertical-expected.png
new file mode 100644
index 0000000..faaf386
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/rowspan-paint-order-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/rowspan-paint-order-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/rowspan-paint-order-vertical-expected.txt
new file mode 100644
index 0000000..c6fcdcb
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/rowspan-paint-order-vertical-expected.txt
@@ -0,0 +1,60 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderTable {TABLE} at (0,0) size 100x580 [border: (2px outset #808080)]
+        RenderTableSection {TBODY} at (2,2) size 96x576
+          RenderTableRow {TR} at (0,0) size 38x576
+            RenderTableCell {TD} at (0,20) size 96x-2 [bgcolor=#AAAAAA] [border: (1px inset #808080)] [r=0 c=0 rs=3 cs=1]
+              RenderText {#text} at (21,-19) size 54x36
+                text run at (21,-19) width 26: "Left"
+                text run at (39,-19) width 13: "(3"
+                text run at (57,-19) width 36: "rows)"
+            RenderTableCell {TD} at (0,61) size 67x176 [bgcolor=#000000] [border: (1px inset #808080)] [r=0 c=1 rs=2 cs=1]
+              RenderText {#text} at (24,-22) size 18x4
+                text run at (24,-22) width 4: " "
+            RenderTableCell {TD} at (0,261) size 38x54 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=10]
+              RenderText {#text} at (1,4) size 36x47
+                text run at (1,4) width 45: "Middle"
+                text run at (19,3) width 47: "(1 row)"
+            RenderTableCell {TD} at (0,338) size 67x176 [bgcolor=#000000] [border: (1px inset #808080)] [r=0 c=12 rs=2 cs=1]
+              RenderText {#text} at (24,-22) size 18x4
+                text run at (24,-22) width 4: " "
+            RenderTableCell {TD} at (0,558) size 96x-2 [bgcolor=#AAAAAA] [border: (1px inset #808080)] [r=0 c=13 rs=3 cs=1]
+              RenderText {#text} at (21,-18) size 54x36
+                text run at (21,-18) width 35: "Right"
+                text run at (39,4) width 13: "(3"
+                text run at (57,-19) width 36: "rows)"
+          RenderTableRow {TR} at (0,38) size 29x576
+            RenderTableCell {TD} at (38,265) size 29x-3 [bgcolor=#EEEEEE] [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
+              RenderText {#text} at (5,-3) size 18x4
+                text run at (5,-3) width 4: " "
+            RenderTableCell {TD} at (38,271) size 29x-3 [bgcolor=#EEEEEE] [border: (1px inset #808080)] [r=1 c=3 rs=1 cs=1]
+              RenderText {#text} at (5,-3) size 18x4
+                text run at (5,-3) width 4: " "
+            RenderTableCell {TD} at (38,277) size 29x-3 [bgcolor=#EEEEEE] [border: (1px inset #808080)] [r=1 c=4 rs=1 cs=1]
+              RenderText {#text} at (5,-3) size 18x4
+                text run at (5,-3) width 4: " "
+            RenderTableCell {TD} at (38,283) size 29x-3 [bgcolor=#EEEEEE] [border: (1px inset #808080)] [r=1 c=5 rs=1 cs=1]
+              RenderText {#text} at (5,-3) size 18x4
+                text run at (5,-3) width 4: " "
+            RenderTableCell {TD} at (38,289) size 29x-3 [bgcolor=#EEEEEE] [border: (1px inset #808080)] [r=1 c=6 rs=1 cs=1]
+              RenderText {#text} at (5,-3) size 18x4
+                text run at (5,-3) width 4: " "
+            RenderTableCell {TD} at (38,295) size 29x-3 [bgcolor=#EEEEEE] [border: (1px inset #808080)] [r=1 c=7 rs=1 cs=1]
+              RenderText {#text} at (5,-3) size 18x4
+                text run at (5,-3) width 4: " "
+            RenderTableCell {TD} at (38,301) size 29x-3 [bgcolor=#EEEEEE] [border: (1px inset #808080)] [r=1 c=8 rs=1 cs=1]
+              RenderText {#text} at (5,-3) size 18x4
+                text run at (5,-3) width 4: " "
+            RenderTableCell {TD} at (38,307) size 29x-3 [bgcolor=#EEEEEE] [border: (1px inset #808080)] [r=1 c=9 rs=1 cs=1]
+              RenderText {#text} at (5,-3) size 18x4
+                text run at (5,-3) width 4: " "
+            RenderTableCell {TD} at (38,313) size 29x-3 [bgcolor=#EEEEEE] [border: (1px inset #808080)] [r=1 c=10 rs=1 cs=1]
+              RenderText {#text} at (5,-3) size 18x4
+                text run at (5,-3) width 4: " "
+          RenderTableRow {TR} at (0,67) size 29x576
+            RenderTableCell {TD} at (67,42) size 29x529 [bgcolor=#008000] [border: (1px inset #808080)] [r=2 c=1 rs=1 cs=13]
+              RenderText {#text} at (5,261) size 18x272
+                text run at (5,261) width 272: "Bottom Row Overlaps with the Right Cell!"
diff --git a/LayoutTests/platform/mac/fast/table/table-display-types-vertical-expected.checksum b/LayoutTests/platform/mac/fast/table/table-display-types-vertical-expected.checksum
new file mode 100644
index 0000000..fad7a25
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/table-display-types-vertical-expected.checksum
@@ -0,0 +1 @@
+9e3b044f79858f5a099bbe31e3339f08
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/table/table-display-types-vertical-expected.png b/LayoutTests/platform/mac/fast/table/table-display-types-vertical-expected.png
new file mode 100644
index 0000000..62b2996
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/table-display-types-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/table-display-types-vertical-expected.txt b/LayoutTests/platform/mac/fast/table/table-display-types-vertical-expected.txt
new file mode 100644
index 0000000..09f19e6
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/table/table-display-types-vertical-expected.txt
@@ -0,0 +1,182 @@
+layer at (0,0) size 785x1180
+  RenderView at (0,0) size 785x600
+layer at (0,0) size 785x1180
+  RenderBlock {HTML} at (0,0) size 785x1180
+    RenderBody {BODY} at (8,10) size 769x1162
+      RenderTable {TABLE} at (10,0) size 96x118 [border: (1px solid #000000)]
+        RenderTableSection {THEAD} at (1,1) size 24x116
+          RenderTableRow {TR} at (0,2) size 20x116
+            RenderTableCell {TD} at (2,2) size 20x55 [r=0 c=0 rs=1 cs=1]
+              RenderText {#text} at (1,1) size 18x46
+                text run at (1,1) width 46: "Head 1"
+            RenderTableCell {TD} at (2,59) size 20x55 [r=0 c=1 rs=1 cs=1]
+              RenderText {#text} at (1,1) size 18x46
+                text run at (1,1) width 46: "Head 2"
+        RenderTableSection {TFOOT} at (71,1) size 24x116
+          RenderTableRow {TR} at (0,2) size 20x116
+            RenderTableCell {TD} at (2,2) size 20x55 [r=0 c=0 rs=1 cs=1]
+              RenderText {#text} at (1,1) size 18x53
+                text run at (1,1) width 53: "Footer 1"
+            RenderTableCell {TD} at (2,59) size 20x55 [r=0 c=1 rs=1 cs=1]
+              RenderText {#text} at (1,1) size 18x53
+                text run at (1,1) width 53: "Footer 2"
+        RenderTableSection {TBODY} at (25,1) size 46x116
+          RenderTableRow {TR} at (0,2) size 20x116
+            RenderTableCell {TD} at (2,2) size 20x55 [r=0 c=0 rs=1 cs=1]
+              RenderText {#text} at (1,1) size 18x38
+                text run at (1,1) width 38: "Cell 1"
+            RenderTableCell {TD} at (2,59) size 20x55 [r=0 c=1 rs=1 cs=1]
+              RenderText {#text} at (1,1) size 18x38
+                text run at (1,1) width 38: "Cell 2"
+          RenderTableRow {TR} at (0,24) size 20x116
+            RenderTableCell {TD} at (24,2) size 20x55 [r=1 c=0 rs=1 cs=1]
+              RenderText {#text} at (1,1) size 18x38
+                text run at (1,1) width 38: "Cell 3"
+            RenderTableCell {TD} at (24,59) size 20x55 [r=1 c=1 rs=1 cs=1]
+              RenderText {#text} at (1,1) size 18x38
+                text run at (1,1) width 38: "Cell 4"
+      RenderBlock {P} at (0,134) size 769x18
+        RenderText {#text} at (0,0) size 222x18
+          text run at (0,0) width 222: "Row groups have display:table-cell"
+      RenderTable {TABLE} at (10,168) size 62x234 [border: (1px solid #000000)]
+        RenderTableSection (anonymous) at (1,1) size 32x232
+          RenderTableRow (anonymous) at (0,2) size 28x232
+            RenderTableCell {THEAD} at (2,2) size 28x106 [r=0 c=0 rs=1 cs=1]
+              RenderTable at (0,0) size 28x106
+                RenderTableSection (anonymous) at (0,0) size 28x106
+                  RenderTableRow (anonymous) at (0,2) size 24x106
+                    RenderTableCell {TR} at (2,2) size 24x102 [r=0 c=0 rs=1 cs=1]
+                      RenderTable at (0,0) size 24x102
+                        RenderTableSection (anonymous) at (0,0) size 24x102
+                          RenderTableRow (anonymous) at (0,2) size 20x102
+                            RenderTableCell {TD} at (2,2) size 20x48 [r=0 c=0 rs=1 cs=1]
+                              RenderText {#text} at (1,1) size 18x46
+                                text run at (1,1) width 46: "Head 1"
+                            RenderTableCell {TD} at (2,52) size 20x48 [r=0 c=1 rs=1 cs=1]
+                              RenderText {#text} at (1,1) size 18x46
+                                text run at (1,1) width 46: "Head 2"
+            RenderTableCell {TFOOT} at (2,110) size 28x120 [r=0 c=1 rs=1 cs=1]
+              RenderTable at (0,0) size 28x120
+                RenderTableSection (anonymous) at (0,0) size 28x120
+                  RenderTableRow (anonymous) at (0,2) size 24x120
+                    RenderTableCell {TR} at (2,2) size 24x116 [r=0 c=0 rs=1 cs=1]
+                      RenderTable at (0,0) size 24x116
+                        RenderTableSection (anonymous) at (0,0) size 24x116
+                          RenderTableRow (anonymous) at (0,2) size 20x116
+                            RenderTableCell {TD} at (2,2) size 20x55 [r=0 c=0 rs=1 cs=1]
+                              RenderText {#text} at (1,1) size 18x53
+                                text run at (1,1) width 53: "Footer 1"
+                            RenderTableCell {TD} at (2,59) size 20x55 [r=0 c=1 rs=1 cs=1]
+                              RenderText {#text} at (1,1) size 18x53
+                                text run at (1,1) width 53: "Footer 2"
+        RenderTableSection {TBODY} at (33,1) size 28x232
+          RenderTableRow (anonymous) at (0,2) size 24x232
+            RenderTableCell {TR} at (2,2) size 24x106 [r=0 c=0 rs=1 cs=1]
+              RenderTable at (0,0) size 24x86
+                RenderTableSection (anonymous) at (0,0) size 24x86
+                  RenderTableRow (anonymous) at (0,2) size 20x86
+                    RenderTableCell {TD} at (2,2) size 20x40 [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,1) size 18x38
+                        text run at (1,1) width 38: "Cell 1"
+                    RenderTableCell {TD} at (2,44) size 20x40 [r=0 c=1 rs=1 cs=1]
+                      RenderText {#text} at (1,1) size 18x38
+                        text run at (1,1) width 38: "Cell 2"
+            RenderTableCell {TR} at (2,110) size 24x120 [r=0 c=1 rs=1 cs=1]
+              RenderTable at (0,0) size 24x86
+                RenderTableSection (anonymous) at (0,0) size 24x86
+                  RenderTableRow (anonymous) at (0,2) size 20x86
+                    RenderTableCell {TD} at (2,2) size 20x40 [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (1,1) size 18x38
+                        text run at (1,1) width 38: "Cell 3"
+                    RenderTableCell {TD} at (2,44) size 20x40 [r=0 c=1 rs=1 cs=1]
+                      RenderText {#text} at (1,1) size 18x38
+                        text run at (1,1) width 38: "Cell 4"
+      RenderBlock {P} at (0,418) size 769x18
+        RenderText {#text} at (0,0) size 200x18
+          text run at (0,0) width 200: "Row groups have display:block"
+      RenderTable {TABLE} at (10,452) size 106x122 [border: (1px solid #000000)]
+        RenderTableSection (anonymous) at (1,1) size 52x120
+          RenderTableRow (anonymous) at (0,2) size 48x120
+            RenderTableCell (anonymous) at (2,2) size 48x116 [r=0 c=0 rs=1 cs=1]
+              RenderBlock {THEAD} at (0,0) size 24x116
+                RenderBlock {TR} at (0,0) size 24x116
+                  RenderTable at (0,0) size 24x102
+                    RenderTableSection (anonymous) at (0,0) size 24x102
+                      RenderTableRow (anonymous) at (0,2) size 20x102
+                        RenderTableCell {TD} at (2,2) size 20x48 [r=0 c=0 rs=1 cs=1]
+                          RenderText {#text} at (1,1) size 18x46
+                            text run at (1,1) width 46: "Head 1"
+                        RenderTableCell {TD} at (2,52) size 20x48 [r=0 c=1 rs=1 cs=1]
+                          RenderText {#text} at (1,1) size 18x46
+                            text run at (1,1) width 46: "Head 2"
+              RenderBlock {TFOOT} at (24,0) size 24x116
+                RenderBlock {TR} at (0,0) size 24x116
+                  RenderTable at (0,0) size 24x116
+                    RenderTableSection (anonymous) at (0,0) size 24x116
+                      RenderTableRow (anonymous) at (0,2) size 20x116
+                        RenderTableCell {TD} at (2,2) size 20x55 [r=0 c=0 rs=1 cs=1]
+                          RenderText {#text} at (1,1) size 18x53
+                            text run at (1,1) width 53: "Footer 1"
+                        RenderTableCell {TD} at (2,59) size 20x55 [r=0 c=1 rs=1 cs=1]
+                          RenderText {#text} at (1,1) size 18x53
+                            text run at (1,1) width 53: "Footer 2"
+        RenderTableSection {TBODY} at (53,1) size 52x120
+          RenderTableRow (anonymous) at (0,2) size 48x120
+            RenderTableCell (anonymous) at (2,2) size 48x116 [r=0 c=0 rs=1 cs=1]
+              RenderBlock {TR} at (0,0) size 24x116
+                RenderTable at (0,0) size 24x86
+                  RenderTableSection (anonymous) at (0,0) size 24x86
+                    RenderTableRow (anonymous) at (0,2) size 20x86
+                      RenderTableCell {TD} at (2,2) size 20x40 [r=0 c=0 rs=1 cs=1]
+                        RenderText {#text} at (1,1) size 18x38
+                          text run at (1,1) width 38: "Cell 1"
+                      RenderTableCell {TD} at (2,44) size 20x40 [r=0 c=1 rs=1 cs=1]
+                        RenderText {#text} at (1,1) size 18x38
+                          text run at (1,1) width 38: "Cell 2"
+              RenderBlock {TR} at (24,0) size 24x116
+                RenderTable at (0,0) size 24x86
+                  RenderTableSection (anonymous) at (0,0) size 24x86
+                    RenderTableRow (anonymous) at (0,2) size 20x86
+                      RenderTableCell {TD} at (2,2) size 20x40 [r=0 c=0 rs=1 cs=1]
+                        RenderText {#text} at (1,1) size 18x38
+                          text run at (1,1) width 38: "Cell 3"
+                      RenderTableCell {TD} at (2,44) size 20x40 [r=0 c=1 rs=1 cs=1]
+                        RenderText {#text} at (1,1) size 18x38
+                          text run at (1,1) width 38: "Cell 4"
+      RenderTable at (0,584) size 102x578
+        RenderTableSection (anonymous) at (0,0) size 102x578
+          RenderTableRow (anonymous) at (0,0) size 102x578
+            RenderTableCell {P} at (0,0) size 102x578 [border: (1px solid #000000)] [r=0 c=0 rs=1 cs=1]
+              RenderText {#text} at (1,1) size 100x576
+                text run at (1,1) width 84: "Lorem ipsum"
+                text run at (1,19) width 89: "dolor sit amet,"
+                text run at (1,37) width 71: "consectetur"
+                text run at (1,55) width 95: "adipisicing elit,"
+                text run at (1,73) width 98: "sed do eiusmod"
+                text run at (1,91) width 44: "tempor"
+                text run at (1,109) width 79: "incididunt ut"
+                text run at (1,127) width 98: "labore et dolore"
+                text run at (1,145) width 88: "magna aliqua."
+                text run at (1,163) width 70: "Ut enim ad"
+                text run at (1,181) width 94: "minim veniam,"
+                text run at (1,199) width 77: "quis nostrud"
+                text run at (1,217) width 73: "exercitation"
+                text run at (1,235) width 96: "ullamco laboris"
+                text run at (1,253) width 85: "nisi ut aliquip"
+                text run at (1,271) width 100: "ex ea commodo"
+                text run at (1,289) width 67: "consequat."
+                text run at (1,307) width 93: "Duis aute irure"
+                text run at (1,325) width 49: "dolor in"
+                text run at (1,343) width 99: "reprehenderit in"
+                text run at (1,361) width 89: "voluptate velit"
+                text run at (1,379) width 69: "esse cillum"
+                text run at (1,397) width 99: "dolore eu fugiat"
+                text run at (1,415) width 87: "nulla pariatur."
+                text run at (1,433) width 90: "Excepteur sint"
+                text run at (1,451) width 54: "occaecat"
+                text run at (1,469) width 85: "cupidatat non"
+                text run at (1,487) width 86: "proident, sunt"
+                text run at (1,505) width 74: "in culpa qui"
+                text run at (1,523) width 97: "officia deserunt"
+                text run at (1,541) width 87: "mollit anim id"
+                text run at (1,559) width 77: "est laborum."
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 974bc81..90e89ae 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,109 @@
+2010-11-04  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        Made table layout and painting work with all writing modes. Hit-testing, repainting, tables
+        where some elements have their own layers, and cells whose writing mode differs from the
+        table’s are not supported yet.
+
+        Make tables work with vertical text
+        https://bugs.webkit.org/show_bug.cgi?id=46417
+
+        Tests: fast/table/027-vertical.html
+               fast/table/028-vertical.html
+               fast/table/035-vertical.html
+               fast/table/038-vertical.html
+               fast/table/040-vertical.html
+               fast/table/auto-with-percent-height-vertical.html
+               fast/table/border-collapsing/001-vertical.html
+               fast/table/border-collapsing/002-vertical.html
+               fast/table/border-collapsing/003-vertical.html
+               fast/table/border-collapsing/004-vertical.html
+               fast/table/border-collapsing/border-collapsing-head-foot-vertical.html
+               fast/table/border-collapsing/equal-precedence-resolution-vertical.html
+               fast/table/border-collapsing/rtl-border-collapsing-vertical.html
+               fast/table/colspanMinWidth-vertical.html
+               fast/table/fixed-with-auto-with-colspan-vertical.html
+               fast/table/growCellForImageQuirk-vertical.html
+               fast/table/height-percent-test-vertical.html
+               fast/table/percent-widths-stretch-vertical.html
+               fast/table/rowspan-paint-order-vertical.html
+               fast/table/table-display-types-vertical.html
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::adjustRenderStyle): Changed to allow all writing modes for tables,
+        make row groups, rows, column groups and columns inherit the table’s writing mode. For now,
+        make cells do this too.
+        * html/HTMLTableElement.cpp:
+        (WebCore::HTMLTableElement::parseMappedAttribute): Map align=center using logical properties.
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::RenderTable): Initialize m_borderStart and m_borderEnd.
+        (WebCore::RenderTable::styleDidChange): Changed the rule for when to use auto layout to look
+        at the logical width instead of the width.
+        (WebCore::RenderTable::computeLogicalWidth): Uses logical widths and works with perpendicular
+        containing blocks.
+        (WebCore::RenderTable::layout): Use logical lengths.
+        (WebCore::RenderTable::setCellLogicalWidths): Renamed setCellWidths() to this and updated for
+        the renaming of RenderTableSection::setCellWidths().
+        (WebCore::RenderTable::paintObject): Account for flipped modes.
+        (WebCore::RenderTable::subtractCaptionRect): Added this helper method the considers writing modes.
+        (WebCore::RenderTable::paintBoxDecorations): Adopted subtractCaptionRect().
+        (WebCore::RenderTable::paintMask): Ditto.
+        (WebCore::RenderTable::computePreferredLogicalWidths): Updated for the renaming of
+        recalcHorizontalBorders().
+        (WebCore::RenderTable::calcBorderStart): Renamed calcBorderLeft() to this and changed it to use
+        borderStart(). Splits odd number of pixels based on the physical side.
+        (WebCore::RenderTable::calcBorderEnd): Similar.
+        (WebCore::RenderTable::recalcBordersInRowDirection): Renamed recalcHorizontalBorders() to this
+        and updated for other renames.
+        (WebCore::RenderTable::borderBefore): Replaced borderTop() with this.
+        (WebCore::RenderTable::borderAfter): Similar.
+        (WebCore::RenderTable::outerBorderBefore): Similar.
+        (WebCore::RenderTable::outerBorderAfter): Similar.
+        (WebCore::RenderTable::outerBorderStart): Similar.
+        (WebCore::RenderTable::outerBorderEnd): Similar.
+        (WebCore::RenderTable::firstLineBoxBaseline): Changed to use logical heights.
+        (WebCore::RenderTable::overflowClipRect): Account for writing modes.
+        * rendering/RenderTable.h:
+        (WebCore::RenderTable::borderStart):
+        (WebCore::RenderTable::borderEnd):
+        (WebCore::RenderTable::borderLeft):
+        (WebCore::RenderTable::borderRight):
+        (WebCore::RenderTable::borderTop):
+        (WebCore::RenderTable::borderBottom):
+        (WebCore::RenderTable::outerBorderLeft):
+        (WebCore::RenderTable::outerBorderRight):
+        (WebCore::RenderTable::outerBorderTop):
+        (WebCore::RenderTable::outerBorderBottom):
+        (WebCore::RenderTable::bordersPaddingAndSpacingInRowDirection): Changed to match its name.
+        * rendering/RenderTableRow.cpp:
+        (WebCore::RenderTableRow::styleWillChange): Changed to detect changes to logical height.
+        * rendering/RenderTableSection.cpp:
+        (WebCore::setRowLogicalHeightToRowStyleLogicalHeightIfNotRelative): Renamed and changed to use
+        logical heights.
+        (WebCore::RenderTableSection::RenderTableSection): Updated initializers for new member variables.
+        (WebCore::RenderTableSection::addChild): Updated for rename.
+        (WebCore::RenderTableSection::ensureRows): Ditto.
+        (WebCore::RenderTableSection::addCell): Ditto. Also use logical heights.
+        (WebCore::RenderTableSection::setCellLogicalWidths): Renamed setCellWidths() to this, changed
+        to use logical widths.
+        (WebCore::RenderTableSection::calcRowLogicalHeight): Added “logical” to the name. Updated with
+        logical heights.
+        (WebCore::RenderTableSection::layoutRows):
+        (WebCore::RenderTableSection::calcOuterBorderBefore):
+        (WebCore::RenderTableSection::calcOuterBorderAfter):
+        (WebCore::RenderTableSection::calcOuterBorderStart):
+        (WebCore::RenderTableSection::calcOuterBorderEnd):
+        (WebCore::RenderTableSection::recalcOuterBorder):
+        (WebCore::RenderTableSection::firstLineBoxBaseline):
+        (WebCore::RenderTableSection::paintCell):
+        (WebCore::RenderTableSection::recalcCells):
+        * rendering/RenderTableSection.h:
+        (WebCore::RenderTableSection::outerBorderBefore):
+        (WebCore::RenderTableSection::outerBorderAfter):
+        (WebCore::RenderTableSection::outerBorderStart):
+        (WebCore::RenderTableSection::outerBorderEnd):
+
 2010-11-04  Kent Tamura  <tkent at chromium.org>
 
         Unreviewed, trivial test fix.
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index 09a6089..317fc7e 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -1753,15 +1753,18 @@ void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, RenderStyle* parent
              style->display() == TABLE_FOOTER_GROUP || style->display() == TABLE_ROW || style->display() == TABLE_CELL) &&
              style->position() == RelativePosition)
             style->setPosition(StaticPosition);
-        
-        // FIXME: Since we don't support block-flow on either tables or flexible boxes yet, disallow setting
+
+        // writing-mode does not apply to table row groups, table column groups, table rows, and table columns.
+        // FIXME: Table cells should be allowed to be perpendicular or flipped with respect to the table, though.
+        if (style->display() == TABLE_COLUMN || style->display() == TABLE_COLUMN_GROUP || style->display() == TABLE_FOOTER_GROUP
+            || style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_ROW || style->display() == TABLE_ROW_GROUP
+            || style->display() == TABLE_CELL)
+            style->setWritingMode(parentStyle->writingMode());
+
+        // FIXME: Since we don't support block-flow on flexible boxes yet, disallow setting
         // of block-flow to anything other than TopToBottomWritingMode.
-        // https://bugs.webkit.org/show_bug.cgi?id=46417 - Tables support
         // https://bugs.webkit.org/show_bug.cgi?id=46418 - Flexible box support.
-        if (style->writingMode() != TopToBottomWritingMode && (style->display() == TABLE || style->display() == INLINE_TABLE
-            || style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_ROW_GROUP
-            || style->display() == TABLE_FOOTER_GROUP || style->display() == TABLE_ROW || style->display() == TABLE_CELL
-            || style->display() == BOX || style->display() == INLINE_BOX))
+        if (style->writingMode() != TopToBottomWritingMode && (style->display() == BOX || style->display() == INLINE_BOX))
             style->setWritingMode(TopToBottomWritingMode);
     }
 
diff --git a/WebCore/html/HTMLTableElement.cpp b/WebCore/html/HTMLTableElement.cpp
index fe823ea..f6344d4 100644
--- a/WebCore/html/HTMLTableElement.cpp
+++ b/WebCore/html/HTMLTableElement.cpp
@@ -424,8 +424,8 @@ void HTMLTableElement::parseMappedAttribute(Attribute* attr)
     } else if (attr->name() == alignAttr) {
         if (!attr->value().isEmpty()) {
             if (equalIgnoringCase(attr->value(), "center")) {
-                addCSSProperty(attr, CSSPropertyMarginLeft, CSSValueAuto);
-                addCSSProperty(attr, CSSPropertyMarginRight, CSSValueAuto);
+                addCSSProperty(attr, CSSPropertyWebkitMarginStart, CSSValueAuto);
+                addCSSProperty(attr, CSSPropertyWebkitMarginEnd, CSSValueAuto);
             } else
                 addCSSProperty(attr, CSSPropertyFloat, attr->value());
         }
diff --git a/WebCore/rendering/RenderTable.cpp b/WebCore/rendering/RenderTable.cpp
index ffc38d2..de0b410 100644
--- a/WebCore/rendering/RenderTable.cpp
+++ b/WebCore/rendering/RenderTable.cpp
@@ -4,7 +4,7 @@
  *           (C) 1998 Waldo Bastian (bastian at kde.org)
  *           (C) 1999 Lars Knoll (knoll at kde.org)
  *           (C) 1999 Antti Koivisto (koivisto at kde.org)
- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Alexey Proskuryakov (ap at nypop.com)
  *
  * This library is free software; you can redistribute it and/or
@@ -56,8 +56,8 @@ RenderTable::RenderTable(Node* node)
     , m_needsSectionRecalc(0)
     , m_hSpacing(0)
     , m_vSpacing(0)
-    , m_borderLeft(0)
-    , m_borderRight(0)
+    , m_borderStart(0)
+    , m_borderEnd(0)
 {
     setChildrenInline(false);
     m_columnPos.fill(0, 2);
@@ -83,7 +83,7 @@ void RenderTable::styleDidChange(StyleDifference diff, const RenderStyle* oldSty
     if (!m_tableLayout || style()->tableLayout() != oldTableLayout) {
         // According to the CSS2 spec, you only use fixed table layout if an
         // explicit width is specified on the table.  Auto width implies auto table layout.
-        if (style()->tableLayout() == TFIXED && !style()->width().isAuto())
+        if (style()->tableLayout() == TFIXED && !style()->logicalWidth().isAuto())
             m_tableLayout.set(new FixedTableLayout(this));
         else
             m_tableLayout.set(new AutoTableLayout(this));
@@ -204,38 +204,42 @@ void RenderTable::computeLogicalWidth()
         computePositionedLogicalWidth();
 
     RenderBlock* cb = containingBlock();
-    int availableWidth = cb->availableLogicalWidth();
 
-    LengthType widthType = style()->width().type();
-    if (widthType > Relative && style()->width().isPositive()) {
+    int availableLogicalWidth = containingBlockLogicalWidthForContent();
+    bool hasPerpendicularContainingBlock = cb->style()->isHorizontalWritingMode() != style()->isHorizontalWritingMode();
+    int containerWidthInInlineDirection = hasPerpendicularContainingBlock ? perpendicularContainingBlockLogicalHeight() : availableLogicalWidth;
+
+    LengthType logicalWidthType = style()->logicalWidth().type();
+    if (logicalWidthType > Relative && style()->logicalWidth().isPositive()) {
         // Percent or fixed table
-        setWidth(style()->width().calcMinValue(availableWidth));
-        setWidth(max(minPreferredLogicalWidth(), width()));
+        setLogicalWidth(style()->logicalWidth().calcMinValue(containerWidthInInlineDirection));
+        setLogicalWidth(max(minPreferredLogicalWidth(), logicalWidth()));
     } else {
-        // An auto width table should shrink to fit within the line width if necessary in order to 
-        // avoid overlapping floats.
-        availableWidth = cb->availableLogicalWidthForLine(y(), false);
-        
         // Subtract out any fixed margins from our available width for auto width tables.
         int marginTotal = 0;
-        if (!style()->marginLeft().isAuto())
-            marginTotal += style()->marginLeft().calcValue(availableWidth);
-        if (!style()->marginRight().isAuto())
-            marginTotal += style()->marginRight().calcValue(availableWidth);
+        if (!style()->marginStart().isAuto())
+            marginTotal += style()->marginStart().calcValue(availableLogicalWidth);
+        if (!style()->marginEnd().isAuto())
+            marginTotal += style()->marginEnd().calcValue(availableLogicalWidth);
             
         // Subtract out our margins to get the available content width.
-        int availContentWidth = max(0, availableWidth - marginTotal);
+        int availableContentLogicalWidth = max(0, containerWidthInInlineDirection - marginTotal);
         
         // Ensure we aren't bigger than our max width or smaller than our min width.
-        setWidth(min(availContentWidth, maxPreferredLogicalWidth()));
+        setLogicalWidth(min(availableContentLogicalWidth, maxPreferredLogicalWidth()));
     }
-    
-    setWidth(max(width(), minPreferredLogicalWidth()));
+
+    setLogicalWidth(max(logicalWidth(), minPreferredLogicalWidth()));
 
     // Finally, with our true width determined, compute our margins for real.
-    m_marginRight = 0;
-    m_marginLeft = 0;
-    computeInlineDirectionMargins(cb, availableWidth, width());
+    setMarginStart(0);
+    setMarginEnd(0);
+    if (!hasPerpendicularContainingBlock)
+        computeInlineDirectionMargins(cb, availableLogicalWidth, logicalWidth());
+    else {
+        setMarginStart(style()->marginStart().calcMinValue(availableLogicalWidth));
+        setMarginEnd(style()->marginEnd().calcMinValue(availableLogicalWidth));
+    }
 }
 
 void RenderTable::layout()
@@ -250,15 +254,15 @@ void RenderTable::layout()
     LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
     LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()));
 
-    setHeight(0);
+    setLogicalHeight(0);
     m_overflow.clear();
 
     initMaxMarginValues();
     
-    int oldWidth = width();
+    int oldLogicalWidth = logicalWidth();
     computeLogicalWidth();
 
-    if (m_caption && width() != oldWidth)
+    if (m_caption && logicalWidth() != oldLogicalWidth)
         m_caption->setNeedsLayout(true, false);
 
     // FIXME: The optimisation below doesn't work since the internal table
@@ -268,11 +272,10 @@ void RenderTable::layout()
 //     if ( oldWidth != width() || columns.size() + 1 != columnPos.size() )
     m_tableLayout->layout();
 
-    setCellWidths();
+    setCellLogicalWidths();
 
-    // layout child objects
-    int calculatedHeight = 0;
-    int oldTableTop = m_caption ? m_caption->height() + m_caption->marginTop() + m_caption->marginBottom() : 0;
+    int totalSectionLogicalHeight = 0;
+    int oldTableLogicalTop = m_caption ? m_caption->logicalHeight() + m_caption->marginBefore() + m_caption->marginAfter() : 0;
 
     bool collapsing = collapseBorders();
 
@@ -280,7 +283,7 @@ void RenderTable::layout()
         if (child->isTableSection()) {
             child->layoutIfNeeded();
             RenderTableSection* section = toRenderTableSection(child);
-            calculatedHeight += section->calcRowHeight();
+            totalSectionLogicalHeight += section->calcRowLogicalHeight();
             if (collapsing)
                 section->recalcOuterBorder();
             ASSERT(!section->needsLayout());
@@ -298,80 +301,80 @@ void RenderTable::layout()
     // section down (it is quite unlikely that any of the following sections
     // did not shift).
     bool sectionMoved = false;
-    int movedSectionTop = 0;
+    int movedSectionLogicalTop = 0;
 
     // FIXME: Collapse caption margin.
     if (m_caption && m_caption->style()->captionSide() != CAPBOTTOM) {
         IntRect captionRect(m_caption->x(), m_caption->y(), m_caption->width(), m_caption->height());
 
-        m_caption->setLocation(m_caption->marginLeft(), height());
+        m_caption->setLogicalLocation(m_caption->marginStart(), logicalHeight());
         if (!selfNeedsLayout() && m_caption->checkForRepaintDuringLayout())
             m_caption->repaintDuringLayoutIfMoved(captionRect);
 
-        setHeight(height() + m_caption->height() + m_caption->marginTop() + m_caption->marginBottom());
+        setLogicalHeight(logicalHeight() + m_caption->logicalHeight() + m_caption->marginBefore() + m_caption->marginAfter());
 
-        if (height() != oldTableTop) {
+        if (logicalHeight() != oldTableLogicalTop) {
             sectionMoved = true;
-            movedSectionTop = min(height(), oldTableTop);
+            movedSectionLogicalTop = min(logicalHeight(), oldTableLogicalTop);
         }
     }
 
-    int bpTop = borderTop() + (collapsing ? 0 : paddingTop());
-    int bpBottom = borderBottom() + (collapsing ? 0 : paddingBottom());
-    
-    setHeight(height() + bpTop);
+    int borderAndPaddingBefore = borderBefore() + (collapsing ? 0 : paddingBefore());
+    int borderAndPaddingAfter = borderAfter() + (collapsing ? 0 : paddingAfter());
+
+    setLogicalHeight(logicalHeight() + borderAndPaddingBefore);
 
     if (!isPositioned())
         computeLogicalHeight();
 
-    Length h = style()->height();
-    int th = 0;
-    if (h.isFixed())
+    Length logicalHeightLength = style()->logicalHeight();
+    int computedLogicalHeight = 0;
+    if (logicalHeightLength.isFixed()) {
         // Tables size as though CSS height includes border/padding.
-        th = h.value() - (bpTop + bpBottom);
-    else if (h.isPercent())
-        th = computePercentageLogicalHeight(h);
-    th = max(0, th);
+        computedLogicalHeight = logicalHeightLength.value() - (borderAndPaddingBefore + borderAndPaddingAfter);
+    } else if (logicalHeightLength.isPercent())
+        computedLogicalHeight = computePercentageLogicalHeight(logicalHeightLength);
+    computedLogicalHeight = max(0, computedLogicalHeight);
 
     for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
         if (child->isTableSection())
             // FIXME: Distribute extra height between all table body sections instead of giving it all to the first one.
-            toRenderTableSection(child)->layoutRows(child == m_firstBody ? max(0, th - calculatedHeight) : 0);
+            toRenderTableSection(child)->layoutRows(child == m_firstBody ? max(0, computedLogicalHeight - totalSectionLogicalHeight) : 0);
     }
 
-    if (!m_firstBody && th > calculatedHeight && !document()->inQuirksMode()) {
+    if (!m_firstBody && computedLogicalHeight > totalSectionLogicalHeight && !document()->inQuirksMode()) {
         // Completely empty tables (with no sections or anything) should at least honor specified height
         // in strict mode.
-        setHeight(height() + th);
+        setLogicalHeight(logicalHeight() + computedLogicalHeight);
     }
-    
-    int bl = borderLeft();
+
+    int sectionLogicalLeft = style()->isLeftToRightDirection() ? borderStart() : borderEnd();
     if (!collapsing)
-        bl += paddingLeft();
+        sectionLogicalLeft += style()->isLeftToRightDirection() ? paddingStart() : paddingEnd();
 
     // position the table sections
     RenderTableSection* section = m_head ? m_head : (m_firstBody ? m_firstBody : m_foot);
     while (section) {
-        if (!sectionMoved && section->y() != height()) {
+        if (!sectionMoved && section->logicalTop() != logicalHeight()) {
             sectionMoved = true;
-            movedSectionTop = min(height(), section->y()) + section->topVisibleOverflow();
+            movedSectionLogicalTop = min(logicalHeight(), section->logicalTop()) + (style()->isHorizontalWritingMode() ? section->topVisibleOverflow() : section->leftVisibleOverflow());
         }
-        section->setLocation(bl, height());
+        section->setLogicalLocation(sectionLogicalLeft, logicalHeight());
 
-        setHeight(height() + section->height());
+        setLogicalHeight(logicalHeight() + section->logicalHeight());
         section = sectionBelow(section);
     }
 
-    setHeight(height() + bpBottom);
+    setLogicalHeight(logicalHeight() + borderAndPaddingAfter);
 
     if (m_caption && m_caption->style()->captionSide() == CAPBOTTOM) {
         IntRect captionRect(m_caption->x(), m_caption->y(), m_caption->width(), m_caption->height());
 
-        m_caption->setLocation(m_caption->marginLeft(), height());
+        m_caption->setLogicalLocation(m_caption->marginStart(), logicalHeight());
         if (!selfNeedsLayout() && m_caption->checkForRepaintDuringLayout())
             m_caption->repaintDuringLayoutIfMoved(captionRect);
 
-        setHeight(height() + m_caption->height() + m_caption->marginTop() + m_caption->marginBottom());
+        setLogicalHeight(logicalHeight() + m_caption->logicalHeight() + m_caption->marginBefore() + m_caption->marginAfter());
     }
 
     if (isPositioned())
@@ -410,17 +413,21 @@ void RenderTable::layout()
 
     bool didFullRepaint = repainter.repaintAfterLayout();
     // Repaint with our new bounds if they are different from our old bounds.
-    if (!didFullRepaint && sectionMoved)
-        repaintRectangle(IntRect(leftVisibleOverflow(), movedSectionTop, rightVisibleOverflow() - leftVisibleOverflow(), bottomVisibleOverflow() - movedSectionTop));
-    
+    if (!didFullRepaint && sectionMoved) {
+        if (style()->isHorizontalWritingMode())
+            repaintRectangle(IntRect(leftVisibleOverflow(), movedSectionLogicalTop, rightVisibleOverflow() - leftVisibleOverflow(), bottomVisibleOverflow() - movedSectionLogicalTop));
+        else
+            repaintRectangle(IntRect(movedSectionLogicalTop, topVisibleOverflow(), rightVisibleOverflow() - movedSectionLogicalTop, bottomVisibleOverflow() - topVisibleOverflow()));
+    }
+
     setNeedsLayout(false);
 }
 
-void RenderTable::setCellWidths()
+void RenderTable::setCellLogicalWidths()
 {
     for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
         if (child->isTableSection())
-            toRenderTableSection(child)->setCellWidths();
+            toRenderTableSection(child)->setCellLogicalWidths();
     }
 }
 
@@ -467,8 +474,10 @@ void RenderTable::paintObject(PaintInfo& paintInfo, int tx, int ty)
     info.updatePaintingRootForChildren(this);
 
     for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
-        if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption))
-            child->paint(info, tx, ty);
+        if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption)) {
+            IntPoint childPoint = flipForWritingMode(toRenderBox(child), IntPoint(tx, ty), ParentToChildFlippingAdjustment);
+            child->paint(info, childPoint.x(), childPoint.y());
+        }
     }
     
     if (collapseBorders() && paintPhase == PaintPhaseChildBlockBackground && style()->visibility() == VISIBLE) {
@@ -478,44 +487,57 @@ void RenderTable::paintObject(PaintInfo& paintInfo, int tx, int ty)
         info.phase = PaintPhaseCollapsedTableBorders;
         RenderTableCell::CollapsedBorderStyles borderStyles;
         RenderObject* stop = nextInPreOrderAfterChildren();
-        for (RenderObject* o = firstChild(); o && o != stop; o = o->nextInPreOrder())
+        for (RenderObject* o = firstChild(); o && o != stop; o = o->nextInPreOrder()) {
             if (o->isTableCell())
                 toRenderTableCell(o)->collectBorderStyles(borderStyles);
+        }
         RenderTableCell::sortBorderStyles(borderStyles);
         size_t count = borderStyles.size();
         for (size_t i = 0; i < count; ++i) {
             m_currentBorder = &borderStyles[i];
             for (RenderObject* child = firstChild(); child; child = child->nextSibling())
-                if (child->isTableSection())
-                    child->paint(info, tx, ty);
+                if (child->isTableSection()) {
+                    IntPoint childPoint = flipForWritingMode(toRenderTableSection(child), IntPoint(tx, ty), ParentToChildFlippingAdjustment);
+                    child->paint(info, childPoint.x(), childPoint.y());
+                }
         }
         m_currentBorder = 0;
     }
 }
 
+void RenderTable::subtractCaptionRect(IntRect& rect) const
+{
+    if (!m_caption)
+        return;
+
+    int captionLogicalHeight = m_caption->logicalHeight() + m_caption->marginBefore() + m_caption->marginAfter();
+    bool captionIsBefore = (m_caption->style()->captionSide() != CAPBOTTOM) ^ style()->isFlippedBlocksWritingMode();
+    if (style()->isHorizontalWritingMode()) {
+        rect.setHeight(rect.height() - captionLogicalHeight);
+        if (captionIsBefore)
+            rect.move(0, captionLogicalHeight);
+    } else {
+        rect.setWidth(rect.width() - captionLogicalHeight);
+        if (captionIsBefore)
+            rect.move(captionLogicalHeight, 0);
+    }
+}
+
 void RenderTable::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
 {
     if (!paintInfo.shouldPaintWithinRoot(this))
         return;
 
-    int w = width();
-    int h = height();
-
-    // Account for the caption.
-    if (m_caption) {
-        int captionHeight = (m_caption->height() + m_caption->marginBottom() +  m_caption->marginTop());
-        h -= captionHeight;
-        if (m_caption->style()->captionSide() != CAPBOTTOM)
-            ty += captionHeight;
-    }
+    IntRect rect(tx, ty, width(), height());
+    subtractCaptionRect(rect);
 
-    paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Normal);
+    paintBoxShadow(paintInfo.context, rect.x(), rect.y(), rect.width(), rect.height(), style(), Normal);
     
-    paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->backgroundLayers(), tx, ty, w, h);
-    paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Inset);
+    paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->backgroundLayers(), rect.x(), rect.y(), rect.width(), rect.height());
+    paintBoxShadow(paintInfo.context, rect.x(), rect.y(), rect.width(), rect.height(), style(), Inset);
 
     if (style()->hasBorder() && !collapseBorders())
-        paintBorder(paintInfo.context, tx, ty, w, h, style());
+        paintBorder(paintInfo.context, rect.x(), rect.y(), rect.width(), rect.height(), style());
 }
 
 void RenderTable::paintMask(PaintInfo& paintInfo, int tx, int ty)
@@ -523,18 +545,10 @@ void RenderTable::paintMask(PaintInfo& paintInfo, int tx, int ty)
     if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
         return;
 
-    int w = width();
-    int h = height();
+    IntRect rect(tx, ty, width(), height());
+    subtractCaptionRect(rect);
 
-    // Account for the caption.
-    if (m_caption) {
-        int captionHeight = (m_caption->height() + m_caption->marginBottom() +  m_caption->marginTop());
-        h -= captionHeight;
-        if (m_caption->style()->captionSide() != CAPBOTTOM)
-            ty += captionHeight;
-    }
-
-    paintMaskImages(paintInfo, tx, ty, w, h);
+    paintMaskImages(paintInfo, rect.x(), rect.y(), rect.width(), rect.height());
 }
 
 void RenderTable::computePreferredLogicalWidths()
@@ -542,7 +556,7 @@ void RenderTable::computePreferredLogicalWidths()
     ASSERT(preferredLogicalWidthsDirty());
 
     recalcSectionsIfNeeded();
-    recalcHorizontalBorders();
+    recalcBordersInRowDirection();
 
     m_tableLayout->computePreferredLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth);
 
@@ -721,7 +735,7 @@ void RenderTable::recalcSections() const
     m_needsSectionRecalc = false;
 }
 
-int RenderTable::calcBorderLeft() const
+int RenderTable::calcBorderStart() const
 {
     if (collapseBorders()) {
         // Determined by the first cell of the first row. See the CSS 2.1 spec, section 17.6.2.
@@ -730,16 +744,14 @@ int RenderTable::calcBorderLeft() const
 
         unsigned borderWidth = 0;
 
-        const BorderValue& tb = style()->borderLeft();
+        const BorderValue& tb = style()->borderStart();
         if (tb.style() == BHIDDEN)
             return 0;
         if (tb.style() > BHIDDEN)
             borderWidth = tb.width();
 
-        int leftmostColumn = !style()->isLeftToRightDirection() ? numEffCols() - 1 : 0;
-        RenderTableCol* colGroup = colElement(leftmostColumn);
-        if (colGroup) {
-            const BorderValue& gb = style()->borderLeft();
+        if (RenderTableCol* colGroup = colElement(0)) {
+            const BorderValue& gb = colGroup->style()->borderStart();
             if (gb.style() == BHIDDEN)
                 return 0;
             if (gb.style() > BHIDDEN)
@@ -751,21 +763,21 @@ int RenderTable::calcBorderLeft() const
             firstNonEmptySection = sectionBelow(firstNonEmptySection, true);
         
         if (firstNonEmptySection) {
-            const BorderValue& sb = firstNonEmptySection->style()->borderLeft();
+            const BorderValue& sb = firstNonEmptySection->style()->borderStart();
             if (sb.style() == BHIDDEN)
                 return 0;
 
             if (sb.style() > BHIDDEN)
                 borderWidth = max(borderWidth, static_cast<unsigned>(sb.width()));
 
-            const RenderTableSection::CellStruct& cs = firstNonEmptySection->cellAt(0, leftmostColumn);
+            const RenderTableSection::CellStruct& cs = firstNonEmptySection->cellAt(0, 0);
             
             if (cs.hasCells()) {
-                const BorderValue& cb = cs.primaryCell()->style()->borderLeft();
+                const BorderValue& cb = cs.primaryCell()->style()->borderStart(); // FIXME: Make this work with perpendicualr and flipped cells.
                 if (cb.style() == BHIDDEN)
                     return 0;
 
-                const BorderValue& rb = cs.primaryCell()->parent()->style()->borderLeft();
+                const BorderValue& rb = cs.primaryCell()->parent()->style()->borderStart();
                 if (rb.style() == BHIDDEN)
                     return 0;
 
@@ -775,12 +787,12 @@ int RenderTable::calcBorderLeft() const
                     borderWidth = max(borderWidth, static_cast<unsigned>(rb.width()));
             }
         }
-        return borderWidth / 2;
+        return (borderWidth + (style()->isLeftToRightDirection() ? 0 : 1)) / 2;
     }
-    return RenderBlock::borderLeft();
+    return RenderBlock::borderStart();
 }
-    
-int RenderTable::calcBorderRight() const
+
+int RenderTable::calcBorderEnd() const
 {
     if (collapseBorders()) {
         // Determined by the last cell of the first row. See the CSS 2.1 spec, section 17.6.2.
@@ -789,16 +801,15 @@ int RenderTable::calcBorderRight() const
 
         unsigned borderWidth = 0;
 
-        const BorderValue& tb = style()->borderRight();
+        const BorderValue& tb = style()->borderEnd();
         if (tb.style() == BHIDDEN)
             return 0;
         if (tb.style() > BHIDDEN)
             borderWidth = tb.width();
 
-        int rightmostColumn = !style()->isLeftToRightDirection() ? 0 : numEffCols() - 1;
-        RenderTableCol* colGroup = colElement(rightmostColumn);
-        if (colGroup) {
-            const BorderValue& gb = style()->borderRight();
+        int endColumn = numEffCols() - 1;
+        if (RenderTableCol* colGroup = colElement(endColumn)) {
+            const BorderValue& gb = colGroup->style()->borderEnd();
             if (gb.style() == BHIDDEN)
                 return 0;
             if (gb.style() > BHIDDEN)
@@ -810,21 +821,21 @@ int RenderTable::calcBorderRight() const
             firstNonEmptySection = sectionBelow(firstNonEmptySection, true);
         
         if (firstNonEmptySection) {
-            const BorderValue& sb = firstNonEmptySection->style()->borderRight();
+            const BorderValue& sb = firstNonEmptySection->style()->borderEnd();
             if (sb.style() == BHIDDEN)
                 return 0;
 
             if (sb.style() > BHIDDEN)
                 borderWidth = max(borderWidth, static_cast<unsigned>(sb.width()));
 
-            const RenderTableSection::CellStruct& cs = firstNonEmptySection->cellAt(0, rightmostColumn);
+            const RenderTableSection::CellStruct& cs = firstNonEmptySection->cellAt(0, endColumn);
             
             if (cs.hasCells()) {
-                const BorderValue& cb = cs.primaryCell()->style()->borderRight();
+                const BorderValue& cb = cs.primaryCell()->style()->borderEnd(); // FIXME: Make this work with perpendicular and flipped cells.
                 if (cb.style() == BHIDDEN)
                     return 0;
 
-                const BorderValue& rb = cs.primaryCell()->parent()->style()->borderRight();
+                const BorderValue& rb = cs.primaryCell()->parent()->style()->borderEnd();
                 if (rb.style() == BHIDDEN)
                     return 0;
 
@@ -834,32 +845,32 @@ int RenderTable::calcBorderRight() const
                     borderWidth = max(borderWidth, static_cast<unsigned>(rb.width()));
             }
         }
-        return (borderWidth + 1) / 2;
+        return (borderWidth + (style()->isLeftToRightDirection() ? 1 : 0)) / 2;
     }
-    return RenderBlock::borderRight();
+    return RenderBlock::borderEnd();
 }
 
-void RenderTable::recalcHorizontalBorders()
+void RenderTable::recalcBordersInRowDirection()
 {
-    m_borderLeft = calcBorderLeft();
-    m_borderRight = calcBorderRight();
+    m_borderStart = calcBorderStart();
+    m_borderEnd = calcBorderEnd();
 }
 
-int RenderTable::borderTop() const
+int RenderTable::borderBefore() const
 {
     if (collapseBorders())
-        return outerBorderTop();
-    return RenderBlock::borderTop();
+        return outerBorderBefore();
+    return RenderBlock::borderBefore();
 }
 
-int RenderTable::borderBottom() const
+int RenderTable::borderAfter() const
 {
     if (collapseBorders())
-        return outerBorderBottom();
-    return RenderBlock::borderBottom();
+        return outerBorderAfter();
+    return RenderBlock::borderAfter();
 }
 
-int RenderTable::outerBorderTop() const
+int RenderTable::outerBorderBefore() const
 {
     if (!collapseBorders())
         return 0;
@@ -874,11 +885,11 @@ int RenderTable::outerBorderTop() const
     else
         topSection = 0;
     if (topSection) {
-        borderWidth = topSection->outerBorderTop();
+        borderWidth = topSection->outerBorderBefore();
         if (borderWidth == -1)
             return 0;   // Overridden by hidden
     }
-    const BorderValue& tb = style()->borderTop();
+    const BorderValue& tb = style()->borderBefore();
     if (tb.style() == BHIDDEN)
         return 0;
     if (tb.style() > BHIDDEN)
@@ -886,7 +897,7 @@ int RenderTable::outerBorderTop() const
     return borderWidth;
 }
 
-int RenderTable::outerBorderBottom() const
+int RenderTable::outerBorderAfter() const
 {
     if (!collapseBorders())
         return 0;
@@ -900,11 +911,11 @@ int RenderTable::outerBorderBottom() const
         bottomSection = child ? toRenderTableSection(child) : 0;
     }
     if (bottomSection) {
-        borderWidth = bottomSection->outerBorderBottom();
+        borderWidth = bottomSection->outerBorderAfter();
         if (borderWidth == -1)
             return 0;   // Overridden by hidden
     }
-    const BorderValue& tb = style()->borderBottom();
+    const BorderValue& tb = style()->borderAfter();
     if (tb.style() == BHIDDEN)
         return 0;
     if (tb.style() > BHIDDEN)
@@ -912,24 +923,24 @@ int RenderTable::outerBorderBottom() const
     return borderWidth;
 }
 
-int RenderTable::outerBorderLeft() const
+int RenderTable::outerBorderStart() const
 {
     if (!collapseBorders())
         return 0;
 
     int borderWidth = 0;
 
-    const BorderValue& tb = style()->borderLeft();
+    const BorderValue& tb = style()->borderStart();
     if (tb.style() == BHIDDEN)
         return 0;
     if (tb.style() > BHIDDEN)
-        borderWidth = tb.width() / 2;
+        borderWidth = (tb.width() + (style()->isLeftToRightDirection() ? 0 : 1)) / 2;
 
     bool allHidden = true;
     for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
         if (!child->isTableSection())
             continue;
-        int sw = toRenderTableSection(child)->outerBorderLeft();
+        int sw = toRenderTableSection(child)->outerBorderStart();
         if (sw == -1)
             continue;
         else
@@ -942,24 +953,24 @@ int RenderTable::outerBorderLeft() const
     return borderWidth;
 }
 
-int RenderTable::outerBorderRight() const
+int RenderTable::outerBorderEnd() const
 {
     if (!collapseBorders())
         return 0;
 
     int borderWidth = 0;
 
-    const BorderValue& tb = style()->borderRight();
+    const BorderValue& tb = style()->borderEnd();
     if (tb.style() == BHIDDEN)
         return 0;
     if (tb.style() > BHIDDEN)
-        borderWidth = (tb.width() + 1) / 2;
+        borderWidth = (tb.width() + (style()->isLeftToRightDirection() ? 1 : 0)) / 2;
 
     bool allHidden = true;
     for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
         if (!child->isTableSection())
             continue;
-        int sw = toRenderTableSection(child)->outerBorderRight();
+        int sw = toRenderTableSection(child)->outerBorderEnd();
         if (sw == -1)
             continue;
         else
@@ -1097,6 +1108,9 @@ void RenderTable::updateFirstLetter()
 
 int RenderTable::firstLineBoxBaseline() const
 {
+    if (isWritingModeRoot())
+        return -1;
+
     RenderTableSection* firstNonEmptySection = m_head ? m_head : (m_firstBody ? m_firstBody : m_foot);
     if (firstNonEmptySection && !firstNonEmptySection->numRows())
         firstNonEmptySection = sectionBelow(firstNonEmptySection, true);
@@ -1104,7 +1118,7 @@ int RenderTable::firstLineBoxBaseline() const
     if (!firstNonEmptySection)
         return -1;
 
-    return firstNonEmptySection->y() + firstNonEmptySection->firstLineBoxBaseline();
+    return firstNonEmptySection->logicalTop() + firstNonEmptySection->firstLineBoxBaseline();
 }
 
 IntRect RenderTable::overflowClipRect(int tx, int ty)
@@ -1118,8 +1132,13 @@ IntRect RenderTable::overflowClipRect(int tx, int ty)
     // supported.  When we actually support left/right and stop mapping them to top/bottom,
     // we might have to hack this code first (depending on what order we do these bug fixes in).
     if (m_caption) {
-        rect.setHeight(height());
-        rect.setY(ty);
+        if (style()->isHorizontalWritingMode()) {
+            rect.setHeight(height());
+            rect.setY(ty);
+        } else {
+            rect.setWidth(width());
+            rect.setX(tx);
+        }
     }
 
     return rect;
diff --git a/WebCore/rendering/RenderTable.h b/WebCore/rendering/RenderTable.h
index f392362..36609c5 100644
--- a/WebCore/rendering/RenderTable.h
+++ b/WebCore/rendering/RenderTable.h
@@ -4,7 +4,7 @@
  *           (C) 1998 Waldo Bastian (bastian at kde.org)
  *           (C) 1999 Lars Knoll (knoll at kde.org)
  *           (C) 1999 Antti Koivisto (koivisto at kde.org)
- * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -47,21 +47,78 @@ public:
     int vBorderSpacing() const { return m_vSpacing; }
     
     bool collapseBorders() const { return style()->borderCollapse(); }
-    int borderLeft() const { return m_borderLeft; }
-    int borderRight() const { return m_borderRight; }
-    int borderTop() const;
-    int borderBottom() const;
-    
+
+    int borderStart() const { return m_borderStart; }
+    int borderEnd() const { return m_borderEnd; }
+    int borderBefore() const;
+    int borderAfter() const;
+
+    int borderLeft() const
+    {
+        if (style()->isHorizontalWritingMode())
+            return style()->isLeftToRightDirection() ? borderStart() : borderEnd();
+        return style()->isFlippedBlocksWritingMode() ? borderAfter() : borderBefore();
+    }
+
+    int borderRight() const
+    {
+        if (style()->isHorizontalWritingMode())
+            return style()->isLeftToRightDirection() ? borderEnd() : borderStart();
+        return style()->isFlippedBlocksWritingMode() ? borderBefore() : borderAfter();
+    }
+
+    int borderTop() const
+    {
+        if (style()->isHorizontalWritingMode())
+            return style()->isFlippedBlocksWritingMode() ? borderAfter() : borderBefore();
+        return style()->isLeftToRightDirection() ? borderStart() : borderEnd();
+    }
+
+    int borderBottom() const
+    {
+        if (style()->isHorizontalWritingMode())
+            return style()->isFlippedBlocksWritingMode() ? borderBefore() : borderAfter();
+        return style()->isLeftToRightDirection() ? borderEnd() : borderStart();
+    }
+
     const Color bgColor() const { return style()->visitedDependentColor(CSSPropertyBackgroundColor); }
 
-    int outerBorderTop() const;
-    int outerBorderBottom() const;
-    int outerBorderLeft() const;
-    int outerBorderRight() const;
-    
-    int calcBorderLeft() const;
-    int calcBorderRight() const;
-    void recalcHorizontalBorders();
+    int outerBorderBefore() const;
+    int outerBorderAfter() const;
+    int outerBorderStart() const;
+    int outerBorderEnd() const;
+
+    int outerBorderLeft() const
+    {
+        if (style()->isHorizontalWritingMode())
+            return style()->isLeftToRightDirection() ? outerBorderStart() : outerBorderEnd();
+        return style()->isFlippedBlocksWritingMode() ? outerBorderAfter() : outerBorderBefore();
+    }
+
+    int outerBorderRight() const
+    {
+        if (style()->isHorizontalWritingMode())
+            return style()->isLeftToRightDirection() ? outerBorderEnd() : outerBorderStart();
+        return style()->isFlippedBlocksWritingMode() ? outerBorderBefore() : outerBorderAfter();
+    }
+
+    int outerBorderTop() const
+    {
+        if (style()->isHorizontalWritingMode())
+            return style()->isFlippedBlocksWritingMode() ? outerBorderAfter() : outerBorderBefore();
+        return style()->isLeftToRightDirection() ? outerBorderStart() : outerBorderEnd();
+    }
+
+    int outerBorderBottom() const
+    {
+        if (style()->isHorizontalWritingMode())
+            return style()->isFlippedBlocksWritingMode() ? outerBorderBefore() : outerBorderAfter();
+        return style()->isLeftToRightDirection() ? outerBorderEnd() : outerBorderStart();
+    }
+
+    int calcBorderStart() const;
+    int calcBorderEnd() const;
+    void recalcBordersInRowDirection();
 
     virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
 
@@ -110,8 +167,8 @@ public:
 
     int bordersPaddingAndSpacingInRowDirection() const
     {
-        return borderLeft() + borderRight() +
-               (collapseBorders() ? 0 : (paddingLeft() + paddingRight() + (numEffCols() + 1) * hBorderSpacing()));
+        return borderStart() + borderEnd() +
+               (collapseBorders() ? 0 : (paddingStart() + paddingEnd() + (numEffCols() + 1) * hBorderSpacing()));
     }
 
     RenderTableCol* colElement(int col, bool* startEdge = 0, bool* endEdge = 0) const;
@@ -169,12 +226,14 @@ private:
     virtual RenderBlock* firstLineBlock() const;
     virtual void updateFirstLetter();
     
-    virtual void setCellWidths();
+    virtual void setCellLogicalWidths();
 
     virtual void computeLogicalWidth();
 
     virtual IntRect overflowClipRect(int tx, int ty);
 
+    void subtractCaptionRect(IntRect&) const;
+
     void recalcSections() const;
 
     mutable Vector<int> m_columnPos;
@@ -194,8 +253,8 @@ private:
     
     short m_hSpacing;
     short m_vSpacing;
-    int m_borderLeft;
-    int m_borderRight;
+    int m_borderStart;
+    int m_borderEnd;
 };
 
 inline RenderTable* toRenderTable(RenderObject* object)
diff --git a/WebCore/rendering/RenderTableRow.cpp b/WebCore/rendering/RenderTableRow.cpp
index d0bd511..2166ef2 100644
--- a/WebCore/rendering/RenderTableRow.cpp
+++ b/WebCore/rendering/RenderTableRow.cpp
@@ -4,7 +4,7 @@
  *           (C) 1998 Waldo Bastian (bastian at kde.org)
  *           (C) 1999 Lars Knoll (knoll at kde.org)
  *           (C) 1999 Antti Koivisto (koivisto at kde.org)
- * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -54,7 +54,7 @@ void RenderTableRow::destroy()
 
 void RenderTableRow::styleWillChange(StyleDifference diff, const RenderStyle* newStyle)
 {
-    if (section() && style() && style()->height() != newStyle->height())
+    if (section() && style() && style()->logicalHeight() != newStyle->logicalHeight())
         section()->setNeedsCellRecalc();
 
     ASSERT(newStyle->display() == TABLE_ROW);
diff --git a/WebCore/rendering/RenderTableSection.cpp b/WebCore/rendering/RenderTableSection.cpp
index 8fb1d7f..093c102 100644
--- a/WebCore/rendering/RenderTableSection.cpp
+++ b/WebCore/rendering/RenderTableSection.cpp
@@ -4,7 +4,7 @@
  *           (C) 1998 Waldo Bastian (bastian at kde.org)
  *           (C) 1999 Lars Knoll (knoll at kde.org)
  *           (C) 1999 Antti Koivisto (koivisto at kde.org)
- * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Alexey Proskuryakov (ap at nypop.com)
  *
  * This library is free software; you can redistribute it and/or
@@ -43,12 +43,12 @@ namespace WebCore {
 
 using namespace HTMLNames;
 
-static inline void setRowHeightToRowStyleHeightIfNotRelative(RenderTableSection::RowStruct* row)
+static inline void setRowLogicalHeightToRowStyleLogicalHeightIfNotRelative(RenderTableSection::RowStruct* row)
 {
     ASSERT(row && row->rowRenderer);
-    row->height = row->rowRenderer->style()->height();
-    if (row->height.isRelative())
-        row->height = Length();
+    row->logicalHeight = row->rowRenderer->style()->logicalHeight();
+    if (row->logicalHeight.isRelative())
+        row->logicalHeight = Length();
 }
 
 RenderTableSection::RenderTableSection(Node* node)
@@ -56,10 +56,10 @@ RenderTableSection::RenderTableSection(Node* node)
     , m_gridRows(0)
     , m_cCol(0)
     , m_cRow(-1)
-    , m_outerBorderLeft(0)
-    , m_outerBorderRight(0)
-    , m_outerBorderTop(0)
-    , m_outerBorderBottom(0)
+    , m_outerBorderStart(0)
+    , m_outerBorderEnd(0)
+    , m_outerBorderBefore(0)
+    , m_outerBorderAfter(0)
     , m_needsCellRecalc(false)
     , m_hasOverflowingCell(false)
     , m_hasMultipleCellLevels(false)
@@ -133,7 +133,7 @@ void RenderTableSection::addChild(RenderObject* child, RenderObject* beforeChild
     m_grid[m_cRow].rowRenderer = toRenderTableRow(child);
 
     if (!beforeChild)
-        setRowHeightToRowStyleHeightIfNotRelative(&m_grid[m_cRow]);
+        setRowLogicalHeightToRowStyleLogicalHeightIfNotRelative(&m_grid[m_cRow]);
 
     // If the next renderer is actually wrapped in an anonymous table row, we need to go up and find that.
     while (beforeChild && beforeChild->parent() != this)
@@ -165,7 +165,7 @@ bool RenderTableSection::ensureRows(int numRows)
             m_grid[r].row = new Row(nCols);
             m_grid[r].rowRenderer = 0;
             m_grid[r].baseline = 0;
-            m_grid[r].height = Length();
+            m_grid[r].logicalHeight = Length();
         }
     }
 
@@ -190,19 +190,19 @@ void RenderTableSection::addCell(RenderTableCell* cell, RenderTableRow* row)
 
     if (rSpan == 1) {
         // we ignore height settings on rowspan cells
-        Length height = cell->style()->height();
-        if (height.isPositive() || (height.isRelative() && height.value() >= 0)) {
-            Length cRowHeight = m_grid[m_cRow].height;
-            switch (height.type()) {
+        Length logicalHeight = cell->style()->logicalHeight();
+        if (logicalHeight.isPositive() || (logicalHeight.isRelative() && logicalHeight.value() >= 0)) {
+            Length cRowLogicalHeight = m_grid[m_cRow].logicalHeight;
+            switch (logicalHeight.type()) {
                 case Percent:
-                    if (!(cRowHeight.isPercent()) ||
-                        (cRowHeight.isPercent() && cRowHeight.rawValue() < height.rawValue()))
-                        m_grid[m_cRow].height = height;
+                    if (!(cRowLogicalHeight.isPercent()) ||
+                        (cRowLogicalHeight.isPercent() && cRowLogicalHeight.rawValue() < logicalHeight.rawValue()))
+                        m_grid[m_cRow].logicalHeight = logicalHeight;
                         break;
                 case Fixed:
-                    if (cRowHeight.type() < Percent ||
-                        (cRowHeight.isFixed() && cRowHeight.value() < height.value()))
-                        m_grid[m_cRow].height = height;
+                    if (cRowLogicalHeight.type() < Percent ||
+                        (cRowLogicalHeight.isFixed() && cRowLogicalHeight.value() < logicalHeight.value()))
+                        m_grid[m_cRow].logicalHeight = logicalHeight;
                     break;
                 case Relative:
                 default:
@@ -248,7 +248,7 @@ void RenderTableSection::addCell(RenderTableCell* cell, RenderTableRow* row)
     cell->setCol(table()->effColToCol(col));
 }
 
-void RenderTableSection::setCellWidths()
+void RenderTableSection::setCellLogicalWidths()
 {
     Vector<int>& columnPos = table()->columnPositions();
 
@@ -270,8 +270,8 @@ void RenderTableSection::setCellWidths()
                 endCol++;
             }
             int w = columnPos[endCol] - columnPos[j] - table()->hBorderSpacing();
-            int oldWidth = cell->width();
-            if (w != oldWidth) {
+            int oldLogicalWidth = cell->logicalWidth();
+            if (w != oldLogicalWidth) {
                 cell->setNeedsLayout(true);
                 if (!table()->selfNeedsLayout() && cell->checkForRepaintDuringLayout()) {
                     if (!statePusher.didPush()) {
@@ -289,7 +289,7 @@ void RenderTableSection::setCellWidths()
     statePusher.pop(); // only pops if we pushed
 }
 
-int RenderTableSection::calcRowHeight()
+int RenderTableSection::calcRowLogicalHeight()
 {
 #ifndef NDEBUG
     setNeedsLayoutIsForbidden(true);
@@ -311,7 +311,7 @@ int RenderTableSection::calcRowHeight()
         m_grid[r].baseline = 0;
         int baseline = 0;
         int bdesc = 0;
-        int ch = m_grid[r].height.calcMinValue(0);
+        int ch = m_grid[r].logicalHeight.calcMinValue(0);
         int pos = m_rowPos[r] + ch + (m_grid[r].rowRenderer ? spacing : 0);
 
         m_rowPos[r + 1] = max(m_rowPos[r + 1], pos);
@@ -341,17 +341,17 @@ int RenderTableSection::calcRowHeight()
                 cell->setChildNeedsLayout(true, false);
                 cell->layoutIfNeeded();
             }
-            
-            int adjustedPaddingTop = cell->paddingTop() - cell->intrinsicPaddingBefore();
-            int adjustedPaddingBottom = cell->paddingBottom() - cell->intrinsicPaddingAfter();
-            int adjustedHeight = cell->height() - (cell->intrinsicPaddingBefore() + cell->intrinsicPaddingAfter());
-        
+
+            int adjustedPaddingBefore = cell->paddingBefore() - cell->intrinsicPaddingBefore();
+            int adjustedPaddingAfter = cell->paddingAfter() - cell->intrinsicPaddingAfter();
+            int adjustedLogicalHeight = cell->logicalHeight() - (cell->intrinsicPaddingBefore() + cell->intrinsicPaddingAfter());
+
             // Explicit heights use the border box in quirks mode.  In strict mode do the right
             // thing and actually add in the border and padding.
-            ch = cell->style()->height().calcValue(0) + 
-                (document()->inQuirksMode() ? 0 : (adjustedPaddingTop + adjustedPaddingBottom +
-                                                   cell->borderTop() + cell->borderBottom()));
-            ch = max(ch, adjustedHeight);
+            ch = cell->style()->logicalHeight().calcValue(0) + 
+                (document()->inQuirksMode() ? 0 : (adjustedPaddingBefore + adjustedPaddingAfter +
+                                                   cell->borderBefore() + cell->borderAfter()));
+            ch = max(ch, adjustedLogicalHeight);
 
             pos = m_rowPos[indx] + ch + (m_grid[r].rowRenderer ? spacing : 0);
 
@@ -361,7 +361,7 @@ int RenderTableSection::calcRowHeight()
             EVerticalAlign va = cell->style()->verticalAlign();
             if (va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB) {
                 int b = cell->baselinePosition();
-                if (b > cell->borderTop() + cell->paddingTop()) {
+                if (b > cell->borderBefore() + cell->paddingBefore()) {
                     baseline = max(baseline, b - cell->intrinsicPaddingBefore());
                     bdesc = max(bdesc, m_rowPos[indx] + ch - (b - cell->intrinsicPaddingBefore()));
                 }
@@ -417,7 +417,7 @@ int RenderTableSection::layoutRows(int toAdd)
     int totalRows = m_gridRows;
     
     // Set the width of our section now.  The rows will also be this width.
-    setWidth(table()->contentWidth());
+    setLogicalWidth(table()->contentLogicalWidth());
     m_overflow.clear();
     m_hasOverflowingCell = false;
 
@@ -428,10 +428,10 @@ int RenderTableSection::layoutRows(int toAdd)
         int totalPercent = 0;
         int numAuto = 0;
         for (int r = 0; r < totalRows; r++) {
-            if (m_grid[r].height.isAuto())
+            if (m_grid[r].logicalHeight.isAuto())
                 numAuto++;
-            else if (m_grid[r].height.isPercent())
-                totalPercent += m_grid[r].height.rawValue();
+            else if (m_grid[r].logicalHeight.isPercent())
+                totalPercent += m_grid[r].logicalHeight.rawValue();
         }
         if (totalPercent) {
             // try to satisfy percent
@@ -439,14 +439,14 @@ int RenderTableSection::layoutRows(int toAdd)
             totalPercent = min(totalPercent, 100 * percentScaleFactor);
             int rh = m_rowPos[1] - m_rowPos[0];
             for (int r = 0; r < totalRows; r++) {
-                if (totalPercent > 0 && m_grid[r].height.isPercent()) {
-                    int toAdd = min(dh, (totalHeight * m_grid[r].height.rawValue() / (100 * percentScaleFactor)) - rh);
+                if (totalPercent > 0 && m_grid[r].logicalHeight.isPercent()) {
+                    int toAdd = min(dh, (totalHeight * m_grid[r].logicalHeight.rawValue() / (100 * percentScaleFactor)) - rh);
                     // If toAdd is negative, then we don't want to shrink the row (this bug
                     // affected Outlook Web Access).
                     toAdd = max(0, toAdd);
                     add += toAdd;
                     dh -= toAdd;
-                    totalPercent -= m_grid[r].height.rawValue();
+                    totalPercent -= m_grid[r].logicalHeight.rawValue();
                 }
                 if (r < totalRows - 1)
                     rh = m_rowPos[r + 2] - m_rowPos[r + 1];
@@ -457,7 +457,7 @@ int RenderTableSection::layoutRows(int toAdd)
             // distribute over variable cols
             int add = 0;
             for (int r = 0; r < totalRows; r++) {
-                if (numAuto > 0 && m_grid[r].height.isAuto()) {
+                if (numAuto > 0 && m_grid[r].logicalHeight.isAuto()) {
                     int toAdd = dh / numAuto;
                     add += toAdd;
                     dh -= toAdd;
@@ -490,8 +490,8 @@ int RenderTableSection::layoutRows(int toAdd)
         // Set the row's x/y position and width/height.
         if (RenderTableRow* rowRenderer = m_grid[r].rowRenderer) {
             rowRenderer->setLocation(0, m_rowPos[r]);
-            rowRenderer->setWidth(width());
-            rowRenderer->setHeight(m_rowPos[r + 1] - m_rowPos[r] - vspacing);
+            rowRenderer->setLogicalWidth(logicalWidth());
+            rowRenderer->setLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vspacing);
         }
 
         for (int c = 0; c < nEffCols; c++) {
@@ -518,11 +518,11 @@ int RenderTableSection::layoutRows(int toAdd)
             // match the behavior perfectly, but we'll continue to refine it as we discover new
             // bugs. :)
             bool cellChildrenFlex = false;
-            bool flexAllChildren = cell->style()->height().isFixed()
-                || (!table()->style()->height().isAuto() && rHeight != cell->height());
+            bool flexAllChildren = cell->style()->logicalHeight().isFixed()
+                || (!table()->style()->logicalHeight().isAuto() && rHeight != cell->logicalHeight());
 
             for (RenderObject* o = cell->firstChild(); o; o = o->nextSibling()) {
-                if (!o->isText() && o->style()->height().isPercent() && (flexAllChildren || o->isReplaced() || (o->isBox() && toRenderBox(o)->scrollsOverflow()))) {
+                if (!o->isText() && o->style()->logicalHeight().isPercent() && (flexAllChildren || o->isReplaced() || (o->isBox() && toRenderBox(o)->scrollsOverflow()))) {
                     // Tables with no sections do not flex.
                     if (!o->isTable() || toRenderTable(o)->hasSections()) {
                         o->setNeedsLayout(true, false);
@@ -557,24 +557,24 @@ int RenderTableSection::layoutRows(int toAdd)
                 // height, which becomes irrelevant once the cell has
                 // been resized based off its percentage.
                 cell->setOverrideSize(max(0, 
-                                           rHeight - cell->borderTop() - cell->paddingTop() - 
-                                                     cell->borderBottom() - cell->paddingBottom()));
+                                           rHeight - cell->borderBefore() - cell->paddingBefore() - 
+                                                     cell->borderAfter() - cell->paddingAfter()));
                 cell->layoutIfNeeded();
-                
+
                 // If the baseline moved, we may have to update the data for our row. Find out the new baseline.
                 EVerticalAlign va = cell->style()->verticalAlign();
                 if (va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB) {
                     int b = cell->baselinePosition();
-                    if (b > cell->borderTop() + cell->paddingTop())
+                    if (b > cell->borderBefore() + cell->paddingBefore())
                         m_grid[r].baseline = max(m_grid[r].baseline, b);
                 }
             }
-            
-            int oldTe = cell->intrinsicPaddingBefore();
-            int oldBe = cell->intrinsicPaddingAfter();
-            int heightWithoutIntrinsicPadding = cell->height() - oldTe - oldBe;
-            
-            int te = 0;
+
+            int oldIntrinsicPaddingBefore = cell->intrinsicPaddingBefore();
+            int oldIntrinsicPaddingAfter = cell->intrinsicPaddingAfter();
+            int logicalHeightWithoutIntrinsicPadding = cell->logicalHeight() - oldIntrinsicPaddingBefore - oldIntrinsicPaddingAfter;
+
+            int intrinsicPaddingBefore = 0;
             switch (cell->style()->verticalAlign()) {
                 case SUB:
                 case SUPER:
@@ -582,46 +582,46 @@ int RenderTableSection::layoutRows(int toAdd)
                 case TEXT_BOTTOM:
                 case BASELINE: {
                     int b = cell->baselinePosition();
-                    if (b > cell->borderTop() + cell->paddingTop())
-                        te = getBaseline(r) - (b - oldTe);
+                    if (b > cell->borderBefore() + cell->paddingBefore())
+                        intrinsicPaddingBefore = getBaseline(r) - (b - oldIntrinsicPaddingBefore);
                     break;
                 }
                 case TOP:
-                    te = 0;
                     break;
                 case MIDDLE:
-                    te = (rHeight - heightWithoutIntrinsicPadding) / 2;
+                    intrinsicPaddingBefore = (rHeight - logicalHeightWithoutIntrinsicPadding) / 2;
                     break;
                 case BOTTOM:
-                    te = rHeight - heightWithoutIntrinsicPadding;
+                    intrinsicPaddingBefore = rHeight - logicalHeightWithoutIntrinsicPadding;
                     break;
                 default:
                     break;
             }
             
-            int be = rHeight - heightWithoutIntrinsicPadding - te;
-            cell->setIntrinsicPaddingBefore(te);
-            cell->setIntrinsicPaddingAfter(be);
-            
+            int intrinsicPaddingAfter = rHeight - logicalHeightWithoutIntrinsicPadding - intrinsicPaddingBefore;
+            cell->setIntrinsicPaddingBefore(intrinsicPaddingBefore);
+            cell->setIntrinsicPaddingAfter(intrinsicPaddingAfter);
+
             IntRect oldCellRect(cell->x(), cell->y() , cell->width(), cell->height());
-            
+
             if (!style()->isLeftToRightDirection())
-                cell->setLocation(table()->columnPositions()[nEffCols] - table()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + hspacing, m_rowPos[rindx]);
+                cell->setLogicalLocation(table()->columnPositions()[nEffCols] - table()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + hspacing, m_rowPos[rindx]);
             else
-                cell->setLocation(table()->columnPositions()[c] + hspacing, m_rowPos[rindx]);
+                cell->setLogicalLocation(table()->columnPositions()[c] + hspacing, m_rowPos[rindx]);
             view()->addLayoutDelta(IntSize(oldCellRect.x() - cell->x(), oldCellRect.y() - cell->y()));
 
-            if (te != oldTe || be != oldBe)
+            if (intrinsicPaddingBefore != oldIntrinsicPaddingBefore || intrinsicPaddingAfter != oldIntrinsicPaddingAfter)
                 cell->setNeedsLayout(true, false);
-            
+
             if (!cell->needsLayout() && view()->layoutState()->m_pageHeight && view()->layoutState()->pageY(cell->y()) != cell->pageY())
                 cell->setChildNeedsLayout(true, false);
-            
+
             cell->layoutIfNeeded();
-            
-            if (view()->layoutState()->m_pageHeight && cell->height() != rHeight)
+
+            // FIXME: Make pagination work with vertical tables.
+            if (style()->isHorizontalWritingMode() && view()->layoutState()->m_pageHeight && cell->height() != rHeight)
                 cell->setHeight(rHeight); // FIXME: Pagination might have made us change size.  For now just shrink or grow the cell to fit without doing a relayout.
-        
+
             IntSize childOffset(cell->x() - oldCellRect.x(), cell->y() - oldCellRect.y());
             if (childOffset.width() || childOffset.height()) {
                 view()->addLayoutDelta(childOffset);
@@ -641,7 +641,7 @@ int RenderTableSection::layoutRows(int toAdd)
 
     ASSERT(!needsLayout());
 
-    setHeight(m_rowPos[totalRows]);
+    setLogicalHeight(m_rowPos[totalRows]);
 
     // Now that our height has been determined, add in overflow from cells.
     for (int r = 0; r < totalRows; r++) {
@@ -733,7 +733,7 @@ int RenderTableSection::leftmostPosition(bool includeOverflowInterior, bool incl
     return left;
 }
 
-int RenderTableSection::calcOuterBorderTop() const
+int RenderTableSection::calcOuterBorderBefore() const
 {
     int totalCols = table()->numEffCols();
     if (!m_gridRows || !totalCols)
@@ -741,13 +741,13 @@ int RenderTableSection::calcOuterBorderTop() const
 
     unsigned borderWidth = 0;
 
-    const BorderValue& sb = style()->borderTop();
+    const BorderValue& sb = style()->borderBefore();
     if (sb.style() == BHIDDEN)
         return -1;
     if (sb.style() > BHIDDEN)
         borderWidth = sb.width();
 
-    const BorderValue& rb = firstChild()->style()->borderTop();
+    const BorderValue& rb = firstChild()->style()->borderBefore();
     if (rb.style() == BHIDDEN)
         return -1;
     if (rb.style() > BHIDDEN && rb.width() > borderWidth)
@@ -758,11 +758,11 @@ int RenderTableSection::calcOuterBorderTop() const
         const CellStruct& current = cellAt(0, c);
         if (current.inColSpan || !current.hasCells())
             continue;
-        const BorderValue& cb = current.primaryCell()->style()->borderTop();
+        const BorderValue& cb = current.primaryCell()->style()->borderBefore(); // FIXME: Make this work with perpendicular and flipped cells.
         // FIXME: Don't repeat for the same col group
         RenderTableCol* colGroup = table()->colElement(c);
         if (colGroup) {
-            const BorderValue& gb = colGroup->style()->borderTop();
+            const BorderValue& gb = colGroup->style()->borderBefore();
             if (gb.style() == BHIDDEN || cb.style() == BHIDDEN)
                 continue;
             allHidden = false;
@@ -784,7 +784,7 @@ int RenderTableSection::calcOuterBorderTop() const
     return borderWidth / 2;
 }
 
-int RenderTableSection::calcOuterBorderBottom() const
+int RenderTableSection::calcOuterBorderAfter() const
 {
     int totalCols = table()->numEffCols();
     if (!m_gridRows || !totalCols)
@@ -792,13 +792,13 @@ int RenderTableSection::calcOuterBorderBottom() const
 
     unsigned borderWidth = 0;
 
-    const BorderValue& sb = style()->borderBottom();
+    const BorderValue& sb = style()->borderAfter();
     if (sb.style() == BHIDDEN)
         return -1;
     if (sb.style() > BHIDDEN)
         borderWidth = sb.width();
 
-    const BorderValue& rb = lastChild()->style()->borderBottom();
+    const BorderValue& rb = lastChild()->style()->borderAfter();
     if (rb.style() == BHIDDEN)
         return -1;
     if (rb.style() > BHIDDEN && rb.width() > borderWidth)
@@ -809,11 +809,11 @@ int RenderTableSection::calcOuterBorderBottom() const
         const CellStruct& current = cellAt(m_gridRows - 1, c);
         if (current.inColSpan || !current.hasCells())
             continue;
-        const BorderValue& cb = current.primaryCell()->style()->borderBottom();
+        const BorderValue& cb = current.primaryCell()->style()->borderAfter(); // FIXME: Make this work with perpendicular and flipped cells.
         // FIXME: Don't repeat for the same col group
         RenderTableCol* colGroup = table()->colElement(c);
         if (colGroup) {
-            const BorderValue& gb = colGroup->style()->borderBottom();
+            const BorderValue& gb = colGroup->style()->borderAfter();
             if (gb.style() == BHIDDEN || cb.style() == BHIDDEN)
                 continue;
             allHidden = false;
@@ -835,7 +835,7 @@ int RenderTableSection::calcOuterBorderBottom() const
     return (borderWidth + 1) / 2;
 }
 
-int RenderTableSection::calcOuterBorderLeft(bool rtl) const
+int RenderTableSection::calcOuterBorderStart() const
 {
     int totalCols = table()->numEffCols();
     if (!m_gridRows || !totalCols)
@@ -843,16 +843,14 @@ int RenderTableSection::calcOuterBorderLeft(bool rtl) const
 
     unsigned borderWidth = 0;
 
-    const BorderValue& sb = style()->borderLeft();
+    const BorderValue& sb = style()->borderStart();
     if (sb.style() == BHIDDEN)
         return -1;
     if (sb.style() > BHIDDEN)
         borderWidth = sb.width();
 
-    int leftmostColumn = rtl ? totalCols - 1 : 0;
-    RenderTableCol* colGroup = table()->colElement(leftmostColumn);
-    if (colGroup) {
-        const BorderValue& gb = colGroup->style()->borderLeft();
+    if (RenderTableCol* colGroup = table()->colElement(0)) {
+        const BorderValue& gb = colGroup->style()->borderStart();
         if (gb.style() == BHIDDEN)
             return -1;
         if (gb.style() > BHIDDEN && gb.width() > borderWidth)
@@ -861,12 +859,12 @@ int RenderTableSection::calcOuterBorderLeft(bool rtl) const
 
     bool allHidden = true;
     for (int r = 0; r < m_gridRows; r++) {
-        const CellStruct& current = cellAt(r, leftmostColumn);
+        const CellStruct& current = cellAt(r, 0);
         if (!current.hasCells())
             continue;
         // FIXME: Don't repeat for the same cell
-        const BorderValue& cb = current.primaryCell()->style()->borderLeft();
-        const BorderValue& rb = current.primaryCell()->parent()->style()->borderLeft();
+        const BorderValue& cb = current.primaryCell()->style()->borderStart(); // FIXME: Make this work with perpendicular and flipped cells.
+        const BorderValue& rb = current.primaryCell()->parent()->style()->borderStart();
         if (cb.style() == BHIDDEN || rb.style() == BHIDDEN)
             continue;
         allHidden = false;
@@ -878,10 +876,10 @@ int RenderTableSection::calcOuterBorderLeft(bool rtl) const
     if (allHidden)
         return -1;
 
-    return borderWidth / 2;
+    return (borderWidth + (table()->style()->isLeftToRightDirection() ? 0 : 1)) / 2;
 }
 
-int RenderTableSection::calcOuterBorderRight(bool rtl) const
+int RenderTableSection::calcOuterBorderEnd() const
 {
     int totalCols = table()->numEffCols();
     if (!m_gridRows || !totalCols)
@@ -889,16 +887,14 @@ int RenderTableSection::calcOuterBorderRight(bool rtl) const
 
     unsigned borderWidth = 0;
 
-    const BorderValue& sb = style()->borderRight();
+    const BorderValue& sb = style()->borderEnd();
     if (sb.style() == BHIDDEN)
         return -1;
     if (sb.style() > BHIDDEN)
         borderWidth = sb.width();
 
-    int rightmostColumn = rtl ? 0 : totalCols - 1;
-    RenderTableCol* colGroup = table()->colElement(rightmostColumn);
-    if (colGroup) {
-        const BorderValue& gb = colGroup->style()->borderRight();
+    if (RenderTableCol* colGroup = table()->colElement(totalCols - 1)) {
+        const BorderValue& gb = colGroup->style()->borderEnd();
         if (gb.style() == BHIDDEN)
             return -1;
         if (gb.style() > BHIDDEN && gb.width() > borderWidth)
@@ -907,12 +903,12 @@ int RenderTableSection::calcOuterBorderRight(bool rtl) const
 
     bool allHidden = true;
     for (int r = 0; r < m_gridRows; r++) {
-        const CellStruct& current = cellAt(r, rightmostColumn);
+        const CellStruct& current = cellAt(r, totalCols - 1);
         if (!current.hasCells())
             continue;
         // FIXME: Don't repeat for the same cell
-        const BorderValue& cb = current.primaryCell()->style()->borderRight();
-        const BorderValue& rb = current.primaryCell()->parent()->style()->borderRight();
+        const BorderValue& cb = current.primaryCell()->style()->borderEnd(); // FIXME: Make this work with perpendicular and flipped cells.
+        const BorderValue& rb = current.primaryCell()->parent()->style()->borderEnd();
         if (cb.style() == BHIDDEN || rb.style() == BHIDDEN)
             continue;
         allHidden = false;
@@ -924,16 +920,15 @@ int RenderTableSection::calcOuterBorderRight(bool rtl) const
     if (allHidden)
         return -1;
 
-    return (borderWidth + 1) / 2;
+    return (borderWidth + (table()->style()->isLeftToRightDirection() ? 1 : 0)) / 2;
 }
 
 void RenderTableSection::recalcOuterBorder()
 {
-    bool rtl = !table()->style()->isLeftToRightDirection();
-    m_outerBorderTop = calcOuterBorderTop();
-    m_outerBorderBottom = calcOuterBorderBottom();
-    m_outerBorderLeft = calcOuterBorderLeft(rtl);
-    m_outerBorderRight = calcOuterBorderRight(rtl);
+    m_outerBorderBefore = calcOuterBorderBefore();
+    m_outerBorderAfter = calcOuterBorderAfter();
+    m_outerBorderStart = calcOuterBorderStart();
+    m_outerBorderEnd = calcOuterBorderEnd();
 }
 
 int RenderTableSection::firstLineBoxBaseline() const
@@ -951,7 +946,7 @@ int RenderTableSection::firstLineBoxBaseline() const
         CellStruct& cs = firstRow->at(i);
         RenderTableCell* cell = cs.primaryCell();
         if (cell)
-            firstLineBaseline = max(firstLineBaseline, cell->y() + cell->paddingTop() + cell->borderTop() + cell->contentHeight());
+            firstLineBaseline = max(firstLineBaseline, cell->logicalTop() + cell->paddingBefore() + cell->borderBefore() + cell->contentLogicalHeight());
     }
 
     return firstLineBaseline;
@@ -988,6 +983,7 @@ static inline bool compareCellPositions(RenderTableCell* elem1, RenderTableCell*
 
 void RenderTableSection::paintCell(RenderTableCell* cell, PaintInfo& paintInfo, int tx, int ty)
 {
+    IntPoint cellPoint = flipForWritingMode(cell, IntPoint(tx, ty), ParentToChildFlippingAdjustment);
     PaintPhase paintPhase = paintInfo.phase;
     RenderTableRow* row = toRenderTableRow(cell->parent());
 
@@ -1004,20 +1000,19 @@ void RenderTableSection::paintCell(RenderTableCell* cell, PaintInfo& paintInfo,
         // the stack, since we have already opened a transparency layer (potentially) for the table row group.
         // Note that we deliberately ignore whether or not the cell has a layer, since these backgrounds paint "behind" the
         // cell.
-        cell->paintBackgroundsBehindCell(paintInfo, tx, ty, colGroup);
-        cell->paintBackgroundsBehindCell(paintInfo, tx, ty, col);
+        cell->paintBackgroundsBehindCell(paintInfo, cellPoint.x(), cellPoint.y(), colGroup);
+        cell->paintBackgroundsBehindCell(paintInfo, cellPoint.x(), cellPoint.y(), col);
 
         // Paint the row group next.
-        cell->paintBackgroundsBehindCell(paintInfo, tx, ty, this);
+        cell->paintBackgroundsBehindCell(paintInfo, cellPoint.x(), cellPoint.y(), this);
 
         // Paint the row next, but only if it doesn't have a layer.  If a row has a layer, it will be responsible for
         // painting the row background for the cell.
         if (!row->hasSelfPaintingLayer())
-            cell->paintBackgroundsBehindCell(paintInfo, tx, ty, row);
+            cell->paintBackgroundsBehindCell(paintInfo, cellPoint.x(), cellPoint.y(), row);
     }
     if ((!cell->hasSelfPaintingLayer() && !row->hasSelfPaintingLayer()) || paintInfo.phase == PaintPhaseCollapsedTableBorders)
-        cell->paint(paintInfo, tx, ty);
-
+        cell->paint(paintInfo, cellPoint.x(), cellPoint.y());
 }
 
 void RenderTableSection::paintObject(PaintInfo& paintInfo, int tx, int ty)
@@ -1140,7 +1135,7 @@ void RenderTableSection::recalcCells()
             
             RenderTableRow* tableRow = toRenderTableRow(row);
             m_grid[m_cRow].rowRenderer = tableRow;
-            setRowHeightToRowStyleHeightIfNotRelative(&m_grid[m_cRow]);
+            setRowLogicalHeightToRowStyleLogicalHeightIfNotRelative(&m_grid[m_cRow]);
 
             for (RenderObject* cell = row->firstChild(); cell; cell = cell->nextSibling()) {
                 if (cell->isTableCell())
diff --git a/WebCore/rendering/RenderTableSection.h b/WebCore/rendering/RenderTableSection.h
index fce1e0f..0327d59 100644
--- a/WebCore/rendering/RenderTableSection.h
+++ b/WebCore/rendering/RenderTableSection.h
@@ -47,9 +47,9 @@ public:
 
     void addCell(RenderTableCell*, RenderTableRow* row);
 
-    void setCellWidths();
-    int calcRowHeight();
-    int layoutRows(int height);
+    void setCellLogicalWidths();
+    int calcRowLogicalHeight();
+    int layoutRows(int logicalHeight);
 
     RenderTable* table() const { return toRenderTable(parent()); }
 
@@ -79,7 +79,7 @@ public:
         Row* row;
         RenderTableRow* rowRenderer;
         int baseline;
-        Length height;
+        Length logicalHeight;
     };
 
     CellStruct& cellAt(int row,  int col) { return (*m_grid[row].row)[col]; }
@@ -93,16 +93,16 @@ public:
     void appendColumn(int pos);
     void splitColumn(int pos, int first);
 
-    int calcOuterBorderTop() const;
-    int calcOuterBorderBottom() const;
-    int calcOuterBorderLeft(bool rtl) const;
-    int calcOuterBorderRight(bool rtl) const;
+    int calcOuterBorderBefore() const;
+    int calcOuterBorderAfter() const;
+    int calcOuterBorderStart() const;
+    int calcOuterBorderEnd() const;
     void recalcOuterBorder();
 
-    int outerBorderTop() const { return m_outerBorderTop; }
-    int outerBorderBottom() const { return m_outerBorderBottom; }
-    int outerBorderLeft() const { return m_outerBorderLeft; }
-    int outerBorderRight() const { return m_outerBorderRight; }
+    int outerBorderBefore() const { return m_outerBorderBefore; }
+    int outerBorderAfter() const { return m_outerBorderAfter; }
+    int outerBorderStart() const { return m_outerBorderStart; }
+    int outerBorderEnd() const { return m_outerBorderEnd; }
 
     int numRows() const { return m_gridRows; }
     int numColumns() const;
@@ -163,10 +163,10 @@ private:
     int m_cCol;
     int m_cRow;
 
-    int m_outerBorderLeft;
-    int m_outerBorderRight;
-    int m_outerBorderTop;
-    int m_outerBorderBottom;
+    int m_outerBorderStart;
+    int m_outerBorderEnd;
+    int m_outerBorderBefore;
+    int m_outerBorderAfter;
 
     bool m_needsCellRecalc;
     bool m_hasOverflowingCell;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list