Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1302)

Unified Diff: Source/core/rendering/RenderTableSection.cpp

Issue 19390002: Spanning logical height is not added properly in all spanning rows. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@RowSpan_B254914_6
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/platform/win/tables/mozilla/bugs/bug7714-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderTableSection.cpp
diff --git a/Source/core/rendering/RenderTableSection.cpp b/Source/core/rendering/RenderTableSection.cpp
index ac082fecea58f7162f19913635a2b88298001543..765b35e238ac819d6edba8188fcf0df6bf4c88cc 100644
--- a/Source/core/rendering/RenderTableSection.cpp
+++ b/Source/core/rendering/RenderTableSection.cpp
@@ -375,51 +375,68 @@ void RenderTableSection::distributeRowSpanHeightToRows(SpanningRenderTableCells&
{
ASSERT(rowSpanCells.size());
- // FIXME: For now, we handle the first rowspan cell in the table but this is wrong.
- RenderTableCell* cell = rowSpanCells[0];
+ unsigned extraHeightToPropagate = 0;
+ unsigned lastRowIndex = 0;
+ unsigned lastRowSpan = 0;
- unsigned rowSpan = cell->rowSpan();
+ for (unsigned i = 0; i < rowSpanCells.size(); i++) {
+ RenderTableCell* cell = rowSpanCells[i];
- struct SpanningRowsHeight spanningRowsHeight;
+ unsigned rowIndex = cell->rowIndex();
- populateSpanningRowsHeightFromCell(cell, spanningRowsHeight);
-
- if (!spanningRowsHeight.totalRowsHeight || spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing <= spanningRowsHeight.totalRowsHeight)
- return;
+ // FIXME: For now, we are handling only rowspan cells those are not overlapping with other
+ // rowspan cells but this is wrong.
+ if (rowIndex < lastRowIndex + lastRowSpan)
+ continue;
- unsigned rowIndex = cell->rowIndex();
- int totalPercent = 0;
- int totalAutoRowsHeight = 0;
- int totalRemainingRowsHeight = spanningRowsHeight.totalRowsHeight;
+ unsigned rowSpan = cell->rowSpan();
+ int originalBeforePosition = m_rowPos[rowIndex + rowSpan];
- // Calculate total percentage, total auto rows height and total rows height except percent rows.
- for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) {
- if (m_grid[row].logicalHeight.isPercent()) {
- totalPercent += m_grid[row].logicalHeight.percent();
- totalRemainingRowsHeight -= spanningRowsHeight.rowHeight[row - rowIndex];
- } else if (m_grid[row].logicalHeight.isAuto()) {
- totalAutoRowsHeight += spanningRowsHeight.rowHeight[row - rowIndex];
+ if (extraHeightToPropagate) {
+ for (unsigned row = lastRowIndex + lastRowSpan + 1; row <= rowIndex + rowSpan; row++)
+ m_rowPos[row] += extraHeightToPropagate;
}
- }
- int initialPos = m_rowPos[rowIndex + rowSpan];
- int extraRowSpanningHeight = spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing - spanningRowsHeight.totalRowsHeight;
+ lastRowIndex = rowIndex;
+ lastRowSpan = rowSpan;
+
+ struct SpanningRowsHeight spanningRowsHeight;
+
+ populateSpanningRowsHeightFromCell(cell, spanningRowsHeight);
- distributeExtraRowSpanHeightToPercentRows(cell, totalPercent, extraRowSpanningHeight, spanningRowsHeight.rowHeight);
- distributeExtraRowSpanHeightToAutoRows(cell, totalAutoRowsHeight, extraRowSpanningHeight, spanningRowsHeight.rowHeight);
- distributeExtraRowSpanHeightToRemainingRows(cell, totalRemainingRowsHeight, extraRowSpanningHeight, spanningRowsHeight.rowHeight);
+ if (!spanningRowsHeight.totalRowsHeight || spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing <= spanningRowsHeight.totalRowsHeight)
+ continue;
+
+ int totalPercent = 0;
+ int totalAutoRowsHeight = 0;
+ int totalRemainingRowsHeight = spanningRowsHeight.totalRowsHeight;
+
+ // Calculate total percentage, total auto rows height and total rows height except percent rows.
+ for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) {
+ if (m_grid[row].logicalHeight.isPercent()) {
+ totalPercent += m_grid[row].logicalHeight.percent();
+ totalRemainingRowsHeight -= spanningRowsHeight.rowHeight[row - rowIndex];
+ } else if (m_grid[row].logicalHeight.isAuto()) {
+ totalAutoRowsHeight += spanningRowsHeight.rowHeight[row - rowIndex];
+ }
+ }
- ASSERT(!extraRowSpanningHeight);
+ int extraRowSpanningHeight = spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing - spanningRowsHeight.totalRowsHeight;
- // Getting total changed height in the table
- unsigned changedHeight = m_rowPos[rowIndex + rowSpan] - initialPos;
+ distributeExtraRowSpanHeightToPercentRows(cell, totalPercent, extraRowSpanningHeight, spanningRowsHeight.rowHeight);
+ distributeExtraRowSpanHeightToAutoRows(cell, totalAutoRowsHeight, extraRowSpanningHeight, spanningRowsHeight.rowHeight);
+ distributeExtraRowSpanHeightToRemainingRows(cell, totalRemainingRowsHeight, extraRowSpanningHeight, spanningRowsHeight.rowHeight);
- if (changedHeight) {
- unsigned totalRows = m_grid.size();
+ ASSERT(!extraRowSpanningHeight);
+
+ // Getting total changed height in the table
+ extraHeightToPropagate = m_rowPos[rowIndex + rowSpan] - originalBeforePosition;
+ }
+ if (extraHeightToPropagate) {
// Apply changed height by rowSpan cells to rows present at the end of the table
- for (unsigned row = rowIndex + rowSpan + 1; row <= totalRows; row++)
- m_rowPos[row] += changedHeight;
+ for (unsigned row = lastRowIndex + lastRowSpan + 1; row <= m_grid.size(); row++)
+ m_rowPos[row] += extraHeightToPropagate;
}
}
« no previous file with comments | « LayoutTests/platform/win/tables/mozilla/bugs/bug7714-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698