table's text aligned on top instead of center because of rowspan
https://bugs.webkit.org/show_bug.cgi?id=18092
Patch by Suchit Agrawal <a.suchit@samsung.com> on 2013-04-22
Reviewed by Beth Dakin.
Source/WebCore:
Last row in the rowspan is not getting the height of rowspan cell because there is not
enough rows present below rowspan cell and we are strictly applying height of rowspan
to the row which should lay last in the rowspan based of rowspan value.
When row contains rowspan cell and it is last row of the table then
rowspan height is adding to last row of the table.
Test: fast/table/Rowspan-value-more-than-number-of-rows-present.html
It calculates logical height of the rows in the table.
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::calcRowLogicalHeight):
LayoutTests:
Added test cases, based on rowspan issue.
* fast/table/Rowspan-value-more-than-number-of-rows-present-expected.txt: Added.
* fast/table/Rowspan-value-more-than-number-of-rows-present.html: Added.
Test cases need to do rebaseline in efl, gtk and mac platforms.
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:
Test case results are updated in qt platform.
* platform/qt/fast/table/giantRowspan-expected.png:
* platform/qt/fast/table/giantRowspan-expected.txt:
* platform/qt/fast/table/giantRowspan2-expected.png:
* platform/qt/fast/table/giantRowspan2-expected.txt:
* platform/qt/tables/mozilla/bugs/bug133756-1-expected.png:
* platform/qt/tables/mozilla/bugs/bug133756-1-expected.txt:
* platform/qt/tables/mozilla/bugs/bug133756-2-expected.png:
* platform/qt/tables/mozilla/bugs/bug133756-2-expected.txt:
* platform/qt/tables/mozilla/bugs/bug220536-expected.png:
* platform/qt/tables/mozilla/bugs/bug220536-expected.txt:
* platform/qt/tables/mozilla/bugs/bug8858-expected.txt:
* platform/qt/tables/mozilla/core/bloomberg-expected.png:
* platform/qt/tables/mozilla/core/bloomberg-expected.txt:
* platform/qt/tables/mozilla/core/row_span-expected.png:
* platform/qt/tables/mozilla/core/row_span-expected.txt:
* platform/qt/tables/mozilla_expected_failures/bugs/bug131020-3-expected.txt:
* platform/qt/tables/mozilla_expected_failures/bugs/bug23847-expected.png:
* platform/qt/tables/mozilla_expected_failures/bugs/bug65372-expected.png:
* platform/qt/tables/mozilla_expected_failures/bugs/bug65372-expected.txt:
* tables/mozilla/core/bloomberg-expected.txt:
* tables/mozilla/core/row_span-expected.txt:
* tables/mozilla_expected_failures/bugs/bug131020-3-expected.txt:
* tables/mozilla_expected_failures/bugs/bug23847-expected.txt:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148944 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/rendering/RenderTableSection.cpp b/Source/WebCore/rendering/RenderTableSection.cpp
index 5c12fbd..3d51293 100644
--- a/Source/WebCore/rendering/RenderTableSection.cpp
+++ b/Source/WebCore/rendering/RenderTableSection.cpp
@@ -273,7 +273,9 @@
m_rowPos.resize(m_grid.size() + 1);
m_rowPos[0] = spacing;
- for (unsigned r = 0; r < m_grid.size(); r++) {
+ unsigned totalRows = m_grid.size();
+
+ for (unsigned r = 0; r < totalRows; r++) {
m_grid[r].baseline = 0;
LayoutUnit baselineDescent = 0;
@@ -292,8 +294,26 @@
// FIXME: We are always adding the height of a rowspan to the last rows which doesn't match
// other browsers. See webkit.org/b/52185 for example.
- if ((cell->rowIndex() + cell->rowSpan() - 1) != r)
- continue;
+ if ((cell->rowIndex() + cell->rowSpan() - 1) != r) {
+ // We will apply the height of the rowspan to the current row if next row is not valid.
+ if ((r + 1) < totalRows) {
+ unsigned col = 0;
+ CellStruct nextRowCell = cellAt(r + 1, col);
+
+ // We are trying to find that next row is valid or not.
+ while (nextRowCell.cells.size() && nextRowCell.cells[0]->rowSpan() > 1 && nextRowCell.cells[0]->rowIndex() < (r + 1)) {
+ col++;
+ if (col < totalCols)
+ nextRowCell = cellAt(r + 1, col);
+ else
+ break;
+ }
+
+ // We are adding the height of the rowspan to the current row if next row is not valid.
+ if (col < totalCols && nextRowCell.cells.size())
+ continue;
+ }
+ }
// For row spanning cells, |r| is the last row in the span.
unsigned cellStartRow = cell->rowIndex();