Changeset 71382 in webkit


Ignore:
Timestamp:
Nov 4, 2010, 7:43:17 PM (15 years ago)
Author:
mitz@apple.com
Message:

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.
Location:
trunk
Files:
60 added
9 edited
20 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r71377 r71382  
     12010-11-04  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        Make tables work with vertical text
     6        https://bugs.webkit.org/show_bug.cgi?id=46417
     7
     8        * fast/table/027-vertical.html: Copied from LayoutTests/fast/table/027.html.
     9        * fast/table/028-vertical.html: Copied from LayoutTests/fast/table/028.html.
     10        * fast/table/035-vertical.html: Copied from LayoutTests/fast/table/035.html.
     11        * fast/table/038-vertical.html: Copied from LayoutTests/fast/table/038.html.
     12        * fast/table/040-vertical.html: Copied from LayoutTests/fast/table/040.html.
     13        * fast/table/auto-with-percent-height-vertical.html: Copied from LayoutTests/fast/table/auto-with-percent-height.html.
     14        * fast/table/border-collapsing/001-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/001.html.
     15        * fast/table/border-collapsing/002-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/002.html.
     16        * fast/table/border-collapsing/003-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/003.html.
     17        * fast/table/border-collapsing/004-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/004.html.
     18        * fast/table/border-collapsing/border-collapsing-head-foot-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/border-collapsing-head-foot.html.
     19        * fast/table/border-collapsing/equal-precedence-resolution-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/equal-precedence-resolution.html.
     20        * fast/table/border-collapsing/rtl-border-collapsing-vertical.html: Copied from LayoutTests/fast/table/border-collapsing/rtl-border-collapsing.html.
     21        * fast/table/colspanMinWidth-vertical.html: Copied from LayoutTests/fast/table/colspanMinWidth.html.
     22        * fast/table/fixed-with-auto-with-colspan-vertical.html: Copied from LayoutTests/fast/table/fixed-with-auto-with-colspan.html.
     23        * fast/table/growCellForImageQuirk-vertical.html: Copied from LayoutTests/fast/table/growCellForImageQuirk.html.
     24        * fast/table/height-percent-test-vertical.html: Copied from LayoutTests/fast/table/height-percent-test.html.
     25        * fast/table/percent-widths-stretch-vertical.html: Copied from LayoutTests/fast/table/percent-widths-stretch.html.
     26        * fast/table/rowspan-paint-order-vertical.html: Copied from LayoutTests/fast/table/rowspan-paint-order.html.
     27        * fast/table/table-display-types-vertical.html: Copied from LayoutTests/fast/table/table-display-types.html.
     28        * platform/mac/fast/table/027-vertical-expected.checksum: Added.
     29        * platform/mac/fast/table/027-vertical-expected.png: Added.
     30        * platform/mac/fast/table/027-vertical-expected.txt: Added.
     31        * platform/mac/fast/table/028-vertical-expected.checksum: Added.
     32        * platform/mac/fast/table/028-vertical-expected.png: Added.
     33        * platform/mac/fast/table/028-vertical-expected.txt: Added.
     34        * platform/mac/fast/table/035-vertical-expected.checksum: Added.
     35        * platform/mac/fast/table/035-vertical-expected.png: Added.
     36        * platform/mac/fast/table/035-vertical-expected.txt: Added.
     37        * platform/mac/fast/table/038-vertical-expected.checksum: Added.
     38        * platform/mac/fast/table/038-vertical-expected.png: Added.
     39        * platform/mac/fast/table/038-vertical-expected.txt: Added.
     40        * platform/mac/fast/table/040-vertical-expected.checksum: Added.
     41        * platform/mac/fast/table/040-vertical-expected.png: Added.
     42        * platform/mac/fast/table/040-vertical-expected.txt: Added.
     43        * platform/mac/fast/table/auto-with-percent-height-vertical-expected.checksum: Added.
     44        * platform/mac/fast/table/auto-with-percent-height-vertical-expected.png: Added.
     45        * platform/mac/fast/table/auto-with-percent-height-vertical-expected.txt: Added.
     46        * platform/mac/fast/table/border-collapsing/001-vertical-expected.checksum: Added.
     47        * platform/mac/fast/table/border-collapsing/001-vertical-expected.png: Added.
     48        * platform/mac/fast/table/border-collapsing/001-vertical-expected.txt: Added.
     49        * platform/mac/fast/table/border-collapsing/002-vertical-expected.checksum: Added.
     50        * platform/mac/fast/table/border-collapsing/002-vertical-expected.png: Added.
     51        * platform/mac/fast/table/border-collapsing/002-vertical-expected.txt: Added.
     52        * platform/mac/fast/table/border-collapsing/003-vertical-expected.checksum: Added.
     53        * platform/mac/fast/table/border-collapsing/003-vertical-expected.png: Added.
     54        * platform/mac/fast/table/border-collapsing/003-vertical-expected.txt: Added.
     55        * platform/mac/fast/table/border-collapsing/004-vertical-expected.checksum: Added.
     56        * platform/mac/fast/table/border-collapsing/004-vertical-expected.png: Added.
     57        * platform/mac/fast/table/border-collapsing/004-vertical-expected.txt: Added.
     58        * platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.checksum: Added.
     59        * platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.png: Added.
     60        * platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.txt: Added.
     61        * platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.checksum: Added.
     62        * platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.png: Added.
     63        * platform/mac/fast/table/border-collapsing/equal-precedence-resolution-vertical-expected.txt: Added.
     64        * platform/mac/fast/table/border-collapsing/rtl-border-collapsing-vertical-expected.checksum: Added.
     65        * platform/mac/fast/table/border-collapsing/rtl-border-collapsing-vertical-expected.png: Added.
     66        * platform/mac/fast/table/border-collapsing/rtl-border-collapsing-vertical-expected.txt: Added.
     67        * platform/mac/fast/table/colspanMinWidth-vertical-expected.checksum: Added.
     68        * platform/mac/fast/table/colspanMinWidth-vertical-expected.png: Added.
     69        * platform/mac/fast/table/colspanMinWidth-vertical-expected.txt: Added.
     70        * platform/mac/fast/table/fixed-with-auto-with-colspan-vertical-expected.checksum: Added.
     71        * platform/mac/fast/table/fixed-with-auto-with-colspan-vertical-expected.png: Added.
     72        * platform/mac/fast/table/fixed-with-auto-with-colspan-vertical-expected.txt: Added.
     73        * platform/mac/fast/table/growCellForImageQuirk-vertical-expected.checksum: Added.
     74        * platform/mac/fast/table/growCellForImageQuirk-vertical-expected.png: Added.
     75        * platform/mac/fast/table/growCellForImageQuirk-vertical-expected.txt: Added.
     76        * platform/mac/fast/table/height-percent-test-vertical-expected.checksum: Added.
     77        * platform/mac/fast/table/height-percent-test-vertical-expected.png: Added.
     78        * platform/mac/fast/table/height-percent-test-vertical-expected.txt: Added.
     79        * platform/mac/fast/table/percent-widths-stretch-vertical-expected.checksum: Added.
     80        * platform/mac/fast/table/percent-widths-stretch-vertical-expected.png: Added.
     81        * platform/mac/fast/table/percent-widths-stretch-vertical-expected.txt: Added.
     82        * platform/mac/fast/table/rowspan-paint-order-vertical-expected.checksum: Added.
     83        * platform/mac/fast/table/rowspan-paint-order-vertical-expected.png: Added.
     84        * platform/mac/fast/table/rowspan-paint-order-vertical-expected.txt: Added.
     85        * platform/mac/fast/table/table-display-types-vertical-expected.checksum: Added.
     86        * platform/mac/fast/table/table-display-types-vertical-expected.png: Added.
     87        * platform/mac/fast/table/table-display-types-vertical-expected.txt: Added.
     88
    1892010-11-04  MORITA Hajime  <morrita@google.com>
    290
  • trunk/LayoutTests/fast/table/027-vertical.html

    r71380 r71382  
    66</head>
    77<body>
    8 <table width=100% cellspacing=0 cellpadding=3 border=0>
     8<table height=100% cellspacing=0 cellpadding=3 border=0 style="-webkit-writing-mode: vertical-rl;">
    99<tr>
    10         <td colspan=3 nowrap>
    11                                                                                 &nbsp;&nbsp;&nbsp;Join Now&nbsp;&nbsp;&nbsp;Sign In&nbsp;&nbsp;
    12                                                        
    13                                                                 &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;
    14                                                        
    15                                                                 &nbsp;&nbsp; My Links:&nbsp;&nbsp;
    16                                                         &nbsp;&nbsp;Lite&nbsp;&#149;&nbsp;Email
    17                                                 </td>
     10    <td colspan=3 nowrap>
     11                                        &nbsp;&nbsp;&nbsp;Join Now&nbsp;&nbsp;&nbsp;Sign In&nbsp;&nbsp;
     12                           
     13                                &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;
     14                           
     15                                &nbsp;&nbsp; My Links:&nbsp;&nbsp;
     16                            &nbsp;&nbsp;Lite&nbsp;&#149;&nbsp;Email
     17                        </td>
    1818</tr>
    1919<tr>
    20         <td width=28%></td>
    21         <td width=44%>
    22                 <table width=100%>
    23                         <tr>
    24                                 <td>
    25                                         <table>
    26                                                 <tr>
    27                                                         <td width=50%>
    28                                                         </td>
    29                                                         <td>
     20    <td height=28%></td>
     21    <td height=44%>
     22        <table height=100%>
     23            <tr>
     24                <td>
     25                    <table>
     26                        <tr>
     27                            <td height=50%>
     28                            </td>
     29                            <td>
    3030                                                            This guy should have the really big maxwidth.  It
    3131                                                            should be big enough to really really screw things up.
    3232                                                            That is what I think will work.
    33                                                         </td>
    34                                                         <td width=50%>
    35                                                         </td>
    36                                                 </tr>
    37                                         </table>
    38                                 </td>
    39                         </tr>
    40                 </table>
    41        
    42         </td>
    43         <td width=28%>
    44                 <img width=212 height=18>
    45                
    46         </td>
     33                            </td>
     34                            <td height=50%>
     35                            </td>
     36                        </tr>
     37                    </table>
     38                </td>
     39            </tr>
     40        </table>
     41   
     42    </td>
     43    <td height=28%>
     44        <img height=212 width=18>
     45       
     46    </td>
    4747</tr>
    4848</table>
  • trunk/LayoutTests/fast/table/028-vertical.html

    r71380 r71382  
    77</head>
    88<body>
    9 These two tables should be the same width.
    10 
    11                         <table border=0 cellspacing=0 cellpadding=0 width=320>
    12                                 <tr>
    13                                         <td width=70 valign=top >
    14                                                 1
    15                                         </td>
    16                                         <td width=246 valign=top >
     9These two tables should be the same height.
     10<div style="-webkit-writing-mode: vertical-rl;">
     11            <table border=0 cellspacing=0 cellpadding=0 height=320>
     12                <tr>
     13                    <td height=70 valign=top >
     14                        1
     15                    </td>
     16                    <td height=246 valign=top >
    1717                                        2
    18                                        
     18                   
    1919                                   
    20                                         </td>
    21                                         <td width=4><img width=4 height=20></td>
    22                                 </tr>
    23                         </table>
    24                         <p></p>
    25                
    26                         <table border=0 cellspacing=0 cellpadding=0 width=320 height=10>
    27                                 <tr>
    28                                         <td width=66 height=10>1</td>
    29                                         <td width=254 height=10><img  width=254 height=10 ></td>
    30                                 </tr>
    31                                 <tr>
    32                                         <td colspan=3>1</td>
    33                                 </tr>
    34                         </table>
    35                        
     20                    </td>
     21                    <td height=4><img height=4 width=20></td>
     22                </tr>
     23            </table>
     24            <p></p>
     25       
     26            <table border=0 cellspacing=0 cellpadding=0 height=320 width=10>
     27                <tr>
     28                    <td height=66 width=10>1</td>
     29                    <td height=254 width=10><img  height=254 width=10 ></td>
     30                </tr>
     31                <tr>
     32                    <td colspan=3>1</td>
     33                </tr>
     34            </table>
     35           
    3636
    3737
     
    4040
    4141
    42 
     42</div>
  • trunk/LayoutTests/fast/table/035-vertical.html

    r71380 r71382  
    11<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
    22        "http://www.w3.org/TR/html4/loose.dtd">
    3 <html><body>
     3<html><body style="-webkit-writing-mode: vertical-rl;">
    44
    55This test should have two centered tables and two centered divs.
  • trunk/LayoutTests/fast/table/038-vertical.html

    r71380 r71382  
    22much width as possible, while column 1 should be tiny.
    33
    4 <table border=2 width=100%>
     4<table border=2 height=100% style="-webkit-writing-mode: vertical-rl;">
    55        <tr>
    66            <td>1<td colspan=2>2-3
     
    88        <tr>
    99            <td>1</td>
    10             <td colspan=2 width=100%>2-3</td>
     10            <td colspan=2 height=100%>2-3</td>
    1111        </tr>
    1212    </table>
  • trunk/LayoutTests/fast/table/040-vertical.html

    r71380 r71382  
    1919
    2020td {
    21   height: 20px;
     21  width: 20px;
    2222}
    2323
     24table {
     25  -webkit-writing-mode: vertical-rl;
     26}
    2427</style>
    2528
    2629<script>
    27 function dumpWidths(table)
     30function dumpHeights(table)
    2831{
    2932  var cell1 = document.getElementById(table + "-one");
    3033  var cell2 = document.getElementById(table + "-two");
    3134  document.write("<p>");
    32   document.write("The table width is: " + document.getElementById(table).offsetWidth + "<br>");
    33   document.write("Column One is: " + Math.round(100*cell1.offsetWidth/(cell1.offsetWidth+cell2.offsetWidth)) + "%");
     35  document.write("The table height is: " + document.getElementById(table).offsetHeight + "<br>");
     36  document.write("Column One is: " + Math.round(100*cell1.offsetHeight/(cell1.offsetHeight+cell2.offsetHeight)) + "%");
    3437  document.write("<br>");
    35   document.write("Column Two is: " + Math.round(100*cell2.offsetWidth/(cell1.offsetWidth+cell2.offsetWidth)) + "%");
     38  document.write("Column Two is: " + Math.round(100*cell2.offsetHeight/(cell1.offsetHeight+cell2.offsetHeight)) + "%");
    3639  document.write("</p><hr>");
    3740}
     
    3942</head>
    4043
    41 <h1>Fixed Columns, Auto Span, Minwidth Table</h1>
     44<h1>Fixed Columns, Auto Span, Minheight Table</h1>
    4245
    43 <table width="1" id="one" cellpadding=0 cellspacing=0>
     46<table height="1" id="one" cellpadding=0 cellspacing=0>
    4447<tr>
    45 <td width=100 id="one-one" class="one">
    46 <td width=200 id="one-two" class="two">
     48<td height=100 id="one-one" class="one">
     49<td height=200 id="one-two" class="two">
    4750</tr>
    4851<tr>
    4952<td colspan=2 class="span">
    50 <div style="width:100px"></div>
     53<div style="height:100px"></div>
    5154</td>
    5255</tr>
     
    5457
    5558<script>
    56 dumpWidths("one");
     59dumpHeights("one");
    5760</script>
    5861
    59 <table width="1" id="two" cellpadding=0 cellspacing=0>
     62<table height="1" id="two" cellpadding=0 cellspacing=0>
    6063<tr>
    61 <td width=100 id="two-one" class="one">
    62 <td width=200 id="two-two" class="two">
     64<td height=100 id="two-one" class="one">
     65<td height=200 id="two-two" class="two">
    6366</tr>
    6467<tr>
    6568<td colspan=2 class="span">
    66 <div style="width:600px"></div>
     69<div style="height:600px"></div>
    6770</td>
    6871</tr>
     
    7073
    7174<script>
    72 dumpWidths("two");
     75dumpHeights("two");
    7376</script>
    7477
    75 <table width="1" id="three" cellpadding=0 cellspacing=0>
     78<table height="1" id="three" cellpadding=0 cellspacing=0>
    7679<tr>
    77 <td width=100 id="three-one" class="one">Fixed cell in column one with some text.
    78 <td width=200 id="three-two" class="two">Fixed cell in column two with a lot more text. Will the ratios be preserved?
     80<td height=100 id="three-one" class="one">Fixed cell in column one with some text.
     81<td height=200 id="three-two" class="two">Fixed cell in column two with a lot more text. Will the ratios be preserved?
    7982</tr>
    8083<tr>
    8184<td colspan=2 class="span">
    82 <div style="width:600px"></div>
     85<div style="height:600px"></div>
    8386</td>
    8487</tr>
     
    8689
    8790<script>
    88 dumpWidths("three");
     91dumpHeights("three");
    8992</script>
    9093
    91 <table width="1" id="four" cellpadding=0 cellspacing=0>
     94<table height="1" id="four" cellpadding=0 cellspacing=0>
    9295<tr>
    93 <td width=50 id="four-one" class="one"><div style="width:100px"></div>
    94 <td width=100 id="four-two" class="two"><div style="width:250px"></div>
     96<td height=50 id="four-one" class="one"><div style="height:100px"></div>
     97<td height=100 id="four-two" class="two"><div style="height:250px"></div>
    9598</tr>
    9699<tr>
    97100<td colspan=2 class="span">
    98 <div style="width:600px"></div>
     101<div style="height:600px"></div>
    99102</td>
    100103</tr>
     
    102105
    103106<script>
    104 dumpWidths("four");
     107dumpHeights("four");
    105108</script>
  • trunk/LayoutTests/fast/table/auto-with-percent-height-vertical.html

    r71380 r71382  
    66  background-color: purple;
    77  color: white;
    8   height: 100%;
     8  width: 100%;
    99}
    1010
     
    1212  border: 3px solid red;
    1313  margin: 1em;
     14  -webkit-writing-mode: vertical-rl;
    1415}
    1516</style>
  • trunk/LayoutTests/fast/table/border-collapsing/001-vertical.html

    r71380 r71382  
    11<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
    22
    3 <html>
    4 <div style="border:10px dotted blue">
     3<html style="-webkit-writing-mode: vertical-rl;">
     4<div style="border:10px dotted blue;">
    55<table style="border-collapse:collapse; border:2px solid red">
    6 <tr><td width=300 style="border:10px solid green">Hello
     6<tr><td height=300 style="border:10px solid green">Hello
    77<tr><td style="border:30px solid blue">Goodbye
    88<tr><td style="border:50px solid red">Goodbye
     
    1111
    1212
    13 <div style="border:1px solid green; margin-top:10em">
     13<div style="border:1px solid green; -webkit-margin-before:10em;">
    1414<table style="border-collapse:collapse;"><tr><td style="border:2px solid black">Test</td></tr></table>
    1515</div>
  • trunk/LayoutTests/fast/table/border-collapsing/002-vertical.html

    r71380 r71382  
    44table          { border-collapse: collapse;
    55                 border: 5px solid yellow; }
    6 *#col1         { border: 3px solid black; }
     6.col1         { border: 3px solid black; }
    77td             { border: 1px solid red; padding: 1em; }
    88td.solid-blue  { border: 5px dashed blue; }
     
    1212<body>
    1313<P>
    14 <TABLE>
    15 <COL id="col1"><COL id="col2"><COL id="col3">
    16 <TR id="row1">
     14<TABLE style="-webkit-writing-mode: vertical-rl;">
     15<COL class="col1"><COL><COL>
     16<TR>
    1717    <TD> 1
    1818    <TD> 2
    1919    <TD> 3
    2020</TR>
    21 <TR id="row2">
     21<TR>
    2222    <TD> 4
    2323    <TD class="solid-blue"> 5
    2424    <TD class="solid-green"> 6
    2525</TR>
    26 <TR id="row3">
     26<TR>
    2727    <TD> 7
    2828    <TD> 8
    2929    <TD> 9
    3030</TR>
    31 <TR id="row4">
     31<TR>
    3232    <TD> 10
    3333    <TD> 11
    3434    <TD> 12
    3535</TR>
    36 <TR id="row5">
     36<TR>
     37    <TD> 13
     38    <TD> 14
     39    <TD> 15
     40</TR>
     41</table>
     42<TABLE style="-webkit-writing-mode: vertical-lr;">
     43<COL class="col1"><COL><COL>
     44<TR>
     45    <TD> 1
     46    <TD> 2
     47    <TD> 3
     48</TR>
     49<TR>
     50    <TD> 4
     51    <TD class="solid-blue"> 5
     52    <TD class="solid-green"> 6
     53</TR>
     54<TR>
     55    <TD> 7
     56    <TD> 8
     57    <TD> 9
     58</TR>
     59<TR>
     60    <TD> 10
     61    <TD> 11
     62    <TD> 12
     63</TR>
     64<TR>
     65    <TD> 13
     66    <TD> 14
     67    <TD> 15
     68</TR>
     69</table>
     70<TABLE style="-webkit-writing-mode: horizontal-bt;">
     71<COL class="col1"><COL><COL>
     72<TR>
     73    <TD> 1
     74    <TD> 2
     75    <TD> 3
     76</TR>
     77<TR>
     78    <TD> 4
     79    <TD class="solid-blue"> 5
     80    <TD class="solid-green"> 6
     81</TR>
     82<TR>
     83    <TD> 7
     84    <TD> 8
     85    <TD> 9
     86</TR>
     87<TR>
     88    <TD> 10
     89    <TD> 11
     90    <TD> 12
     91</TR>
     92<TR>
    3793    <TD> 13
    3894    <TD> 14
  • trunk/LayoutTests/fast/table/border-collapsing/003-vertical.html

    r71380 r71382  
    44  <title>Border Collapsing Test</title>
    55  <style type="text/css">
    6    .b { border: solid thin blue; padding: 0 0 3em 0; margin: 2em; }
     6   .b { border: solid thin blue; padding-left: 3em; margin: 2em; }
    77   .t { display: table; border-collapse: collapse; }
    88   .r { display: table-row; }
     
    1111  </style>
    1212 </head>
    13  <body>
     13 <body style="-webkit-writing-mode: vertical-rl;">
    1414  <p>The black border below should <i>not</i> cut through the top left corner of
    1515  the blue border. It would cut through with our old behavior, but
  • trunk/LayoutTests/fast/table/border-collapsing/004-vertical.html

    r71380 r71382  
    33<title>Table Border Models</title>
    44<style type="text/css">
    5 TABLE   { margin: 1em; width: auto; border: medium solid blue; }
    6 TD      { border: thin solid green; padding: 5px; }
     5TABLE   { margin: 1em; width: auto; border: medium solid blue; }
     6TD  { border: thin solid green; padding: 5px; }
    77TH { border: medium solid purple; padding: 5px; }
    88TABLE.one, TABLE.two { border-spacing: 1em; }
     
    1414TABLE.five, TABLE.five TD, TABLE.five TH, TABLE.five CAPTION { border: none; }
    1515TABLE.five TR, TABLE.five COL, TABLE.five COLGROUP, TABLE.five TBODY, TABLE.five THEAD
    16         { border: medium solid red; }
     16    { border: medium solid red; }
    1717</style>
    1818</head>
     
    2525
    2626<pre>
    27 TABLE   { margin: 1em; border: medium solid blue; }
    28 TD      { border: thin solid green; padding: 5px; }
     27TABLE   { margin: 1em; border: medium solid blue; }
     28TD  { border: thin solid green; padding: 5px; }
    2929TH { border: medium solid purple; padding: 5px; }
    3030TABLE.one, TABLE.two { border-spacing: 1em; }
     
    3636TABLE.five, TABLE.five TD, TABLE.five TH { border: none; }
    3737TABLE.five TR, TABLE.five COL, TABLE.five COLGROUP, TABLE.five TBODY, TABLE.five THEAD
    38         { border: medium solid red; }
     38    { border: medium solid red; }
    3939</pre>
    40 
     40<div style="-webkit-writing-mode: vertical-rl;">
    4141<table class="one">
    4242 <tr>
     
    229229</tbody>
    230230</table>
    231 
     231</div>
    232232</body></html>
  • trunk/LayoutTests/fast/table/border-collapsing/border-collapsing-head-foot-vertical.html

    r71380 r71382  
    44    <style type="text/css">
    55   
     6        .test { width: 100px; }
    67        .test table { border-collapse: collapse; margin: 10px; }
    78        .test td, th { border: 1px lightgray solid; }
    89       
    9         .example1 tfoot { border-top: 2px solid blue;
    10             border-bottom: 2px solid green;
     10        .example1 tfoot { -webkit-border-before: 2px solid blue;
     11            -webkit-border-after: 2px solid green;
    1112        }
    1213
    13         .example2 thead { border-top: 2px solid blue;
    14             border-bottom: 2px solid green;
     14        .example2 thead { -webkit-border-before: 2px solid blue;
     15            -webkit-border-after: 2px solid green;
    1516        }
     17
     18        table table { -webkit-writing-mode: vertical-rl; }
    1619    </style>
    1720</head>
  • trunk/LayoutTests/fast/table/border-collapsing/equal-precedence-resolution-vertical.html

    r71380 r71382  
    33    td { width: 25px; height: 25px; }
    44</style>
     5<div style="-webkit-writing-mode: vertical-rl; height: 200px; border: solid;">
    56<table>
    6     <colgroup span="2"><colgroup span="1" style="border-right: 5px solid rgba(0, 127, 0, 0.5);"><colgroup span="1" style="border-left: 5px solid red">
     7    <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">
    78    <tr>
    8         <td style="border-right: 5px solid rgba(0, 127, 0, 0.5); border-bottom: 5px solid rgba(0, 127, 0, 0.5);"></td>
    9         <td style="border-left: 5px solid red;"></td>
     9        <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>
     10        <td style="-webkit-border-start: 5px solid red;"></td>
    1011        <td></td>
    1112        <td></td>
    1213    </tr>
    1314    <tr>
    14         <td style="border-top: 5px solid red;"></td>
     15        <td style="-webkit-border-before: 5px solid red;"></td>
    1516        <td></td>
    1617        <td></td>
     
    1920</table>
    2021<table style="direction: rtl;">
    21     <colgroup span="2"><colgroup span="1" style="border-left: 5px solid rgba(0, 127, 0, 0.5);"><colgroup span="1" style="border-right: 5px solid red">
     22    <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">
    2223    <tr>
    23         <td style="border-left: 5px solid rgba(0, 127, 0, 0.5); border-bottom: 5px solid rgba(0, 127, 0, 0.5);"></td>
    24         <td style="border-right: 5px solid red;"></td>
     24        <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>
     25        <td style="-webkit-border-start: 5px solid red;"></td>
    2526        <td></td>
    2627        <td></td>
    2728    </tr>
    2829    <tr>
    29         <td style="border-top: 5px solid red;"></td>
     30        <td style="-webkit-border-before: 5px solid red;"></td>
    3031        <td></td>
    3132        <td></td>
     
    3435</table>
    3536<table>
    36     <tr style="border-bottom: 5px solid rgba(0, 127, 0, 0.5);">
     37    <tr style="-webkit-border-after: 5px solid rgba(0, 127, 0, 0.5);">
    3738        <td></td>
    3839    </tr>
    39     <tr style="border-top: 5px solid red;">
     40    <tr style="-webkit-border-before: 5px solid red;">
    4041        <td></td>
    4142    </tr>
    4243</table>
    4344<table>
    44     <tbody style="border-bottom: 5px solid rgba(0, 127, 0, 0.5);">
     45    <tbody style="-webkit-border-after: 5px solid rgba(0, 127, 0, 0.5);">
    4546        <tr>
    4647            <td></td>
    4748        </tr>
    4849    </tbody>
    49     <tbody style="border-top: 5px solid red;">
     50    <tbody style="-webkit-border-before: 5px solid red;">
    5051        <tr>
    5152            <td></td>
     
    5354    </tbody>
    5455</table>
     56</div>
     57<div style="-webkit-writing-mode: horizontal-bt; width: 200px; border: solid;">
     58<table>
     59    <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">
     60    <tr>
     61        <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>
     62        <td style="-webkit-border-start: 5px solid red;"></td>
     63        <td></td>
     64        <td></td>
     65    </tr>
     66    <tr>
     67        <td style="-webkit-border-before: 5px solid red;"></td>
     68        <td></td>
     69        <td></td>
     70        <td></td>
     71    </tr>
     72</table>
     73<table style="direction: rtl;">
     74    <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">
     75    <tr>
     76        <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>
     77        <td style="-webkit-border-start: 5px solid red;"></td>
     78        <td></td>
     79        <td></td>
     80    </tr>
     81    <tr>
     82        <td style="-webkit-border-before: 5px solid red;"></td>
     83        <td></td>
     84        <td></td>
     85        <td></td>
     86    </tr>
     87</table>
     88<table>
     89    <tr style="-webkit-border-after: 5px solid rgba(0, 127, 0, 0.5);">
     90        <td></td>
     91    </tr>
     92    <tr style="-webkit-border-before: 5px solid red;">
     93        <td></td>
     94    </tr>
     95</table>
     96<table>
     97    <tbody style="-webkit-border-after: 5px solid rgba(0, 127, 0, 0.5);">
     98        <tr>
     99            <td></td>
     100        </tr>
     101    </tbody>
     102    <tbody style="-webkit-border-before: 5px solid red;">
     103        <tr>
     104            <td></td>
     105        </tr>
     106    </tbody>
     107</table>
     108</div>
     109<div style="-webkit-writing-mode: vertical-lr; height: 200px; border: solid;">
     110<table>
     111    <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">
     112    <tr>
     113        <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>
     114        <td style="-webkit-border-start: 5px solid red;"></td>
     115        <td></td>
     116        <td></td>
     117    </tr>
     118    <tr>
     119        <td style="-webkit-border-before: 5px solid red;"></td>
     120        <td></td>
     121        <td></td>
     122        <td></td>
     123    </tr>
     124</table>
     125<table style="direction: rtl;">
     126    <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">
     127    <tr>
     128        <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>
     129        <td style="-webkit-border-start: 5px solid red;"></td>
     130        <td></td>
     131        <td></td>
     132    </tr>
     133    <tr>
     134        <td style="-webkit-border-before: 5px solid red;"></td>
     135        <td></td>
     136        <td></td>
     137        <td></td>
     138    </tr>
     139</table>
     140<table>
     141    <tr style="-webkit-border-after: 5px solid rgba(0, 127, 0, 0.5);">
     142        <td></td>
     143    </tr>
     144    <tr style="-webkit-border-before: 5px solid red;">
     145        <td></td>
     146    </tr>
     147</table>
     148<table>
     149    <tbody style="-webkit-border-after: 5px solid rgba(0, 127, 0, 0.5);">
     150        <tr>
     151            <td></td>
     152        </tr>
     153    </tbody>
     154    <tbody style="-webkit-border-before: 5px solid red;">
     155        <tr>
     156            <td></td>
     157        </tr>
     158    </tbody>
     159</table>
     160</div>
  • trunk/LayoutTests/fast/table/border-collapsing/rtl-border-collapsing-vertical.html

    r71380 r71382  
    88</p>
    99<hr>
    10 <table cellpadding="4" cellspacing="0" style="text-align: center;">
     10<table cellpadding="4" cellspacing="0" style="text-align: center; -webkit-writing-mode: vertical-rl;">
    1111<tr>
    12 <td style="border-right: 1px solid black;">RTL</td>
     12<td style="-webkit-border-end: 1px solid black;">RTL</td>
    1313<td>LTR</td>
    1414</tr>
    1515<tr>
    16 <td style="border-right: 1px solid black;">
    17     <table style="direction:rtl; border-collapse: collapse; border-left: 2px solid red; border-right: 2px solid blue;">
     16<td style="-webkit-border-end: 1px solid black;">
     17    <table style="direction:rtl; border-collapse: collapse; -webkit-border-start: 2px solid red; -webkit-border-end: 2px solid blue;">
    1818        <col>
    1919        <col>
    20         <col style="background: yellow; border-right: 2px green dotted; border-left: solid 1px;">
     20        <col style="background: yellow; -webkit-border-end: 2px green dotted; -webkit-border-start: solid 1px;">
    2121        <col style="background: silver;">
    2222        <tr>
     
    2727        </tr>
    2828        <tr>
    29             <td style="border-right: 4px solid maroon;">&nbsp;&nbsp;</td>
     29            <td style="-webkit-border-end: 4px solid maroon;">&nbsp;&nbsp;</td>
    3030            <td>&nbsp;&nbsp;</td>
    3131            <td>&nbsp;&nbsp;</td>
     
    3636</td>
    3737<td>   
    38     <table style="direction:ltr; border-collapse: collapse; border-right: 2px solid red; border-left: 2px solid blue;">
     38    <table style="direction:ltr; border-collapse: collapse; -webkit-border-start: 2px solid red; -webkit-border-end: 2px solid blue;">
    3939        <col>
    4040        <col>
    41         <col style="background: yellow; border-left: 2px green dotted; border-right: solid 1px;">
     41        <col style="background: yellow; -webkit-border-end: 2px green dotted; -webkit-border-start: solid 1px;">
    4242        <col style="background: silver;">
    4343        <tr>
     
    4848        </tr>
    4949        <tr>
    50             <td style="border-left: 4px solid maroon;">&nbsp;&nbsp;</td>
     50            <td style="-webkit-border-end: 4px solid maroon;">&nbsp;&nbsp;</td>
    5151            <td>&nbsp;&nbsp;</td>
    5252            <td>&nbsp;&nbsp;</td>
  • trunk/LayoutTests/fast/table/colspanMinWidth-vertical.html

    r71380 r71382  
    11<html>
    2         <body>
    3                 <table>
    4                         <tr>
    5                                 <td id="A" width='1' style="background:blue"></td>
    6                         </tr>
    7                         <tr>
    8                                 <td id="B" colspan='2' rowspan='2' style="background:green"></td>
    9                         </tr>
    10                         <tr>
    11                                 <td id="C" rowspan='2' style="background:red"></td>
    12                         </tr>
    13                         <tr>
    14                                 <td id="D" colspan='2' style="background:cyan">
    15                                         <table>
    16                                                 <tr>
    17                                                         <td id="E" style="background:magenta"></td>
    18                                                         <td id="F" style="background:yellow">
    19                                                                 <input type='text' />
    20                                                         </td>
    21                                                 </tr>
    22                                         </table>
    23                                 </td>
    24                         </tr>
    25                 </table>
    26         </body>
     2<body>
     3<table style="-webkit-writing-mode: vertical-rl;">
     4<tr>
     5<td id="A" height='1' style="background:blue"></td>
     6</tr>
     7<tr>
     8<td id="B" colspan='2' rowspan='2' style="background:green"></td>
     9</tr>
     10<tr>
     11<td id="C" rowspan='2' style="background:red"></td>
     12</tr>
     13<tr>
     14<td id="D" colspan='2' style="background:cyan">
     15<table>
     16<tr>
     17<td id="E" style="background:magenta"></td>
     18<td id="F" style="background:yellow">
     19<input type='text' />
     20</td>
     21</tr>
     22</table>
     23</td>
     24</tr>
     25</table>
     26</body>
    2727</html>
  • trunk/LayoutTests/fast/table/fixed-with-auto-with-colspan-vertical.html

    r71380 r71382  
    11<style>
    2     table { border-spacing: 5px 0; table-layout: fixed; width: 445px; margin-top: 5px; }
    3     td { height: 50px; }
     2    table { border-spacing: 5px 0; table-layout: fixed; height: 445px; -webkit-margin-before: 5px; }
     3    td { width: 50px; }
    44    #ref td { background-color: red; }
    55    #test td { background-color: green; }
    66</style>
    7 <div id="ref" style="position: absolute; top: 0; left: 0;">
     7<div id="ref" style="position: absolute; top: 0; left: 0; -webkit-writing-mode: vertical-rl;">
    88    <table><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
    99    <table><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
     
    1414    <table><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
    1515</div>
    16 <div id="test" style="position: absolute; top: 0; left: 0;">
     16<div id="test" style="position: absolute; top: 0; left: 0; -webkit-writing-mode: vertical-rl;">
    1717    <table>
    1818        <tr>
  • trunk/LayoutTests/fast/table/growCellForImageQuirk-vertical.html

    r71380 r71382  
    11<style>
    2     img { background-color: lightblue; width: 75px; height: 50px; }
     2    img { background-color: lightblue; height: 75px; width: 50px; }
    33</style>
    4 <TABLE style="width: 155px; background: silver;">
     4<TABLE style="height: 155px; background: silver; -webkit-writing-mode: vertical-rl;">
    55    <TR>
    66        <TD>
  • trunk/LayoutTests/fast/table/height-percent-test-vertical.html

    r71380 r71382  
    1 <div style="margin: 1em; height: 24px; border: 1px solid black"><div style="float:left">
    2 <div style="width: 100px; background-color:green; height:100%"></div>
     1<div style="-webkit-writing-mode: vertical-rl;">
     2<div style="margin: 1em; width: 24px; border: 1px solid black;"><div style="float:left">
     3<div style="height: 100px; background-color:green; width:100%"></div>
    34
    45</div></div>
    56
    6 <div style="margin: 1em; height: 24px; border: 1px solid black"><div style="float:left">
    7 <table bgcolor=red height=100% cellpadding=0 cellspacing=0><tr><td><img border=0 height=22 width=96 style="background-color:green"></td></tr></table>
     7<div style="margin: 1em; width: 24px; border: 1px solid black;"><div style="float:left">
     8<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>
    89</div></div>
    910
    10 <div style="margin: 1em; border: 1px solid black"><div>
    11 <div style="width: 100px; background-color:green; height:100%"></div>
     11<div style="margin: 1em; border: 1px solid black;"><div>
     12<div style="height: 100px; background-color:green; width:100%"></div>
    1213</div></div>
    1314
    14 <div style="margin: 1em; border: 1px solid black"><div>
    15 <table bgcolor=red height=100% cellpadding=0 cellspacing=0><tr><td><img border=0 height=22 width=96 style="background-color:green"></td></tr></table>
     15<div style="margin: 1em; border: 1px solid black;"><div>
     16<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>
    1617</div></div>
     18</div>
  • trunk/LayoutTests/fast/table/percent-widths-stretch-vertical.html

    r71380 r71382  
    55        table { border-collapse: collapse; }
    66        td { background-color: green; padding: 0; }
    7         div { background-color: orange; height: 4px; width: 1px; }
     7        div { background-color: orange; width: 4px; height: 1px; }
    88    </style>
    99<head>
    10 <body>
     10<body style="-webkit-writing-mode: vertical-rl;">
    1111    <table>
    1212        <tr>
    13             <td width="1%"><div></div></td>
     13            <td height="1%"><div></div></td>
    1414        </tr>
    1515    </table>
    1616    <table>
    1717        <tr>
    18             <td width="2%"><div></div></td>
     18            <td height="2%"><div></div></td>
    1919        </tr>
    2020    </table>
    2121    <table>
    2222        <tr>
    23             <td width="3%"><div></div></td>
     23            <td height="3%"><div></div></td>
    2424        </tr>
    2525    </table>
    2626    <table>
    2727        <tr>
    28             <td width="4%"><div></div></td>
     28            <td height="4%"><div></div></td>
    2929        </tr>
    3030    </table>
    3131    <table>
    3232        <tr>
    33             <td width="5%"><div></div></td>
     33            <td height="5%"><div></div></td>
    3434        </tr>
    3535    </table>
    3636    <table>
    3737        <tr>
    38             <td width="10%"><div></div></td>
     38            <td height="10%"><div></div></td>
    3939        </tr>
    4040    </table>
    4141    <table>
    4242        <tr>
    43             <td width="20%"><div></div></td>
     43            <td height="20%"><div></div></td>
    4444        </tr>
    4545    </table>
    4646    <table>
    4747        <tr>
    48             <td width="30%"><div></div></td>
     48            <td height="30%"><div></div></td>
    4949        </tr>
    5050    </table>
    5151    <table>
    5252        <tr>
    53             <td width="40%"><div></div></td>
     53            <td height="40%"><div></div></td>
    5454        </tr>
    5555    </table>
    5656    <table>
    5757        <tr>
    58             <td width="50%"><div></div></td>
     58            <td height="50%"><div></div></td>
    5959        </tr>
    6060    </table>
    6161    <table>
    6262        <tr>
    63             <td width="60%"><div></div></td>
     63            <td height="60%"><div></div></td>
    6464        </tr>
    6565    </table>
    6666    <table>
    6767        <tr>
    68             <td width="70%"><div></div></td>
     68            <td height="70%"><div></div></td>
    6969        </tr>
    7070    </table>
    7171    <table>
    7272        <tr>
    73             <td width="80%"><div></div></td>
     73            <td height="80%"><div></div></td>
    7474        </tr>
    7575    </table>
    7676    <table>
    7777        <tr>
    78             <td width="90%"><div></div></td>
     78            <td height="90%"><div></div></td>
    7979        </tr>
    8080    </table>
    8181    <table>
    8282        <tr>
    83             <td width="95%"><div></div></td>
     83            <td height="95%"><div></div></td>
    8484        </tr>
    8585    </table>
    8686    <table>
    8787        <tr>
    88             <td width="96%"><div></div></td>
     88            <td height="96%"><div></div></td>
    8989        </tr>
    9090    </table>
    9191    <table>
    9292        <tr>
    93             <td width="97%"><div></div></td>
     93            <td height="97%"><div></div></td>
    9494        </tr>
    9595    </table>
    9696    <table>
    9797        <tr>
    98             <td width="98%"><div></div></td>
     98            <td height="98%"><div></div></td>
    9999        </tr>
    100100    </table>
    101101    <table>
    102102        <tr>
    103             <td width="99%"><div></div></td>
     103            <td height="99%"><div></div></td>
    104104        </tr>
    105105    </table>
    106106    <table>
    107107        <tr>
    108             <td width="100%"><div></div></td>
     108            <td height="100%"><div></div></td>
    109109        </tr>
    110110    </table>
  • trunk/LayoutTests/fast/table/rowspan-paint-order-vertical.html

    r71380 r71382  
    22<body>
    33
    4 <table width="100%" height="100" border="2" cellspacing="0" cellpadding="0">
     4<table height="580" width="100" border="2" cellspacing="0" cellpadding="0" style="-webkit-writing-mode: vertical-rl;">
    55
    66<tr >
    77<td bgcolor=#aaaaaa rowspan="3" >Left (3 rows)</td>
    8 <td rowspan="2" width="50%"   bgcolor="#000000">&nbsp;</td>
    9 <td colspan="10" align="center" nowrap valign="top" height="22" >Middle (1 row)</td>
    10 <td rowspan="2" width="50%"  bgcolor="#000000">&nbsp;</td>
     8<td rowspan="2" height="50%"   bgcolor="#000000">&nbsp;</td>
     9<td colspan="10" align="center" nowrap valign="top" width="22" >Middle (1 row)</td>
     10<td rowspan="2" height="50%"  bgcolor="#000000">&nbsp;</td>
    1111<td rowspan="3" bgcolor=#aaaaaa align="right" >Right (3 rows)
    1212</td>
  • trunk/LayoutTests/fast/table/table-display-types-vertical.html

    r71380 r71382  
    66      display: block;
    77      margin: 10px;
     8      -webkit-writing-mode: vertical-rl;
    89    }
    910   
     
    2122   
    2223    .para {
    23       width: 300px;
    24       height: 100px;
     24      height: 300px;
     25      width: 100px;
    2526      border: 1px solid black;
    2627      display: table-cell;
     28      -webkit-writing-mode: vertical-rl;
    2729    }
    2830  </style>
  • trunk/WebCore/ChangeLog

    r71379 r71382  
     12010-11-04  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        Made table layout and painting work with all writing modes. Hit-testing, repainting, tables
     6        where some elements have their own layers, and cells whose writing mode differs from the
     7        table’s are not supported yet.
     8
     9        Make tables work with vertical text
     10        https://bugs.webkit.org/show_bug.cgi?id=46417
     11
     12        Tests: fast/table/027-vertical.html
     13               fast/table/028-vertical.html
     14               fast/table/035-vertical.html
     15               fast/table/038-vertical.html
     16               fast/table/040-vertical.html
     17               fast/table/auto-with-percent-height-vertical.html
     18               fast/table/border-collapsing/001-vertical.html
     19               fast/table/border-collapsing/002-vertical.html
     20               fast/table/border-collapsing/003-vertical.html
     21               fast/table/border-collapsing/004-vertical.html
     22               fast/table/border-collapsing/border-collapsing-head-foot-vertical.html
     23               fast/table/border-collapsing/equal-precedence-resolution-vertical.html
     24               fast/table/border-collapsing/rtl-border-collapsing-vertical.html
     25               fast/table/colspanMinWidth-vertical.html
     26               fast/table/fixed-with-auto-with-colspan-vertical.html
     27               fast/table/growCellForImageQuirk-vertical.html
     28               fast/table/height-percent-test-vertical.html
     29               fast/table/percent-widths-stretch-vertical.html
     30               fast/table/rowspan-paint-order-vertical.html
     31               fast/table/table-display-types-vertical.html
     32
     33        * css/CSSStyleSelector.cpp:
     34        (WebCore::CSSStyleSelector::adjustRenderStyle): Changed to allow all writing modes for tables,
     35        make row groups, rows, column groups and columns inherit the table’s writing mode. For now,
     36        make cells do this too.
     37        * html/HTMLTableElement.cpp:
     38        (WebCore::HTMLTableElement::parseMappedAttribute): Map align=center using logical properties.
     39        * rendering/RenderTable.cpp:
     40        (WebCore::RenderTable::RenderTable): Initialize m_borderStart and m_borderEnd.
     41        (WebCore::RenderTable::styleDidChange): Changed the rule for when to use auto layout to look
     42        at the logical width instead of the width.
     43        (WebCore::RenderTable::computeLogicalWidth): Uses logical widths and works with perpendicular
     44        containing blocks.
     45        (WebCore::RenderTable::layout): Use logical lengths.
     46        (WebCore::RenderTable::setCellLogicalWidths): Renamed setCellWidths() to this and updated for
     47        the renaming of RenderTableSection::setCellWidths().
     48        (WebCore::RenderTable::paintObject): Account for flipped modes.
     49        (WebCore::RenderTable::subtractCaptionRect): Added this helper method the considers writing modes.
     50        (WebCore::RenderTable::paintBoxDecorations): Adopted subtractCaptionRect().
     51        (WebCore::RenderTable::paintMask): Ditto.
     52        (WebCore::RenderTable::computePreferredLogicalWidths): Updated for the renaming of
     53        recalcHorizontalBorders().
     54        (WebCore::RenderTable::calcBorderStart): Renamed calcBorderLeft() to this and changed it to use
     55        borderStart(). Splits odd number of pixels based on the physical side.
     56        (WebCore::RenderTable::calcBorderEnd): Similar.
     57        (WebCore::RenderTable::recalcBordersInRowDirection): Renamed recalcHorizontalBorders() to this
     58        and updated for other renames.
     59        (WebCore::RenderTable::borderBefore): Replaced borderTop() with this.
     60        (WebCore::RenderTable::borderAfter): Similar.
     61        (WebCore::RenderTable::outerBorderBefore): Similar.
     62        (WebCore::RenderTable::outerBorderAfter): Similar.
     63        (WebCore::RenderTable::outerBorderStart): Similar.
     64        (WebCore::RenderTable::outerBorderEnd): Similar.
     65        (WebCore::RenderTable::firstLineBoxBaseline): Changed to use logical heights.
     66        (WebCore::RenderTable::overflowClipRect): Account for writing modes.
     67        * rendering/RenderTable.h:
     68        (WebCore::RenderTable::borderStart):
     69        (WebCore::RenderTable::borderEnd):
     70        (WebCore::RenderTable::borderLeft):
     71        (WebCore::RenderTable::borderRight):
     72        (WebCore::RenderTable::borderTop):
     73        (WebCore::RenderTable::borderBottom):
     74        (WebCore::RenderTable::outerBorderLeft):
     75        (WebCore::RenderTable::outerBorderRight):
     76        (WebCore::RenderTable::outerBorderTop):
     77        (WebCore::RenderTable::outerBorderBottom):
     78        (WebCore::RenderTable::bordersPaddingAndSpacingInRowDirection): Changed to match its name.
     79        * rendering/RenderTableRow.cpp:
     80        (WebCore::RenderTableRow::styleWillChange): Changed to detect changes to logical height.
     81        * rendering/RenderTableSection.cpp:
     82        (WebCore::setRowLogicalHeightToRowStyleLogicalHeightIfNotRelative): Renamed and changed to use
     83        logical heights.
     84        (WebCore::RenderTableSection::RenderTableSection): Updated initializers for new member variables.
     85        (WebCore::RenderTableSection::addChild): Updated for rename.
     86        (WebCore::RenderTableSection::ensureRows): Ditto.
     87        (WebCore::RenderTableSection::addCell): Ditto. Also use logical heights.
     88        (WebCore::RenderTableSection::setCellLogicalWidths): Renamed setCellWidths() to this, changed
     89        to use logical widths.
     90        (WebCore::RenderTableSection::calcRowLogicalHeight): Added “logical” to the name. Updated with
     91        logical heights.
     92        (WebCore::RenderTableSection::layoutRows):
     93        (WebCore::RenderTableSection::calcOuterBorderBefore):
     94        (WebCore::RenderTableSection::calcOuterBorderAfter):
     95        (WebCore::RenderTableSection::calcOuterBorderStart):
     96        (WebCore::RenderTableSection::calcOuterBorderEnd):
     97        (WebCore::RenderTableSection::recalcOuterBorder):
     98        (WebCore::RenderTableSection::firstLineBoxBaseline):
     99        (WebCore::RenderTableSection::paintCell):
     100        (WebCore::RenderTableSection::recalcCells):
     101        * rendering/RenderTableSection.h:
     102        (WebCore::RenderTableSection::outerBorderBefore):
     103        (WebCore::RenderTableSection::outerBorderAfter):
     104        (WebCore::RenderTableSection::outerBorderStart):
     105        (WebCore::RenderTableSection::outerBorderEnd):
     106
    11072010-11-04  Kent Tamura  <tkent@chromium.org>
    2108
  • trunk/WebCore/css/CSSStyleSelector.cpp

    r71348 r71382  
    17541754             style->position() == RelativePosition)
    17551755            style->setPosition(StaticPosition);
    1756        
    1757         // FIXME: Since we don't support block-flow on either tables or flexible boxes yet, disallow setting
     1756
     1757        // writing-mode does not apply to table row groups, table column groups, table rows, and table columns.
     1758        // FIXME: Table cells should be allowed to be perpendicular or flipped with respect to the table, though.
     1759        if (style->display() == TABLE_COLUMN || style->display() == TABLE_COLUMN_GROUP || style->display() == TABLE_FOOTER_GROUP
     1760            || style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_ROW || style->display() == TABLE_ROW_GROUP
     1761            || style->display() == TABLE_CELL)
     1762            style->setWritingMode(parentStyle->writingMode());
     1763
     1764        // FIXME: Since we don't support block-flow on flexible boxes yet, disallow setting
    17581765        // of block-flow to anything other than TopToBottomWritingMode.
    1759         // https://bugs.webkit.org/show_bug.cgi?id=46417 - Tables support
    17601766        // https://bugs.webkit.org/show_bug.cgi?id=46418 - Flexible box support.
    1761         if (style->writingMode() != TopToBottomWritingMode && (style->display() == TABLE || style->display() == INLINE_TABLE
    1762             || style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_ROW_GROUP
    1763             || style->display() == TABLE_FOOTER_GROUP || style->display() == TABLE_ROW || style->display() == TABLE_CELL
    1764             || style->display() == BOX || style->display() == INLINE_BOX))
     1767        if (style->writingMode() != TopToBottomWritingMode && (style->display() == BOX || style->display() == INLINE_BOX))
    17651768            style->setWritingMode(TopToBottomWritingMode);
    17661769    }
  • trunk/WebCore/html/HTMLTableElement.cpp

    r69868 r71382  
    425425        if (!attr->value().isEmpty()) {
    426426            if (equalIgnoringCase(attr->value(), "center")) {
    427                 addCSSProperty(attr, CSSPropertyMarginLeft, CSSValueAuto);
    428                 addCSSProperty(attr, CSSPropertyMarginRight, CSSValueAuto);
     427                addCSSProperty(attr, CSSPropertyWebkitMarginStart, CSSValueAuto);
     428                addCSSProperty(attr, CSSPropertyWebkitMarginEnd, CSSValueAuto);
    429429            } else
    430430                addCSSProperty(attr, CSSPropertyFloat, attr->value());
  • trunk/WebCore/rendering/RenderTable.cpp

    r69437 r71382  
    55 *           (C) 1999 Lars Knoll (knoll@kde.org)
    66 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    7  * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
     7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
    88 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
    99 *
     
    5757    , m_hSpacing(0)
    5858    , m_vSpacing(0)
    59     , m_borderLeft(0)
    60     , m_borderRight(0)
     59    , m_borderStart(0)
     60    , m_borderEnd(0)
    6161{
    6262    setChildrenInline(false);
     
    8484        // According to the CSS2 spec, you only use fixed table layout if an
    8585        // explicit width is specified on the table.  Auto width implies auto table layout.
    86         if (style()->tableLayout() == TFIXED && !style()->width().isAuto())
     86        if (style()->tableLayout() == TFIXED && !style()->logicalWidth().isAuto())
    8787            m_tableLayout.set(new FixedTableLayout(this));
    8888        else
     
    205205
    206206    RenderBlock* cb = containingBlock();
    207     int availableWidth = cb->availableLogicalWidth();
    208 
    209     LengthType widthType = style()->width().type();
    210     if (widthType > Relative && style()->width().isPositive()) {
     207
     208    int availableLogicalWidth = containingBlockLogicalWidthForContent();
     209    bool hasPerpendicularContainingBlock = cb->style()->isHorizontalWritingMode() != style()->isHorizontalWritingMode();
     210    int containerWidthInInlineDirection = hasPerpendicularContainingBlock ? perpendicularContainingBlockLogicalHeight() : availableLogicalWidth;
     211
     212    LengthType logicalWidthType = style()->logicalWidth().type();
     213    if (logicalWidthType > Relative && style()->logicalWidth().isPositive()) {
    211214        // Percent or fixed table
    212         setWidth(style()->width().calcMinValue(availableWidth));
    213         setWidth(max(minPreferredLogicalWidth(), width()));
     215        setLogicalWidth(style()->logicalWidth().calcMinValue(containerWidthInInlineDirection));
     216        setLogicalWidth(max(minPreferredLogicalWidth(), logicalWidth()));
    214217    } else {
    215         // An auto width table should shrink to fit within the line width if necessary in order to
    216         // avoid overlapping floats.
    217         availableWidth = cb->availableLogicalWidthForLine(y(), false);
    218        
    219218        // Subtract out any fixed margins from our available width for auto width tables.
    220219        int marginTotal = 0;
    221         if (!style()->marginLeft().isAuto())
    222             marginTotal += style()->marginLeft().calcValue(availableWidth);
    223         if (!style()->marginRight().isAuto())
    224             marginTotal += style()->marginRight().calcValue(availableWidth);
     220        if (!style()->marginStart().isAuto())
     221            marginTotal += style()->marginStart().calcValue(availableLogicalWidth);
     222        if (!style()->marginEnd().isAuto())
     223            marginTotal += style()->marginEnd().calcValue(availableLogicalWidth);
    225224           
    226225        // Subtract out our margins to get the available content width.
    227         int availContentWidth = max(0, availableWidth - marginTotal);
     226        int availableContentLogicalWidth = max(0, containerWidthInInlineDirection - marginTotal);
    228227       
    229228        // Ensure we aren't bigger than our max width or smaller than our min width.
    230         setWidth(min(availContentWidth, maxPreferredLogicalWidth()));
    231     }
    232    
    233     setWidth(max(width(), minPreferredLogicalWidth()));
     229        setLogicalWidth(min(availableContentLogicalWidth, maxPreferredLogicalWidth()));
     230    }
     231
     232    setLogicalWidth(max(logicalWidth(), minPreferredLogicalWidth()));
    234233
    235234    // Finally, with our true width determined, compute our margins for real.
    236     m_marginRight = 0;
    237     m_marginLeft = 0;
    238     computeInlineDirectionMargins(cb, availableWidth, width());
     235    setMarginStart(0);
     236    setMarginEnd(0);
     237    if (!hasPerpendicularContainingBlock)
     238        computeInlineDirectionMargins(cb, availableLogicalWidth, logicalWidth());
     239    else {
     240        setMarginStart(style()->marginStart().calcMinValue(availableLogicalWidth));
     241        setMarginEnd(style()->marginEnd().calcMinValue(availableLogicalWidth));
     242    }
    239243}
    240244
     
    251255    LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()));
    252256
    253     setHeight(0);
     257    setLogicalHeight(0);
    254258    m_overflow.clear();
    255259
    256260    initMaxMarginValues();
    257261   
    258     int oldWidth = width();
     262    int oldLogicalWidth = logicalWidth();
    259263    computeLogicalWidth();
    260264
    261     if (m_caption && width() != oldWidth)
     265    if (m_caption && logicalWidth() != oldLogicalWidth)
    262266        m_caption->setNeedsLayout(true, false);
    263267
     
    269273    m_tableLayout->layout();
    270274
    271     setCellWidths();
    272 
    273     // layout child objects
    274     int calculatedHeight = 0;
    275     int oldTableTop = m_caption ? m_caption->height() + m_caption->marginTop() + m_caption->marginBottom() : 0;
     275    setCellLogicalWidths();
     276
     277    int totalSectionLogicalHeight = 0;
     278    int oldTableLogicalTop = m_caption ? m_caption->logicalHeight() + m_caption->marginBefore() + m_caption->marginAfter() : 0;
    276279
    277280    bool collapsing = collapseBorders();
     
    281284            child->layoutIfNeeded();
    282285            RenderTableSection* section = toRenderTableSection(child);
    283             calculatedHeight += section->calcRowHeight();
     286            totalSectionLogicalHeight += section->calcRowLogicalHeight();
    284287            if (collapsing)
    285288                section->recalcOuterBorder();
     
    299302    // did not shift).
    300303    bool sectionMoved = false;
    301     int movedSectionTop = 0;
     304    int movedSectionLogicalTop = 0;
    302305
    303306    // FIXME: Collapse caption margin.
     
    305308        IntRect captionRect(m_caption->x(), m_caption->y(), m_caption->width(), m_caption->height());
    306309
    307         m_caption->setLocation(m_caption->marginLeft(), height());
     310        m_caption->setLogicalLocation(m_caption->marginStart(), logicalHeight());
    308311        if (!selfNeedsLayout() && m_caption->checkForRepaintDuringLayout())
    309312            m_caption->repaintDuringLayoutIfMoved(captionRect);
    310313
    311         setHeight(height() + m_caption->height() + m_caption->marginTop() + m_caption->marginBottom());
    312 
    313         if (height() != oldTableTop) {
     314        setLogicalHeight(logicalHeight() + m_caption->logicalHeight() + m_caption->marginBefore() + m_caption->marginAfter());
     315
     316        if (logicalHeight() != oldTableLogicalTop) {
    314317            sectionMoved = true;
    315             movedSectionTop = min(height(), oldTableTop);
    316         }
    317     }
    318 
    319     int bpTop = borderTop() + (collapsing ? 0 : paddingTop());
    320     int bpBottom = borderBottom() + (collapsing ? 0 : paddingBottom());
    321    
    322     setHeight(height() + bpTop);
     318            movedSectionLogicalTop = min(logicalHeight(), oldTableLogicalTop);
     319        }
     320    }
     321
     322    int borderAndPaddingBefore = borderBefore() + (collapsing ? 0 : paddingBefore());
     323    int borderAndPaddingAfter = borderAfter() + (collapsing ? 0 : paddingAfter());
     324
     325    setLogicalHeight(logicalHeight() + borderAndPaddingBefore);
    323326
    324327    if (!isPositioned())
    325328        computeLogicalHeight();
    326329
    327     Length h = style()->height();
    328     int th = 0;
    329     if (h.isFixed())
     330    Length logicalHeightLength = style()->logicalHeight();
     331    int computedLogicalHeight = 0;
     332    if (logicalHeightLength.isFixed()) {
    330333        // Tables size as though CSS height includes border/padding.
    331         th = h.value() - (bpTop + bpBottom);
    332     else if (h.isPercent())
    333         th = computePercentageLogicalHeight(h);
    334     th = max(0, th);
     334        computedLogicalHeight = logicalHeightLength.value() - (borderAndPaddingBefore + borderAndPaddingAfter);
     335    } else if (logicalHeightLength.isPercent())
     336        computedLogicalHeight = computePercentageLogicalHeight(logicalHeightLength);
     337    computedLogicalHeight = max(0, computedLogicalHeight);
    335338
    336339    for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
    337340        if (child->isTableSection())
    338341            // FIXME: Distribute extra height between all table body sections instead of giving it all to the first one.
    339             toRenderTableSection(child)->layoutRows(child == m_firstBody ? max(0, th - calculatedHeight) : 0);
    340     }
    341 
    342     if (!m_firstBody && th > calculatedHeight && !document()->inQuirksMode()) {
     342            toRenderTableSection(child)->layoutRows(child == m_firstBody ? max(0, computedLogicalHeight - totalSectionLogicalHeight) : 0);
     343    }
     344
     345    if (!m_firstBody && computedLogicalHeight > totalSectionLogicalHeight && !document()->inQuirksMode()) {
    343346        // Completely empty tables (with no sections or anything) should at least honor specified height
    344347        // in strict mode.
    345         setHeight(height() + th);
    346     }
    347    
    348     int bl = borderLeft();
     348        setLogicalHeight(logicalHeight() + computedLogicalHeight);
     349    }
     350
     351    int sectionLogicalLeft = style()->isLeftToRightDirection() ? borderStart() : borderEnd();
    349352    if (!collapsing)
    350         bl += paddingLeft();
     353        sectionLogicalLeft += style()->isLeftToRightDirection() ? paddingStart() : paddingEnd();
    351354
    352355    // position the table sections
    353356    RenderTableSection* section = m_head ? m_head : (m_firstBody ? m_firstBody : m_foot);
    354357    while (section) {
    355         if (!sectionMoved && section->y() != height()) {
     358        if (!sectionMoved && section->logicalTop() != logicalHeight()) {
    356359            sectionMoved = true;
    357             movedSectionTop = min(height(), section->y()) + section->topVisibleOverflow();
    358         }
    359         section->setLocation(bl, height());
    360 
    361         setHeight(height() + section->height());
     360            movedSectionLogicalTop = min(logicalHeight(), section->logicalTop()) + (style()->isHorizontalWritingMode() ? section->topVisibleOverflow() : section->leftVisibleOverflow());
     361        }
     362        section->setLogicalLocation(sectionLogicalLeft, logicalHeight());
     363
     364        setLogicalHeight(logicalHeight() + section->logicalHeight());
    362365        section = sectionBelow(section);
    363366    }
    364367
    365     setHeight(height() + bpBottom);
     368    setLogicalHeight(logicalHeight() + borderAndPaddingAfter);
    366369
    367370    if (m_caption && m_caption->style()->captionSide() == CAPBOTTOM) {
    368371        IntRect captionRect(m_caption->x(), m_caption->y(), m_caption->width(), m_caption->height());
    369372
    370         m_caption->setLocation(m_caption->marginLeft(), height());
     373        m_caption->setLogicalLocation(m_caption->marginStart(), logicalHeight());
    371374        if (!selfNeedsLayout() && m_caption->checkForRepaintDuringLayout())
    372375            m_caption->repaintDuringLayoutIfMoved(captionRect);
    373376
    374         setHeight(height() + m_caption->height() + m_caption->marginTop() + m_caption->marginBottom());
     377        setLogicalHeight(logicalHeight() + m_caption->logicalHeight() + m_caption->marginBefore() + m_caption->marginAfter());
    375378    }
    376379
     
    411414    bool didFullRepaint = repainter.repaintAfterLayout();
    412415    // Repaint with our new bounds if they are different from our old bounds.
    413     if (!didFullRepaint && sectionMoved)
    414         repaintRectangle(IntRect(leftVisibleOverflow(), movedSectionTop, rightVisibleOverflow() - leftVisibleOverflow(), bottomVisibleOverflow() - movedSectionTop));
    415    
     416    if (!didFullRepaint && sectionMoved) {
     417        if (style()->isHorizontalWritingMode())
     418            repaintRectangle(IntRect(leftVisibleOverflow(), movedSectionLogicalTop, rightVisibleOverflow() - leftVisibleOverflow(), bottomVisibleOverflow() - movedSectionLogicalTop));
     419        else
     420            repaintRectangle(IntRect(movedSectionLogicalTop, topVisibleOverflow(), rightVisibleOverflow() - movedSectionLogicalTop, bottomVisibleOverflow() - topVisibleOverflow()));
     421    }
     422
    416423    setNeedsLayout(false);
    417424}
    418425
    419 void RenderTable::setCellWidths()
     426void RenderTable::setCellLogicalWidths()
    420427{
    421428    for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
    422429        if (child->isTableSection())
    423             toRenderTableSection(child)->setCellWidths();
     430            toRenderTableSection(child)->setCellLogicalWidths();
    424431    }
    425432}
     
    468475
    469476    for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
    470         if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption))
    471             child->paint(info, tx, ty);
     477        if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption)) {
     478            IntPoint childPoint = flipForWritingMode(toRenderBox(child), IntPoint(tx, ty), ParentToChildFlippingAdjustment);
     479            child->paint(info, childPoint.x(), childPoint.y());
     480        }
    472481    }
    473482   
     
    479488        RenderTableCell::CollapsedBorderStyles borderStyles;
    480489        RenderObject* stop = nextInPreOrderAfterChildren();
    481         for (RenderObject* o = firstChild(); o && o != stop; o = o->nextInPreOrder())
     490        for (RenderObject* o = firstChild(); o && o != stop; o = o->nextInPreOrder()) {
    482491            if (o->isTableCell())
    483492                toRenderTableCell(o)->collectBorderStyles(borderStyles);
     493        }
    484494        RenderTableCell::sortBorderStyles(borderStyles);
    485495        size_t count = borderStyles.size();
     
    487497            m_currentBorder = &borderStyles[i];
    488498            for (RenderObject* child = firstChild(); child; child = child->nextSibling())
    489                 if (child->isTableSection())
    490                     child->paint(info, tx, ty);
     499                if (child->isTableSection()) {
     500                    IntPoint childPoint = flipForWritingMode(toRenderTableSection(child), IntPoint(tx, ty), ParentToChildFlippingAdjustment);
     501                    child->paint(info, childPoint.x(), childPoint.y());
     502                }
    491503        }
    492504        m_currentBorder = 0;
     505    }
     506}
     507
     508void RenderTable::subtractCaptionRect(IntRect& rect) const
     509{
     510    if (!m_caption)
     511        return;
     512
     513    int captionLogicalHeight = m_caption->logicalHeight() + m_caption->marginBefore() + m_caption->marginAfter();
     514    bool captionIsBefore = (m_caption->style()->captionSide() != CAPBOTTOM) ^ style()->isFlippedBlocksWritingMode();
     515    if (style()->isHorizontalWritingMode()) {
     516        rect.setHeight(rect.height() - captionLogicalHeight);
     517        if (captionIsBefore)
     518            rect.move(0, captionLogicalHeight);
     519    } else {
     520        rect.setWidth(rect.width() - captionLogicalHeight);
     521        if (captionIsBefore)
     522            rect.move(captionLogicalHeight, 0);
    493523    }
    494524}
     
    499529        return;
    500530
    501     int w = width();
    502     int h = height();
    503 
    504     // Account for the caption.
    505     if (m_caption) {
    506         int captionHeight = (m_caption->height() + m_caption->marginBottom() +  m_caption->marginTop());
    507         h -= captionHeight;
    508         if (m_caption->style()->captionSide() != CAPBOTTOM)
    509             ty += captionHeight;
    510     }
    511 
    512     paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Normal);
     531    IntRect rect(tx, ty, width(), height());
     532    subtractCaptionRect(rect);
     533
     534    paintBoxShadow(paintInfo.context, rect.x(), rect.y(), rect.width(), rect.height(), style(), Normal);
    513535   
    514     paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->backgroundLayers(), tx, ty, w, h);
    515     paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Inset);
     536    paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->backgroundLayers(), rect.x(), rect.y(), rect.width(), rect.height());
     537    paintBoxShadow(paintInfo.context, rect.x(), rect.y(), rect.width(), rect.height(), style(), Inset);
    516538
    517539    if (style()->hasBorder() && !collapseBorders())
    518         paintBorder(paintInfo.context, tx, ty, w, h, style());
     540        paintBorder(paintInfo.context, rect.x(), rect.y(), rect.width(), rect.height(), style());
    519541}
    520542
     
    524546        return;
    525547
    526     int w = width();
    527     int h = height();
    528 
    529     // Account for the caption.
    530     if (m_caption) {
    531         int captionHeight = (m_caption->height() + m_caption->marginBottom() +  m_caption->marginTop());
    532         h -= captionHeight;
    533         if (m_caption->style()->captionSide() != CAPBOTTOM)
    534             ty += captionHeight;
    535     }
    536 
    537     paintMaskImages(paintInfo, tx, ty, w, h);
     548    IntRect rect(tx, ty, width(), height());
     549    subtractCaptionRect(rect);
     550
     551    paintMaskImages(paintInfo, rect.x(), rect.y(), rect.width(), rect.height());
    538552}
    539553
     
    543557
    544558    recalcSectionsIfNeeded();
    545     recalcHorizontalBorders();
     559    recalcBordersInRowDirection();
    546560
    547561    m_tableLayout->computePreferredLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth);
     
    722736}
    723737
    724 int RenderTable::calcBorderLeft() const
     738int RenderTable::calcBorderStart() const
    725739{
    726740    if (collapseBorders()) {
     
    731745        unsigned borderWidth = 0;
    732746
    733         const BorderValue& tb = style()->borderLeft();
     747        const BorderValue& tb = style()->borderStart();
    734748        if (tb.style() == BHIDDEN)
    735749            return 0;
     
    737751            borderWidth = tb.width();
    738752
    739         int leftmostColumn = !style()->isLeftToRightDirection() ? numEffCols() - 1 : 0;
    740         RenderTableCol* colGroup = colElement(leftmostColumn);
    741         if (colGroup) {
    742             const BorderValue& gb = style()->borderLeft();
     753        if (RenderTableCol* colGroup = colElement(0)) {
     754            const BorderValue& gb = colGroup->style()->borderStart();
    743755            if (gb.style() == BHIDDEN)
    744756                return 0;
     
    752764       
    753765        if (firstNonEmptySection) {
    754             const BorderValue& sb = firstNonEmptySection->style()->borderLeft();
     766            const BorderValue& sb = firstNonEmptySection->style()->borderStart();
    755767            if (sb.style() == BHIDDEN)
    756768                return 0;
     
    759771                borderWidth = max(borderWidth, static_cast<unsigned>(sb.width()));
    760772
    761             const RenderTableSection::CellStruct& cs = firstNonEmptySection->cellAt(0, leftmostColumn);
     773            const RenderTableSection::CellStruct& cs = firstNonEmptySection->cellAt(0, 0);
    762774           
    763775            if (cs.hasCells()) {
    764                 const BorderValue& cb = cs.primaryCell()->style()->borderLeft();
     776                const BorderValue& cb = cs.primaryCell()->style()->borderStart(); // FIXME: Make this work with perpendicualr and flipped cells.
    765777                if (cb.style() == BHIDDEN)
    766778                    return 0;
    767779
    768                 const BorderValue& rb = cs.primaryCell()->parent()->style()->borderLeft();
     780                const BorderValue& rb = cs.primaryCell()->parent()->style()->borderStart();
    769781                if (rb.style() == BHIDDEN)
    770782                    return 0;
     
    776788            }
    777789        }
    778         return borderWidth / 2;
    779     }
    780     return RenderBlock::borderLeft();
    781 }
    782    
    783 int RenderTable::calcBorderRight() const
     790        return (borderWidth + (style()->isLeftToRightDirection() ? 0 : 1)) / 2;
     791    }
     792    return RenderBlock::borderStart();
     793}
     794
     795int RenderTable::calcBorderEnd() const
    784796{
    785797    if (collapseBorders()) {
     
    790802        unsigned borderWidth = 0;
    791803
    792         const BorderValue& tb = style()->borderRight();
     804        const BorderValue& tb = style()->borderEnd();
    793805        if (tb.style() == BHIDDEN)
    794806            return 0;
     
    796808            borderWidth = tb.width();
    797809
    798         int rightmostColumn = !style()->isLeftToRightDirection() ? 0 : numEffCols() - 1;
    799         RenderTableCol* colGroup = colElement(rightmostColumn);
    800         if (colGroup) {
    801             const BorderValue& gb = style()->borderRight();
     810        int endColumn = numEffCols() - 1;
     811        if (RenderTableCol* colGroup = colElement(endColumn)) {
     812            const BorderValue& gb = colGroup->style()->borderEnd();
    802813            if (gb.style() == BHIDDEN)
    803814                return 0;
     
    811822       
    812823        if (firstNonEmptySection) {
    813             const BorderValue& sb = firstNonEmptySection->style()->borderRight();
     824            const BorderValue& sb = firstNonEmptySection->style()->borderEnd();
    814825            if (sb.style() == BHIDDEN)
    815826                return 0;
     
    818829                borderWidth = max(borderWidth, static_cast<unsigned>(sb.width()));
    819830
    820             const RenderTableSection::CellStruct& cs = firstNonEmptySection->cellAt(0, rightmostColumn);
     831            const RenderTableSection::CellStruct& cs = firstNonEmptySection->cellAt(0, endColumn);
    821832           
    822833            if (cs.hasCells()) {
    823                 const BorderValue& cb = cs.primaryCell()->style()->borderRight();
     834                const BorderValue& cb = cs.primaryCell()->style()->borderEnd(); // FIXME: Make this work with perpendicular and flipped cells.
    824835                if (cb.style() == BHIDDEN)
    825836                    return 0;
    826837
    827                 const BorderValue& rb = cs.primaryCell()->parent()->style()->borderRight();
     838                const BorderValue& rb = cs.primaryCell()->parent()->style()->borderEnd();
    828839                if (rb.style() == BHIDDEN)
    829840                    return 0;
     
    835846            }
    836847        }
    837         return (borderWidth + 1) / 2;
    838     }
    839     return RenderBlock::borderRight();
    840 }
    841 
    842 void RenderTable::recalcHorizontalBorders()
    843 {
    844     m_borderLeft = calcBorderLeft();
    845     m_borderRight = calcBorderRight();
    846 }
    847 
    848 int RenderTable::borderTop() const
     848        return (borderWidth + (style()->isLeftToRightDirection() ? 1 : 0)) / 2;
     849    }
     850    return RenderBlock::borderEnd();
     851}
     852
     853void RenderTable::recalcBordersInRowDirection()
     854{
     855    m_borderStart = calcBorderStart();
     856    m_borderEnd = calcBorderEnd();
     857}
     858
     859int RenderTable::borderBefore() const
    849860{
    850861    if (collapseBorders())
    851         return outerBorderTop();
    852     return RenderBlock::borderTop();
    853 }
    854 
    855 int RenderTable::borderBottom() const
     862        return outerBorderBefore();
     863    return RenderBlock::borderBefore();
     864}
     865
     866int RenderTable::borderAfter() const
    856867{
    857868    if (collapseBorders())
    858         return outerBorderBottom();
    859     return RenderBlock::borderBottom();
    860 }
    861 
    862 int RenderTable::outerBorderTop() const
     869        return outerBorderAfter();
     870    return RenderBlock::borderAfter();
     871}
     872
     873int RenderTable::outerBorderBefore() const
    863874{
    864875    if (!collapseBorders())
     
    875886        topSection = 0;
    876887    if (topSection) {
    877         borderWidth = topSection->outerBorderTop();
     888        borderWidth = topSection->outerBorderBefore();
    878889        if (borderWidth == -1)
    879890            return 0;   // Overridden by hidden
    880891    }
    881     const BorderValue& tb = style()->borderTop();
     892    const BorderValue& tb = style()->borderBefore();
    882893    if (tb.style() == BHIDDEN)
    883894        return 0;
     
    887898}
    888899
    889 int RenderTable::outerBorderBottom() const
     900int RenderTable::outerBorderAfter() const
    890901{
    891902    if (!collapseBorders())
     
    901912    }
    902913    if (bottomSection) {
    903         borderWidth = bottomSection->outerBorderBottom();
     914        borderWidth = bottomSection->outerBorderAfter();
    904915        if (borderWidth == -1)
    905916            return 0;   // Overridden by hidden
    906917    }
    907     const BorderValue& tb = style()->borderBottom();
     918    const BorderValue& tb = style()->borderAfter();
    908919    if (tb.style() == BHIDDEN)
    909920        return 0;
     
    913924}
    914925
    915 int RenderTable::outerBorderLeft() const
     926int RenderTable::outerBorderStart() const
    916927{
    917928    if (!collapseBorders())
     
    920931    int borderWidth = 0;
    921932
    922     const BorderValue& tb = style()->borderLeft();
     933    const BorderValue& tb = style()->borderStart();
    923934    if (tb.style() == BHIDDEN)
    924935        return 0;
    925936    if (tb.style() > BHIDDEN)
    926         borderWidth = tb.width() / 2;
     937        borderWidth = (tb.width() + (style()->isLeftToRightDirection() ? 0 : 1)) / 2;
    927938
    928939    bool allHidden = true;
     
    930941        if (!child->isTableSection())
    931942            continue;
    932         int sw = toRenderTableSection(child)->outerBorderLeft();
     943        int sw = toRenderTableSection(child)->outerBorderStart();
    933944        if (sw == -1)
    934945            continue;
     
    943954}
    944955
    945 int RenderTable::outerBorderRight() const
     956int RenderTable::outerBorderEnd() const
    946957{
    947958    if (!collapseBorders())
     
    950961    int borderWidth = 0;
    951962
    952     const BorderValue& tb = style()->borderRight();
     963    const BorderValue& tb = style()->borderEnd();
    953964    if (tb.style() == BHIDDEN)
    954965        return 0;
    955966    if (tb.style() > BHIDDEN)
    956         borderWidth = (tb.width() + 1) / 2;
     967        borderWidth = (tb.width() + (style()->isLeftToRightDirection() ? 1 : 0)) / 2;
    957968
    958969    bool allHidden = true;
     
    960971        if (!child->isTableSection())
    961972            continue;
    962         int sw = toRenderTableSection(child)->outerBorderRight();
     973        int sw = toRenderTableSection(child)->outerBorderEnd();
    963974        if (sw == -1)
    964975            continue;
     
    10981109int RenderTable::firstLineBoxBaseline() const
    10991110{
     1111    if (isWritingModeRoot())
     1112        return -1;
     1113
    11001114    RenderTableSection* firstNonEmptySection = m_head ? m_head : (m_firstBody ? m_firstBody : m_foot);
    11011115    if (firstNonEmptySection && !firstNonEmptySection->numRows())
     
    11051119        return -1;
    11061120
    1107     return firstNonEmptySection->y() + firstNonEmptySection->firstLineBoxBaseline();
     1121    return firstNonEmptySection->logicalTop() + firstNonEmptySection->firstLineBoxBaseline();
    11081122}
    11091123
     
    11191133    // we might have to hack this code first (depending on what order we do these bug fixes in).
    11201134    if (m_caption) {
    1121         rect.setHeight(height());
    1122         rect.setY(ty);
     1135        if (style()->isHorizontalWritingMode()) {
     1136            rect.setHeight(height());
     1137            rect.setY(ty);
     1138        } else {
     1139            rect.setWidth(width());
     1140            rect.setX(tx);
     1141        }
    11231142    }
    11241143
  • trunk/WebCore/rendering/RenderTable.h

    r71262 r71382  
    55 *           (C) 1999 Lars Knoll (knoll@kde.org)
    66 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    7  * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
     7 * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010 Apple Inc. All rights reserved.
    88 *
    99 * This library is free software; you can redistribute it and/or
     
    4848   
    4949    bool collapseBorders() const { return style()->borderCollapse(); }
    50     int borderLeft() const { return m_borderLeft; }
    51     int borderRight() const { return m_borderRight; }
    52     int borderTop() const;
    53     int borderBottom() const;
    54    
     50
     51    int borderStart() const { return m_borderStart; }
     52    int borderEnd() const { return m_borderEnd; }
     53    int borderBefore() const;
     54    int borderAfter() const;
     55
     56    int borderLeft() const
     57    {
     58        if (style()->isHorizontalWritingMode())
     59            return style()->isLeftToRightDirection() ? borderStart() : borderEnd();
     60        return style()->isFlippedBlocksWritingMode() ? borderAfter() : borderBefore();
     61    }
     62
     63    int borderRight() const
     64    {
     65        if (style()->isHorizontalWritingMode())
     66            return style()->isLeftToRightDirection() ? borderEnd() : borderStart();
     67        return style()->isFlippedBlocksWritingMode() ? borderBefore() : borderAfter();
     68    }
     69
     70    int borderTop() const
     71    {
     72        if (style()->isHorizontalWritingMode())
     73            return style()->isFlippedBlocksWritingMode() ? borderAfter() : borderBefore();
     74        return style()->isLeftToRightDirection() ? borderStart() : borderEnd();
     75    }
     76
     77    int borderBottom() const
     78    {
     79        if (style()->isHorizontalWritingMode())
     80            return style()->isFlippedBlocksWritingMode() ? borderBefore() : borderAfter();
     81        return style()->isLeftToRightDirection() ? borderEnd() : borderStart();
     82    }
     83
    5584    const Color bgColor() const { return style()->visitedDependentColor(CSSPropertyBackgroundColor); }
    5685
    57     int outerBorderTop() const;
    58     int outerBorderBottom() const;
    59     int outerBorderLeft() const;
    60     int outerBorderRight() const;
    61    
    62     int calcBorderLeft() const;
    63     int calcBorderRight() const;
    64     void recalcHorizontalBorders();
     86    int outerBorderBefore() const;
     87    int outerBorderAfter() const;
     88    int outerBorderStart() const;
     89    int outerBorderEnd() const;
     90
     91    int outerBorderLeft() const
     92    {
     93        if (style()->isHorizontalWritingMode())
     94            return style()->isLeftToRightDirection() ? outerBorderStart() : outerBorderEnd();
     95        return style()->isFlippedBlocksWritingMode() ? outerBorderAfter() : outerBorderBefore();
     96    }
     97
     98    int outerBorderRight() const
     99    {
     100        if (style()->isHorizontalWritingMode())
     101            return style()->isLeftToRightDirection() ? outerBorderEnd() : outerBorderStart();
     102        return style()->isFlippedBlocksWritingMode() ? outerBorderBefore() : outerBorderAfter();
     103    }
     104
     105    int outerBorderTop() const
     106    {
     107        if (style()->isHorizontalWritingMode())
     108            return style()->isFlippedBlocksWritingMode() ? outerBorderAfter() : outerBorderBefore();
     109        return style()->isLeftToRightDirection() ? outerBorderStart() : outerBorderEnd();
     110    }
     111
     112    int outerBorderBottom() const
     113    {
     114        if (style()->isHorizontalWritingMode())
     115            return style()->isFlippedBlocksWritingMode() ? outerBorderBefore() : outerBorderAfter();
     116        return style()->isLeftToRightDirection() ? outerBorderEnd() : outerBorderStart();
     117    }
     118
     119    int calcBorderStart() const;
     120    int calcBorderEnd() const;
     121    void recalcBordersInRowDirection();
    65122
    66123    virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
     
    111168    int bordersPaddingAndSpacingInRowDirection() const
    112169    {
    113         return borderLeft() + borderRight() +
    114                (collapseBorders() ? 0 : (paddingLeft() + paddingRight() + (numEffCols() + 1) * hBorderSpacing()));
     170        return borderStart() + borderEnd() +
     171               (collapseBorders() ? 0 : (paddingStart() + paddingEnd() + (numEffCols() + 1) * hBorderSpacing()));
    115172    }
    116173
     
    170227    virtual void updateFirstLetter();
    171228   
    172     virtual void setCellWidths();
     229    virtual void setCellLogicalWidths();
    173230
    174231    virtual void computeLogicalWidth();
    175232
    176233    virtual IntRect overflowClipRect(int tx, int ty);
     234
     235    void subtractCaptionRect(IntRect&) const;
    177236
    178237    void recalcSections() const;
     
    195254    short m_hSpacing;
    196255    short m_vSpacing;
    197     int m_borderLeft;
    198     int m_borderRight;
     256    int m_borderStart;
     257    int m_borderEnd;
    199258};
    200259
  • trunk/WebCore/rendering/RenderTableRow.cpp

    r68427 r71382  
    55 *           (C) 1999 Lars Knoll (knoll@kde.org)
    66 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    7  * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
     7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
    88 *
    99 * This library is free software; you can redistribute it and/or
     
    5555void RenderTableRow::styleWillChange(StyleDifference diff, const RenderStyle* newStyle)
    5656{
    57     if (section() && style() && style()->height() != newStyle->height())
     57    if (section() && style() && style()->logicalHeight() != newStyle->logicalHeight())
    5858        section()->setNeedsCellRecalc();
    5959
  • trunk/WebCore/rendering/RenderTableSection.cpp

    r71251 r71382  
    55 *           (C) 1999 Lars Knoll (knoll@kde.org)
    66 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    7  * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
     7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
    88 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
    99 *
     
    4444using namespace HTMLNames;
    4545
    46 static inline void setRowHeightToRowStyleHeightIfNotRelative(RenderTableSection::RowStruct* row)
     46static inline void setRowLogicalHeightToRowStyleLogicalHeightIfNotRelative(RenderTableSection::RowStruct* row)
    4747{
    4848    ASSERT(row && row->rowRenderer);
    49     row->height = row->rowRenderer->style()->height();
    50     if (row->height.isRelative())
    51         row->height = Length();
     49    row->logicalHeight = row->rowRenderer->style()->logicalHeight();
     50    if (row->logicalHeight.isRelative())
     51        row->logicalHeight = Length();
    5252}
    5353
     
    5757    , m_cCol(0)
    5858    , m_cRow(-1)
    59     , m_outerBorderLeft(0)
    60     , m_outerBorderRight(0)
    61     , m_outerBorderTop(0)
    62     , m_outerBorderBottom(0)
     59    , m_outerBorderStart(0)
     60    , m_outerBorderEnd(0)
     61    , m_outerBorderBefore(0)
     62    , m_outerBorderAfter(0)
    6363    , m_needsCellRecalc(false)
    6464    , m_hasOverflowingCell(false)
     
    134134
    135135    if (!beforeChild)
    136         setRowHeightToRowStyleHeightIfNotRelative(&m_grid[m_cRow]);
     136        setRowLogicalHeightToRowStyleLogicalHeightIfNotRelative(&m_grid[m_cRow]);
    137137
    138138    // If the next renderer is actually wrapped in an anonymous table row, we need to go up and find that.
     
    166166            m_grid[r].rowRenderer = 0;
    167167            m_grid[r].baseline = 0;
    168             m_grid[r].height = Length();
     168            m_grid[r].logicalHeight = Length();
    169169        }
    170170    }
     
    191191    if (rSpan == 1) {
    192192        // we ignore height settings on rowspan cells
    193         Length height = cell->style()->height();
    194         if (height.isPositive() || (height.isRelative() && height.value() >= 0)) {
    195             Length cRowHeight = m_grid[m_cRow].height;
    196             switch (height.type()) {
     193        Length logicalHeight = cell->style()->logicalHeight();
     194        if (logicalHeight.isPositive() || (logicalHeight.isRelative() && logicalHeight.value() >= 0)) {
     195            Length cRowLogicalHeight = m_grid[m_cRow].logicalHeight;
     196            switch (logicalHeight.type()) {
    197197                case Percent:
    198                     if (!(cRowHeight.isPercent()) ||
    199                         (cRowHeight.isPercent() && cRowHeight.rawValue() < height.rawValue()))
    200                         m_grid[m_cRow].height = height;
     198                    if (!(cRowLogicalHeight.isPercent()) ||
     199                        (cRowLogicalHeight.isPercent() && cRowLogicalHeight.rawValue() < logicalHeight.rawValue()))
     200                        m_grid[m_cRow].logicalHeight = logicalHeight;
    201201                        break;
    202202                case Fixed:
    203                     if (cRowHeight.type() < Percent ||
    204                         (cRowHeight.isFixed() && cRowHeight.value() < height.value()))
    205                         m_grid[m_cRow].height = height;
     203                    if (cRowLogicalHeight.type() < Percent ||
     204                        (cRowLogicalHeight.isFixed() && cRowLogicalHeight.value() < logicalHeight.value()))
     205                        m_grid[m_cRow].logicalHeight = logicalHeight;
    206206                    break;
    207207                case Relative:
     
    249249}
    250250
    251 void RenderTableSection::setCellWidths()
     251void RenderTableSection::setCellLogicalWidths()
    252252{
    253253    Vector<int>& columnPos = table()->columnPositions();
     
    271271            }
    272272            int w = columnPos[endCol] - columnPos[j] - table()->hBorderSpacing();
    273             int oldWidth = cell->width();
    274             if (w != oldWidth) {
     273            int oldLogicalWidth = cell->logicalWidth();
     274            if (w != oldLogicalWidth) {
    275275                cell->setNeedsLayout(true);
    276276                if (!table()->selfNeedsLayout() && cell->checkForRepaintDuringLayout()) {
     
    290290}
    291291
    292 int RenderTableSection::calcRowHeight()
     292int RenderTableSection::calcRowLogicalHeight()
    293293{
    294294#ifndef NDEBUG
     
    312312        int baseline = 0;
    313313        int bdesc = 0;
    314         int ch = m_grid[r].height.calcMinValue(0);
     314        int ch = m_grid[r].logicalHeight.calcMinValue(0);
    315315        int pos = m_rowPos[r] + ch + (m_grid[r].rowRenderer ? spacing : 0);
    316316
     
    342342                cell->layoutIfNeeded();
    343343            }
    344            
    345             int adjustedPaddingTop = cell->paddingTop() - cell->intrinsicPaddingBefore();
    346             int adjustedPaddingBottom = cell->paddingBottom() - cell->intrinsicPaddingAfter();
    347             int adjustedHeight = cell->height() - (cell->intrinsicPaddingBefore() + cell->intrinsicPaddingAfter());
    348        
     344
     345            int adjustedPaddingBefore = cell->paddingBefore() - cell->intrinsicPaddingBefore();
     346            int adjustedPaddingAfter = cell->paddingAfter() - cell->intrinsicPaddingAfter();
     347            int adjustedLogicalHeight = cell->logicalHeight() - (cell->intrinsicPaddingBefore() + cell->intrinsicPaddingAfter());
     348
    349349            // Explicit heights use the border box in quirks mode.  In strict mode do the right
    350350            // thing and actually add in the border and padding.
    351             ch = cell->style()->height().calcValue(0) +
    352                 (document()->inQuirksMode() ? 0 : (adjustedPaddingTop + adjustedPaddingBottom +
    353                                                    cell->borderTop() + cell->borderBottom()));
    354             ch = max(ch, adjustedHeight);
     351            ch = cell->style()->logicalHeight().calcValue(0) +
     352                (document()->inQuirksMode() ? 0 : (adjustedPaddingBefore + adjustedPaddingAfter +
     353                                                   cell->borderBefore() + cell->borderAfter()));
     354            ch = max(ch, adjustedLogicalHeight);
    355355
    356356            pos = m_rowPos[indx] + ch + (m_grid[r].rowRenderer ? spacing : 0);
     
    362362            if (va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB) {
    363363                int b = cell->baselinePosition();
    364                 if (b > cell->borderTop() + cell->paddingTop()) {
     364                if (b > cell->borderBefore() + cell->paddingBefore()) {
    365365                    baseline = max(baseline, b - cell->intrinsicPaddingBefore());
    366366                    bdesc = max(bdesc, m_rowPos[indx] + ch - (b - cell->intrinsicPaddingBefore()));
     
    418418   
    419419    // Set the width of our section now.  The rows will also be this width.
    420     setWidth(table()->contentWidth());
     420    setLogicalWidth(table()->contentLogicalWidth());
    421421    m_overflow.clear();
    422422    m_hasOverflowingCell = false;
     
    429429        int numAuto = 0;
    430430        for (int r = 0; r < totalRows; r++) {
    431             if (m_grid[r].height.isAuto())
     431            if (m_grid[r].logicalHeight.isAuto())
    432432                numAuto++;
    433             else if (m_grid[r].height.isPercent())
    434                 totalPercent += m_grid[r].height.rawValue();
     433            else if (m_grid[r].logicalHeight.isPercent())
     434                totalPercent += m_grid[r].logicalHeight.rawValue();
    435435        }
    436436        if (totalPercent) {
     
    440440            int rh = m_rowPos[1] - m_rowPos[0];
    441441            for (int r = 0; r < totalRows; r++) {
    442                 if (totalPercent > 0 && m_grid[r].height.isPercent()) {
    443                     int toAdd = min(dh, (totalHeight * m_grid[r].height.rawValue() / (100 * percentScaleFactor)) - rh);
     442                if (totalPercent > 0 && m_grid[r].logicalHeight.isPercent()) {
     443                    int toAdd = min(dh, (totalHeight * m_grid[r].logicalHeight.rawValue() / (100 * percentScaleFactor)) - rh);
    444444                    // If toAdd is negative, then we don't want to shrink the row (this bug
    445445                    // affected Outlook Web Access).
     
    447447                    add += toAdd;
    448448                    dh -= toAdd;
    449                     totalPercent -= m_grid[r].height.rawValue();
     449                    totalPercent -= m_grid[r].logicalHeight.rawValue();
    450450                }
    451451                if (r < totalRows - 1)
     
    458458            int add = 0;
    459459            for (int r = 0; r < totalRows; r++) {
    460                 if (numAuto > 0 && m_grid[r].height.isAuto()) {
     460                if (numAuto > 0 && m_grid[r].logicalHeight.isAuto()) {
    461461                    int toAdd = dh / numAuto;
    462462                    add += toAdd;
     
    491491        if (RenderTableRow* rowRenderer = m_grid[r].rowRenderer) {
    492492            rowRenderer->setLocation(0, m_rowPos[r]);
    493             rowRenderer->setWidth(width());
    494             rowRenderer->setHeight(m_rowPos[r + 1] - m_rowPos[r] - vspacing);
     493            rowRenderer->setLogicalWidth(logicalWidth());
     494            rowRenderer->setLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vspacing);
    495495        }
    496496
     
    519519            // bugs. :)
    520520            bool cellChildrenFlex = false;
    521             bool flexAllChildren = cell->style()->height().isFixed()
    522                 || (!table()->style()->height().isAuto() && rHeight != cell->height());
     521            bool flexAllChildren = cell->style()->logicalHeight().isFixed()
     522                || (!table()->style()->logicalHeight().isAuto() && rHeight != cell->logicalHeight());
    523523
    524524            for (RenderObject* o = cell->firstChild(); o; o = o->nextSibling()) {
    525                 if (!o->isText() && o->style()->height().isPercent() && (flexAllChildren || o->isReplaced() || (o->isBox() && toRenderBox(o)->scrollsOverflow()))) {
     525                if (!o->isText() && o->style()->logicalHeight().isPercent() && (flexAllChildren || o->isReplaced() || (o->isBox() && toRenderBox(o)->scrollsOverflow()))) {
    526526                    // Tables with no sections do not flex.
    527527                    if (!o->isTable() || toRenderTable(o)->hasSections()) {
     
    558558                // been resized based off its percentage.
    559559                cell->setOverrideSize(max(0,
    560                                            rHeight - cell->borderTop() - cell->paddingTop() -
    561                                                      cell->borderBottom() - cell->paddingBottom()));
     560                                           rHeight - cell->borderBefore() - cell->paddingBefore() -
     561                                                     cell->borderAfter() - cell->paddingAfter()));
    562562                cell->layoutIfNeeded();
    563                
     563
    564564                // If the baseline moved, we may have to update the data for our row. Find out the new baseline.
    565565                EVerticalAlign va = cell->style()->verticalAlign();
    566566                if (va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB) {
    567567                    int b = cell->baselinePosition();
    568                     if (b > cell->borderTop() + cell->paddingTop())
     568                    if (b > cell->borderBefore() + cell->paddingBefore())
    569569                        m_grid[r].baseline = max(m_grid[r].baseline, b);
    570570                }
    571571            }
    572            
    573             int oldTe = cell->intrinsicPaddingBefore();
    574             int oldBe = cell->intrinsicPaddingAfter();
    575             int heightWithoutIntrinsicPadding = cell->height() - oldTe - oldBe;
    576            
    577             int te = 0;
     572
     573            int oldIntrinsicPaddingBefore = cell->intrinsicPaddingBefore();
     574            int oldIntrinsicPaddingAfter = cell->intrinsicPaddingAfter();
     575            int logicalHeightWithoutIntrinsicPadding = cell->logicalHeight() - oldIntrinsicPaddingBefore - oldIntrinsicPaddingAfter;
     576
     577            int intrinsicPaddingBefore = 0;
    578578            switch (cell->style()->verticalAlign()) {
    579579                case SUB:
     
    583583                case BASELINE: {
    584584                    int b = cell->baselinePosition();
    585                     if (b > cell->borderTop() + cell->paddingTop())
    586                         te = getBaseline(r) - (b - oldTe);
     585                    if (b > cell->borderBefore() + cell->paddingBefore())
     586                        intrinsicPaddingBefore = getBaseline(r) - (b - oldIntrinsicPaddingBefore);
    587587                    break;
    588588                }
    589589                case TOP:
    590                     te = 0;
    591590                    break;
    592591                case MIDDLE:
    593                     te = (rHeight - heightWithoutIntrinsicPadding) / 2;
     592                    intrinsicPaddingBefore = (rHeight - logicalHeightWithoutIntrinsicPadding) / 2;
    594593                    break;
    595594                case BOTTOM:
    596                     te = rHeight - heightWithoutIntrinsicPadding;
     595                    intrinsicPaddingBefore = rHeight - logicalHeightWithoutIntrinsicPadding;
    597596                    break;
    598597                default:
     
    600599            }
    601600           
    602             int be = rHeight - heightWithoutIntrinsicPadding - te;
    603             cell->setIntrinsicPaddingBefore(te);
    604             cell->setIntrinsicPaddingAfter(be);
    605            
     601            int intrinsicPaddingAfter = rHeight - logicalHeightWithoutIntrinsicPadding - intrinsicPaddingBefore;
     602            cell->setIntrinsicPaddingBefore(intrinsicPaddingBefore);
     603            cell->setIntrinsicPaddingAfter(intrinsicPaddingAfter);
     604
    606605            IntRect oldCellRect(cell->x(), cell->y() , cell->width(), cell->height());
    607            
     606
    608607            if (!style()->isLeftToRightDirection())
    609                 cell->setLocation(table()->columnPositions()[nEffCols] - table()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + hspacing, m_rowPos[rindx]);
     608                cell->setLogicalLocation(table()->columnPositions()[nEffCols] - table()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + hspacing, m_rowPos[rindx]);
    610609            else
    611                 cell->setLocation(table()->columnPositions()[c] + hspacing, m_rowPos[rindx]);
     610                cell->setLogicalLocation(table()->columnPositions()[c] + hspacing, m_rowPos[rindx]);
    612611            view()->addLayoutDelta(IntSize(oldCellRect.x() - cell->x(), oldCellRect.y() - cell->y()));
    613612
    614             if (te != oldTe || be != oldBe)
     613            if (intrinsicPaddingBefore != oldIntrinsicPaddingBefore || intrinsicPaddingAfter != oldIntrinsicPaddingAfter)
    615614                cell->setNeedsLayout(true, false);
    616            
     615
    617616            if (!cell->needsLayout() && view()->layoutState()->m_pageHeight && view()->layoutState()->pageY(cell->y()) != cell->pageY())
    618617                cell->setChildNeedsLayout(true, false);
    619            
     618
    620619            cell->layoutIfNeeded();
    621            
    622             if (view()->layoutState()->m_pageHeight && cell->height() != rHeight)
     620
     621            // FIXME: Make pagination work with vertical tables.
     622            if (style()->isHorizontalWritingMode() && view()->layoutState()->m_pageHeight && cell->height() != rHeight)
    623623                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.
    624        
     624
    625625            IntSize childOffset(cell->x() - oldCellRect.x(), cell->y() - oldCellRect.y());
    626626            if (childOffset.width() || childOffset.height()) {
     
    642642    ASSERT(!needsLayout());
    643643
    644     setHeight(m_rowPos[totalRows]);
     644    setLogicalHeight(m_rowPos[totalRows]);
    645645
    646646    // Now that our height has been determined, add in overflow from cells.
     
    734734}
    735735
    736 int RenderTableSection::calcOuterBorderTop() const
     736int RenderTableSection::calcOuterBorderBefore() const
    737737{
    738738    int totalCols = table()->numEffCols();
     
    742742    unsigned borderWidth = 0;
    743743
    744     const BorderValue& sb = style()->borderTop();
     744    const BorderValue& sb = style()->borderBefore();
    745745    if (sb.style() == BHIDDEN)
    746746        return -1;
     
    748748        borderWidth = sb.width();
    749749
    750     const BorderValue& rb = firstChild()->style()->borderTop();
     750    const BorderValue& rb = firstChild()->style()->borderBefore();
    751751    if (rb.style() == BHIDDEN)
    752752        return -1;
     
    759759        if (current.inColSpan || !current.hasCells())
    760760            continue;
    761         const BorderValue& cb = current.primaryCell()->style()->borderTop();
     761        const BorderValue& cb = current.primaryCell()->style()->borderBefore(); // FIXME: Make this work with perpendicular and flipped cells.
    762762        // FIXME: Don't repeat for the same col group
    763763        RenderTableCol* colGroup = table()->colElement(c);
    764764        if (colGroup) {
    765             const BorderValue& gb = colGroup->style()->borderTop();
     765            const BorderValue& gb = colGroup->style()->borderBefore();
    766766            if (gb.style() == BHIDDEN || cb.style() == BHIDDEN)
    767767                continue;
     
    785785}
    786786
    787 int RenderTableSection::calcOuterBorderBottom() const
     787int RenderTableSection::calcOuterBorderAfter() const
    788788{
    789789    int totalCols = table()->numEffCols();
     
    793793    unsigned borderWidth = 0;
    794794
    795     const BorderValue& sb = style()->borderBottom();
     795    const BorderValue& sb = style()->borderAfter();
    796796    if (sb.style() == BHIDDEN)
    797797        return -1;
     
    799799        borderWidth = sb.width();
    800800
    801     const BorderValue& rb = lastChild()->style()->borderBottom();
     801    const BorderValue& rb = lastChild()->style()->borderAfter();
    802802    if (rb.style() == BHIDDEN)
    803803        return -1;
     
    810810        if (current.inColSpan || !current.hasCells())
    811811            continue;
    812         const BorderValue& cb = current.primaryCell()->style()->borderBottom();
     812        const BorderValue& cb = current.primaryCell()->style()->borderAfter(); // FIXME: Make this work with perpendicular and flipped cells.
    813813        // FIXME: Don't repeat for the same col group
    814814        RenderTableCol* colGroup = table()->colElement(c);
    815815        if (colGroup) {
    816             const BorderValue& gb = colGroup->style()->borderBottom();
     816            const BorderValue& gb = colGroup->style()->borderAfter();
    817817            if (gb.style() == BHIDDEN || cb.style() == BHIDDEN)
    818818                continue;
     
    836836}
    837837
    838 int RenderTableSection::calcOuterBorderLeft(bool rtl) const
     838int RenderTableSection::calcOuterBorderStart() const
    839839{
    840840    int totalCols = table()->numEffCols();
     
    844844    unsigned borderWidth = 0;
    845845
    846     const BorderValue& sb = style()->borderLeft();
     846    const BorderValue& sb = style()->borderStart();
    847847    if (sb.style() == BHIDDEN)
    848848        return -1;
     
    850850        borderWidth = sb.width();
    851851
    852     int leftmostColumn = rtl ? totalCols - 1 : 0;
    853     RenderTableCol* colGroup = table()->colElement(leftmostColumn);
    854     if (colGroup) {
    855         const BorderValue& gb = colGroup->style()->borderLeft();
     852    if (RenderTableCol* colGroup = table()->colElement(0)) {
     853        const BorderValue& gb = colGroup->style()->borderStart();
    856854        if (gb.style() == BHIDDEN)
    857855            return -1;
     
    862860    bool allHidden = true;
    863861    for (int r = 0; r < m_gridRows; r++) {
    864         const CellStruct& current = cellAt(r, leftmostColumn);
     862        const CellStruct& current = cellAt(r, 0);
    865863        if (!current.hasCells())
    866864            continue;
    867865        // FIXME: Don't repeat for the same cell
    868         const BorderValue& cb = current.primaryCell()->style()->borderLeft();
    869         const BorderValue& rb = current.primaryCell()->parent()->style()->borderLeft();
     866        const BorderValue& cb = current.primaryCell()->style()->borderStart(); // FIXME: Make this work with perpendicular and flipped cells.
     867        const BorderValue& rb = current.primaryCell()->parent()->style()->borderStart();
    870868        if (cb.style() == BHIDDEN || rb.style() == BHIDDEN)
    871869            continue;
     
    879877        return -1;
    880878
    881     return borderWidth / 2;
    882 }
    883 
    884 int RenderTableSection::calcOuterBorderRight(bool rtl) const
     879    return (borderWidth + (table()->style()->isLeftToRightDirection() ? 0 : 1)) / 2;
     880}
     881
     882int RenderTableSection::calcOuterBorderEnd() const
    885883{
    886884    int totalCols = table()->numEffCols();
     
    890888    unsigned borderWidth = 0;
    891889
    892     const BorderValue& sb = style()->borderRight();
     890    const BorderValue& sb = style()->borderEnd();
    893891    if (sb.style() == BHIDDEN)
    894892        return -1;
     
    896894        borderWidth = sb.width();
    897895
    898     int rightmostColumn = rtl ? 0 : totalCols - 1;
    899     RenderTableCol* colGroup = table()->colElement(rightmostColumn);
    900     if (colGroup) {
    901         const BorderValue& gb = colGroup->style()->borderRight();
     896    if (RenderTableCol* colGroup = table()->colElement(totalCols - 1)) {
     897        const BorderValue& gb = colGroup->style()->borderEnd();
    902898        if (gb.style() == BHIDDEN)
    903899            return -1;
     
    908904    bool allHidden = true;
    909905    for (int r = 0; r < m_gridRows; r++) {
    910         const CellStruct& current = cellAt(r, rightmostColumn);
     906        const CellStruct& current = cellAt(r, totalCols - 1);
    911907        if (!current.hasCells())
    912908            continue;
    913909        // FIXME: Don't repeat for the same cell
    914         const BorderValue& cb = current.primaryCell()->style()->borderRight();
    915         const BorderValue& rb = current.primaryCell()->parent()->style()->borderRight();
     910        const BorderValue& cb = current.primaryCell()->style()->borderEnd(); // FIXME: Make this work with perpendicular and flipped cells.
     911        const BorderValue& rb = current.primaryCell()->parent()->style()->borderEnd();
    916912        if (cb.style() == BHIDDEN || rb.style() == BHIDDEN)
    917913            continue;
     
    925921        return -1;
    926922
    927     return (borderWidth + 1) / 2;
     923    return (borderWidth + (table()->style()->isLeftToRightDirection() ? 1 : 0)) / 2;
    928924}
    929925
    930926void RenderTableSection::recalcOuterBorder()
    931927{
    932     bool rtl = !table()->style()->isLeftToRightDirection();
    933     m_outerBorderTop = calcOuterBorderTop();
    934     m_outerBorderBottom = calcOuterBorderBottom();
    935     m_outerBorderLeft = calcOuterBorderLeft(rtl);
    936     m_outerBorderRight = calcOuterBorderRight(rtl);
     928    m_outerBorderBefore = calcOuterBorderBefore();
     929    m_outerBorderAfter = calcOuterBorderAfter();
     930    m_outerBorderStart = calcOuterBorderStart();
     931    m_outerBorderEnd = calcOuterBorderEnd();
    937932}
    938933
     
    952947        RenderTableCell* cell = cs.primaryCell();
    953948        if (cell)
    954             firstLineBaseline = max(firstLineBaseline, cell->y() + cell->paddingTop() + cell->borderTop() + cell->contentHeight());
     949            firstLineBaseline = max(firstLineBaseline, cell->logicalTop() + cell->paddingBefore() + cell->borderBefore() + cell->contentLogicalHeight());
    955950    }
    956951
     
    989984void RenderTableSection::paintCell(RenderTableCell* cell, PaintInfo& paintInfo, int tx, int ty)
    990985{
     986    IntPoint cellPoint = flipForWritingMode(cell, IntPoint(tx, ty), ParentToChildFlippingAdjustment);
    991987    PaintPhase paintPhase = paintInfo.phase;
    992988    RenderTableRow* row = toRenderTableRow(cell->parent());
     
    10051001        // Note that we deliberately ignore whether or not the cell has a layer, since these backgrounds paint "behind" the
    10061002        // cell.
    1007         cell->paintBackgroundsBehindCell(paintInfo, tx, ty, colGroup);
    1008         cell->paintBackgroundsBehindCell(paintInfo, tx, ty, col);
     1003        cell->paintBackgroundsBehindCell(paintInfo, cellPoint.x(), cellPoint.y(), colGroup);
     1004        cell->paintBackgroundsBehindCell(paintInfo, cellPoint.x(), cellPoint.y(), col);
    10091005
    10101006        // Paint the row group next.
    1011         cell->paintBackgroundsBehindCell(paintInfo, tx, ty, this);
     1007        cell->paintBackgroundsBehindCell(paintInfo, cellPoint.x(), cellPoint.y(), this);
    10121008
    10131009        // Paint the row next, but only if it doesn't have a layer.  If a row has a layer, it will be responsible for
    10141010        // painting the row background for the cell.
    10151011        if (!row->hasSelfPaintingLayer())
    1016             cell->paintBackgroundsBehindCell(paintInfo, tx, ty, row);
     1012            cell->paintBackgroundsBehindCell(paintInfo, cellPoint.x(), cellPoint.y(), row);
    10171013    }
    10181014    if ((!cell->hasSelfPaintingLayer() && !row->hasSelfPaintingLayer()) || paintInfo.phase == PaintPhaseCollapsedTableBorders)
    1019         cell->paint(paintInfo, tx, ty);
    1020 
     1015        cell->paint(paintInfo, cellPoint.x(), cellPoint.y());
    10211016}
    10221017
     
    11411136            RenderTableRow* tableRow = toRenderTableRow(row);
    11421137            m_grid[m_cRow].rowRenderer = tableRow;
    1143             setRowHeightToRowStyleHeightIfNotRelative(&m_grid[m_cRow]);
     1138            setRowLogicalHeightToRowStyleLogicalHeightIfNotRelative(&m_grid[m_cRow]);
    11441139
    11451140            for (RenderObject* cell = row->firstChild(); cell; cell = cell->nextSibling()) {
  • trunk/WebCore/rendering/RenderTableSection.h

    r70170 r71382  
    4848    void addCell(RenderTableCell*, RenderTableRow* row);
    4949
    50     void setCellWidths();
    51     int calcRowHeight();
    52     int layoutRows(int height);
     50    void setCellLogicalWidths();
     51    int calcRowLogicalHeight();
     52    int layoutRows(int logicalHeight);
    5353
    5454    RenderTable* table() const { return toRenderTable(parent()); }
     
    8080        RenderTableRow* rowRenderer;
    8181        int baseline;
    82         Length height;
     82        Length logicalHeight;
    8383    };
    8484
     
    9494    void splitColumn(int pos, int first);
    9595
    96     int calcOuterBorderTop() const;
    97     int calcOuterBorderBottom() const;
    98     int calcOuterBorderLeft(bool rtl) const;
    99     int calcOuterBorderRight(bool rtl) const;
     96    int calcOuterBorderBefore() const;
     97    int calcOuterBorderAfter() const;
     98    int calcOuterBorderStart() const;
     99    int calcOuterBorderEnd() const;
    100100    void recalcOuterBorder();
    101101
    102     int outerBorderTop() const { return m_outerBorderTop; }
    103     int outerBorderBottom() const { return m_outerBorderBottom; }
    104     int outerBorderLeft() const { return m_outerBorderLeft; }
    105     int outerBorderRight() const { return m_outerBorderRight; }
     102    int outerBorderBefore() const { return m_outerBorderBefore; }
     103    int outerBorderAfter() const { return m_outerBorderAfter; }
     104    int outerBorderStart() const { return m_outerBorderStart; }
     105    int outerBorderEnd() const { return m_outerBorderEnd; }
    106106
    107107    int numRows() const { return m_gridRows; }
     
    164164    int m_cRow;
    165165
    166     int m_outerBorderLeft;
    167     int m_outerBorderRight;
    168     int m_outerBorderTop;
    169     int m_outerBorderBottom;
     166    int m_outerBorderStart;
     167    int m_outerBorderEnd;
     168    int m_outerBorderBefore;
     169    int m_outerBorderAfter;
    170170
    171171    bool m_needsCellRecalc;
Note: See TracChangeset for help on using the changeset viewer.