Centralize and clean-up table column iteration
authorjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 May 2012 16:43:48 +0000 (16:43 +0000)
committerjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 May 2012 16:43:48 +0000 (16:43 +0000)
commit28b658d0c4a25c42cc3cd09e5c0c404a051d2a29
treed5093a82e9e6b453afaf4f298e5d7d88434e9822
parent5ff62619f70f7b25b3b86833df1ab4d48ab7ca8a
Centralize and clean-up table column iteration
https://bugs.webkit.org/show_bug.cgi?id=87051

Reviewed by Eric Seidel.

Source/WebCore:

Tests: fast/table/caption-between-column-and-column-group.html
       fast/table/caption-between-column-group-and-column.html
       fast/table/caption-between-columns.html

The existing code had duplications between different classes and some
of the iterating functions could use a better place. That's what this
change solves, along with several renamings.

* rendering/RenderTableCol.h:
(WebCore::RenderTableCol::isTableColumnGroupWithColumnChildren):
Renamed isTableColGroup to this to better reflect what it checks.
Also added a new function: nextColumn.

* rendering/FixedTableLayout.cpp:
(WebCore::FixedTableLayout::calcWidthArray):
Updated after isTableColGroup renaming.

* rendering/RenderTable.cpp:
(WebCore::RenderTable::firstColumn):
Added this new function to get the first column (or column group).

(WebCore::RenderTable::colElement):
Cleaned up this function: switched the loop to a 'for' now that the
helper functions make it easy. Cleaned up the ordering and the naming.

* rendering/RenderTable.h:
Added firstColumn.

* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::styleOrColLogicalWidth):
Updated to use nextColumn().

* rendering/RenderTableCol.cpp:
(WebCore::RenderTableCol::nextColumn):
Added this new helper function to centralize the code to iterate over columns.

LayoutTests:

Those tests just validate and enforce what we were already doing that were
not covered by any existing tests.

* fast/table/caption-between-column-and-column-group-expected.html: Added.
* fast/table/caption-between-column-and-column-group.html: Added.
* fast/table/caption-between-column-group-and-column-expected.html: Added.
* fast/table/caption-between-column-group-and-column.html: Added.
* fast/table/caption-between-columns-expected.html: Added.
* fast/table/caption-between-columns.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@117988 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/table/caption-between-column-and-column-group-expected.html [new file with mode: 0644]
LayoutTests/fast/table/caption-between-column-and-column-group.html [new file with mode: 0644]
LayoutTests/fast/table/caption-between-column-group-and-column-expected.html [new file with mode: 0644]
LayoutTests/fast/table/caption-between-column-group-and-column.html [new file with mode: 0644]
LayoutTests/fast/table/caption-between-columns-expected.html [new file with mode: 0644]
LayoutTests/fast/table/caption-between-columns.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/FixedTableLayout.cpp
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTable.h
Source/WebCore/rendering/RenderTableCell.cpp
Source/WebCore/rendering/RenderTableCol.cpp
Source/WebCore/rendering/RenderTableCol.h