Title: [122408] trunk
- Revision
- 122408
- Author
- [email protected]
- Date
- 2012-07-11 19:38:38 -0700 (Wed, 11 Jul 2012)
Log Message
When a table row height grows because of pagination, not all cells’ heights are adjusted
https://bugs.webkit.org/show_bug.cgi?id=91043
Reviewed by Sam Weinig.
Source/WebCore:
The fix for in bug <http://webkit.org/b/83595> in <http://trac.webkit.org/r113738> made table
rows grow as necessary to fit cells that grow as a result of pagination. But it had two bad
side effects: earlier cells on the row would not grow by the same amount, and later cells on
the row would factor the existing growth into their intrinsic padding.
Test: fast/multicol/table-row-height-increase.html
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::layoutRows): Now when a cell becomes taller than the row height,
the additional height needed is recorded, and the cell is shrunk back to row height. Then
after finishing the row, all cells occurring on the row (including cells spanning it but not
starting on it) are grown by the same amount.
LayoutTests:
* fast/multicol/table-row-height-increase-expected.html: Added.
* fast/multicol/table-row-height-increase.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (122407 => 122408)
--- trunk/LayoutTests/ChangeLog 2012-07-12 02:28:44 UTC (rev 122407)
+++ trunk/LayoutTests/ChangeLog 2012-07-12 02:38:38 UTC (rev 122408)
@@ -1,3 +1,13 @@
+2012-07-11 Dan Bernstein <[email protected]>
+
+ When a table row height grows because of pagination, not all cells’ heights are adjusted
+ https://bugs.webkit.org/show_bug.cgi?id=91043
+
+ Reviewed by Sam Weinig.
+
+ * fast/multicol/table-row-height-increase-expected.html: Added.
+ * fast/multicol/table-row-height-increase.html: Added.
+
2012-07-11 Ojan Vafai <[email protected]>
Rebaseline after http://trac.webkit.org/changeset/122374.
Added: trunk/LayoutTests/fast/multicol/table-row-height-increase-expected.html (0 => 122408)
--- trunk/LayoutTests/fast/multicol/table-row-height-increase-expected.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/table-row-height-increase-expected.html 2012-07-12 02:38:38 UTC (rev 122408)
@@ -0,0 +1,25 @@
+<style>
+td {
+ background-color: green;
+ vertical-align: top;
+ font-family: ahem;
+ font-size: 20px;
+ color: rgba(0, 0, 0, .5);
+}
+
+</style>
+<div style="width: 480px; -webkit-column-count: 2; -webkit-column-gap: 0; height: 60px;">
+ <table cellpadding=0 cellspacing=0 style="background-color: green;">
+ <tr style="height: 30px;">
+ <td style="width: 60px;" rowspan=2></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td style="width: 60px;"></td>
+ <td style="width: 60px;">abc def</td>
+ <td style="width: 60px;">abc def</td>
+ </tr>
+ </table>
+</div>
Added: trunk/LayoutTests/fast/multicol/table-row-height-increase.html (0 => 122408)
--- trunk/LayoutTests/fast/multicol/table-row-height-increase.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/table-row-height-increase.html 2012-07-12 02:38:38 UTC (rev 122408)
@@ -0,0 +1,25 @@
+<style>
+td {
+ background-color: green;
+ vertical-align: top;
+ font-family: ahem;
+ font-size: 20px;
+ color: rgba(0, 0, 0, .5);
+}
+
+</style>
+<div style="width: 480px; -webkit-column-count: 2; -webkit-column-gap: 0; height: 60px;">
+ <table cellpadding=0 cellspacing=0 style="background-color: red;">
+ <tr style="height: 30px;">
+ <td style="width: 60px;" rowspan=2></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td style="width: 60px;"></td>
+ <td style="width: 60px;">abc def</td>
+ <td style="width: 60px;">abc def</td>
+ </tr>
+ </table>
+</div>
Modified: trunk/Source/WebCore/ChangeLog (122407 => 122408)
--- trunk/Source/WebCore/ChangeLog 2012-07-12 02:28:44 UTC (rev 122407)
+++ trunk/Source/WebCore/ChangeLog 2012-07-12 02:38:38 UTC (rev 122408)
@@ -1,3 +1,23 @@
+2012-07-11 Dan Bernstein <[email protected]>
+
+ When a table row height grows because of pagination, not all cells’ heights are adjusted
+ https://bugs.webkit.org/show_bug.cgi?id=91043
+
+ Reviewed by Sam Weinig.
+
+ The fix for in bug <http://webkit.org/b/83595> in <http://trac.webkit.org/r113738> made table
+ rows grow as necessary to fit cells that grow as a result of pagination. But it had two bad
+ side effects: earlier cells on the row would not grow by the same amount, and later cells on
+ the row would factor the existing growth into their intrinsic padding.
+
+ Test: fast/multicol/table-row-height-increase.html
+
+ * rendering/RenderTableSection.cpp:
+ (WebCore::RenderTableSection::layoutRows): Now when a cell becomes taller than the row height,
+ the additional height needed is recorded, and the cell is shrunk back to row height. Then
+ after finishing the row, all cells occurring on the row (including cells spanning it but not
+ starting on it) are grown by the same amount.
+
2012-07-11 Mark Rowe <[email protected]>
<http://webkit.org/b/91024> Build against the latest SDK when targeting older OS X versions.
Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (122407 => 122408)
--- trunk/Source/WebCore/rendering/RenderTableSection.cpp 2012-07-12 02:28:44 UTC (rev 122407)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp 2012-07-12 02:38:38 UTC (rev 122408)
@@ -547,6 +547,8 @@
rowRenderer->updateLayerTransform();
}
+ int rowHeightIncreaseForPagination = 0;
+
for (unsigned c = 0; c < nEffCols; c++) {
CellStruct& cs = cellAt(r, c);
RenderTableCell* cell = cs.primaryCell();
@@ -671,13 +673,9 @@
// FIXME: Pagination might have made us change size. For now just shrink or grow the cell to fit without doing a relayout.
// We'll also do a basic increase of the row height to accommodate the cell if it's bigger, but this isn't quite right
// either. It's at least stable though and won't result in an infinite # of relayouts that may never stabilize.
- if (cell->logicalHeight() > rHeight) {
- unsigned delta = cell->logicalHeight() - rHeight;
- for (unsigned rowIndex = rindx + cell->rowSpan(); rowIndex <= totalRows; rowIndex++)
- m_rowPos[rowIndex] += delta;
- rHeight = cell->logicalHeight();
- } else
- cell->setLogicalHeight(rHeight);
+ if (cell->logicalHeight() > rHeight)
+ rowHeightIncreaseForPagination = max<int>(rowHeightIncreaseForPagination, cell->logicalHeight() - rHeight);
+ cell->setLogicalHeight(rHeight);
}
LayoutSize childOffset(cell->location() - oldCellRect.location());
@@ -691,6 +689,15 @@
cell->repaintDuringLayoutIfMoved(oldCellRect);
}
}
+ if (rowHeightIncreaseForPagination) {
+ for (unsigned rowIndex = r + 1; rowIndex <= totalRows; rowIndex++)
+ m_rowPos[rowIndex] += rowHeightIncreaseForPagination;
+ for (unsigned c = 0; c < nEffCols; ++c) {
+ Vector<RenderTableCell*, 1>& cells = cellAt(r, c).cells;
+ for (size_t i = 0; i < cells.size(); ++i)
+ cells[i]->setLogicalHeight(cells[i]->logicalHeight() + rowHeightIncreaseForPagination);
+ }
+ }
}
#ifndef NDEBUG
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes