Fix the collapsing border code to handle mixed directionality at the row level
authorJulien Chaffraix <jchaffraix@webkit.org>
Mon, 5 Nov 2012 07:55:28 +0000 (07:55 +0000)
committerJulien Chaffraix <jchaffraix@webkit.org>
Mon, 5 Nov 2012 07:55:28 +0000 (07:55 +0000)
commit9603d870eb2d629d01cb2d96814ac2282851de83
treeb8b46ee79d5510633de4e7c22db77c892cf2f956
parentcabf3d3925dbb52a2550354f4226a23316a12aed
Fix the collapsing border code to handle mixed directionality at the row level
https://bugs.webkit.org/show_bug.cgi?id=101060

Reviewed by Ojan Vafai.

Source/WebCore:

After bug 87900, we support mixed directionality at the row-group level. For coherency
- as the underlying code didn't support it - we were artificially ignoring 'direction'
below the row-group. This change relaxes the restriction and patches the collapsing
borders code to query the right style and border.

Tests: fast/table/border-collapsing/table-ltr-rows-mixed-direction.html
       fast/table/border-collapsing/table-rtl-row-mixed-direction.html

* rendering/RenderTable.cpp:
(WebCore::RenderTable::tableStartBorderAdjoiningCell):
(WebCore::RenderTable::tableEndBorderAdjoiningCell):
Changed to query the row's direction.

* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::hasStartBorderAdjoiningTable):
(WebCore::RenderTableCell::hasEndBorderAdjoiningTable):
Added 2 helper functions. They determine if a specific cell's border
adjoins the table. This code is required as the last cell's end border
can be resolved against the start border.

(WebCore::RenderTableCell::computeCollapsedStartBorder):
(WebCore::RenderTableCell::computeCollapsedEndBorder):
Updated these functions now that being the start / end column doesn't mean
that we have to resolve against the row / row-group / table's border.

* rendering/RenderTableCell.h:
(WebCore::RenderTableCell::styleForCellFlow):
Updated to return the row's style.

* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::borderAdjoiningStartCell):
(WebCore::RenderTableRow::borderAdjoiningEndCell):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::borderAdjoiningStartCell):
(WebCore::RenderTableSection::borderAdjoiningEndCell):
Updated these functions to work with mixed directionality.

* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::setLogicalPositionForCell):
Changed this function to use the section's direction. This is wrong and should be changed
once we properly fix the collapsing border code.

(WebCore::RenderTableSection::logicalRectForWritingModeAndDirection):
Added a FIXME.

* rendering/style/CollapsedBorderValue.h:
(WebCore::CollapsedBorderValue::width):
This is a bug in our implementation: we used to return a non-zero width for inexistant borders (per CSS 2.1,
'border-style: off | hidden' should have a 0 width). This is covered by our existing tests (among others by
fast/table/border-collapsing/last-cell-left-border-hidden-table-ltr-section-rtl.html).

LayoutTests:

* fast/table/border-collapsing/table-ltr-rows-mixed-direction-expected.html: Added.
* fast/table/border-collapsing/table-ltr-rows-mixed-direction.html: Added.
* fast/table/border-collapsing/table-rtl-row-mixed-direction-expected.html: Added.
* fast/table/border-collapsing/table-rtl-row-mixed-direction.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@133439 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/table/border-collapsing/table-ltr-rows-mixed-direction-expected.html [new file with mode: 0755]
LayoutTests/fast/table/border-collapsing/table-ltr-rows-mixed-direction.html [new file with mode: 0755]
LayoutTests/fast/table/border-collapsing/table-rtl-row-mixed-direction-expected.html [new file with mode: 0755]
LayoutTests/fast/table/border-collapsing/table-rtl-row-mixed-direction.html [new file with mode: 0755]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTableCell.cpp
Source/WebCore/rendering/RenderTableCell.h
Source/WebCore/rendering/RenderTableRow.cpp
Source/WebCore/rendering/RenderTableSection.cpp
Source/WebCore/rendering/style/CollapsedBorderValue.h