haikuwebkit/LayoutTests/fast/table/table-rtl-section-ltr-expec...

33 lines
925 B
HTML
Raw Permalink Normal View History

Add support for direction on table row group with collapsing borders https://bugs.webkit.org/show_bug.cgi?id=87900 Reviewed by Ojan Vafai. Source/WebCore: Tests: fast/table/border-collapsing/first-cell-left-border-hidden-table-ltr-section-rtl.html fast/table/border-collapsing/last-cell-left-border-hidden-table-ltr-section-rtl.html fast/table/border-collapsing/left-border-table-ltr-section-rtl.html fast/table/border-collapsing/left-border-table-rtl-section-ltr.html fast/table/border-collapsing/left-border-table-rtl-section-rtl.html fast/table/border-collapsing/left-border-vertical-lr-table-ltr-section-rtl.html fast/table/border-collapsing/left-border-vertical-lr-table-rtl-section-ltr.html fast/table/border-collapsing/left-border-vertical-lr-table-rtl-section-rtl.html fast/table/border-collapsing/rtl-table-left-border-hidden.html fast/table/border-collapsing/top-border-vertical-rl-table-ltr-section-rtl.html fast/table/border-collapsing/top-border-vertical-rl-table-rtl-section-ltr.html fast/table/border-collapsing/top-border-vertical-rl-table-rtl-section-rtl.html fast/table/table-ltr-section-rtl.html fast/table/table-rtl-section-ltr.html fast/table/table-rtl-section-rtl.html This change enables proper support for direction on table row group. The current code would allow people to set direction on the row group but would still use the table's code for directionality checks (with surprising consequences). The main change involve swapping end / start borders in case of mixed directionality as those 2 are not in sync. Example: <table dir="ltr"><tbody dir="rtl"><td id="cell0"></td><td id="cell1"></td></tbody></table> Visually: Table: Start ---------------------> End Tbody: End <---------------------- Start Cell: | #cell0 | #cell1 | In this example, the end table border should be compared with the tbody's start border and the last cell's (in DOM order) start border. * rendering/RenderTable.cpp: (WebCore::RenderTable::tableStartBorderAdjoiningCell): (WebCore::RenderTable::tableEndBorderAdjoiningCell): Same as the other adjoining functions. * rendering/RenderTable.h: (WebCore::RenderTable::lastColumnIndex): Helper function to get the last column index. * rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::computeCollapsedStartBorder): (WebCore::RenderTableCell::computeCollapsedEndBorder): Updated to call the table's adjoining border helpers. * rendering/RenderTableCell.h: (WebCore::RenderTableCell::styleForCellFlow): Updated to use the table row group's style now that we properly support it. (WebCore::RenderTableCell::isFirstOrLastCellInRow): Debug only helper to make sure we don't call the border adjoining function on non-terminal cells. (WebCore::RenderTableCell::borderAdjoiningTableStart): (WebCore::RenderTableCell::borderAdjoiningTableEnd): * rendering/RenderTableRow.h: (WebCore::RenderTableRow::borderAdjoiningTableStart): (WebCore::RenderTableRow::borderAdjoiningTableEnd): * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::firstRowCellAdjoiningTableStart): (WebCore::RenderTableSection::firstRowCellAdjoiningTableEnd): Updated the previous function to account for mixed directionality. (WebCore::RenderTableSection::layoutRows): Move some of the code to setLogicalPositionForCell to match RenderBlock. (WebCore::RenderTableSection::setLogicalPositionForCell): Switched direction checks to styleForCellFlow (this doesn't change anything as we were already properly flipping already but ensure better). * rendering/RenderTableSection.h: (WebCore::RenderTableSection::hasSameDirectionAsTable): Added this helper to know if we have a mixed direction. (WebCore::RenderTableSection::borderAdjoiningTableStart): (WebCore::RenderTableSection::borderAdjoiningTableEnd): Updated to account for mixed directionality. LayoutTests: * fast/table/border-collapsing/first-cell-left-border-hidden-table-ltr-section-rtl-expected.html: Added. * fast/table/border-collapsing/first-cell-left-border-hidden-table-ltr-section-rtl.html: Added. * fast/table/border-collapsing/last-cell-left-border-hidden-table-ltr-section-rtl-expected.html: Added. * fast/table/border-collapsing/last-cell-left-border-hidden-table-ltr-section-rtl.html: Added. * fast/table/border-collapsing/left-border-table-ltr-section-rtl-expected.html: Added. * fast/table/border-collapsing/left-border-table-ltr-section-rtl.html: Added. * fast/table/border-collapsing/left-border-table-rtl-section-ltr-expected.html: Added. * fast/table/border-collapsing/left-border-table-rtl-section-ltr.html: Added. * fast/table/border-collapsing/left-border-table-rtl-section-rtl-expected.html: Added. * fast/table/border-collapsing/left-border-table-rtl-section-rtl.html: Added. * fast/table/border-collapsing/left-border-vertical-lr-table-ltr-section-rtl-expected.html: Added. * fast/table/border-collapsing/left-border-vertical-lr-table-ltr-section-rtl.html: Added. * fast/table/border-collapsing/left-border-vertical-lr-table-rtl-section-ltr-expected.html: Added. * fast/table/border-collapsing/left-border-vertical-lr-table-rtl-section-ltr.html: Added. * fast/table/border-collapsing/left-border-vertical-lr-table-rtl-section-rtl-expected.html: Added. * fast/table/border-collapsing/left-border-vertical-lr-table-rtl-section-rtl.html: Added. * fast/table/border-collapsing/rtl-table-left-border-hidden-expected.html: Added. * fast/table/border-collapsing/rtl-table-left-border-hidden.html: Added. * fast/table/border-collapsing/top-border-vertical-rl-table-ltr-section-rtl-expected.html: Added. * fast/table/border-collapsing/top-border-vertical-rl-table-ltr-section-rtl.html: Added. * fast/table/border-collapsing/top-border-vertical-rl-table-rtl-section-ltr-expected.html: Added. * fast/table/border-collapsing/top-border-vertical-rl-table-rtl-section-ltr.html: Added. * fast/table/border-collapsing/top-border-vertical-rl-table-rtl-section-rtl-expected.html: Added. * fast/table/border-collapsing/top-border-vertical-rl-table-rtl-section-rtl.html: Added. Most of those are test are a variation of direction on table and row group along with disabling some borders (either using 'hidden' or just disabling it by setting it to 0px). * fast/table/table-ltr-section-rtl-expected.html: Added. * fast/table/table-ltr-section-rtl.html: Added. * fast/table/table-rtl-section-ltr-expected.html: Added. * fast/table/table-rtl-section-ltr.html: Added. * fast/table/table-rtl-section-rtl-expected.html: Added. * fast/table/table-rtl-section-rtl.html: Added. Bonus as there was little testing for mixed direction + separate borders. Canonical link: https://commits.webkit.org/106256@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119594 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-06-06 16:07:16 +00:00
<!DOCTYPE html>
<html>
<body>
<style>
table td
{
border: 5px solid green;
border-left: 0px;
}
table
{
border-collapse: separate;
border-spacing: 0px;
}
td {
height: 20px;
width: 120px;
padding: 0px;
}
</style>
<p>Test for bug <a href="https://bugs.webkit.org/show_bug.cgi?id=87900">87900</a>: Add support for direction on table row group with collapsing borders</p>
<p>This test checks that a rtl table with a ltr row group properly compute its separate borders when the left borders are disabled.</p>
<p>For this test to pass, there should be only green borders on the cells and no left border on the table.</p>
<table>
<tbody>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</body></html>