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

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

Issue 47923009: Table rows are incorrectly collapsed in case of hidden cells and rowspans. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review comments addressed Created 6 years, 10 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 | « Source/core/rendering/RenderTableSection.h ('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 252991e60cf6acc34738d8b7d07fb9f1342bc761..d0e9ba961b9e24556333e02eb4e43e5edbe99931 100644
--- a/Source/core/rendering/RenderTableSection.cpp
+++ b/Source/core/rendering/RenderTableSection.cpp
@@ -289,7 +289,7 @@ void RenderTableSection::populateSpanningRowsHeightFromCell(RenderTableCell* cel
spanningRowsHeight.rowHeight[row] = m_rowPos[actualRow + 1] - m_rowPos[actualRow] - borderSpacingForRow(actualRow);
if (!spanningRowsHeight.rowHeight[row])
- spanningRowsHeight.rowWithOnlySpanningCells |= rowHasOnlySpanningCells(actualRow);
+ spanningRowsHeight.isAnyRowWithOnlySpanningCells |= rowHasOnlySpanningCells(actualRow);
spanningRowsHeight.totalRowsHeight += spanningRowsHeight.rowHeight[row];
spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing -= borderSpacingForRow(actualRow);
@@ -542,14 +542,31 @@ void RenderTableSection::distributeRowSpanHeightToRows(SpanningRenderTableCells&
populateSpanningRowsHeightFromCell(cell, spanningRowsHeight);
- if (spanningRowsHeight.rowWithOnlySpanningCells)
+ // Here we are handling only row(s) who have only rowspanning cells and do not have any empty cell.
+ if (spanningRowsHeight.isAnyRowWithOnlySpanningCells)
updateRowsHeightHavingOnlySpanningCells(cell, spanningRowsHeight);
- if (!spanningRowsHeight.totalRowsHeight || spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing <= spanningRowsHeight.totalRowsHeight) {
+ // This code handle row(s) that have rowspanning cell(s) and at least one empty cell.
+ // Such rows are not handled below and end up having a height of 0. That would mean
+ // content overlapping if one of their cells has any content. To avoid the problem, we
+ // add all the remaining spanning cells' height to the last spanned row.
+ // This means that we could grow a row past its 'height' or break percentage spreading
+ // however this is better than overlapping content.
+ // FIXME: Is there a better algorithm?
+ if (!spanningRowsHeight.totalRowsHeight) {
+ if (spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing)
+ m_rowPos[spanningCellEndIndex] += spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing + borderSpacingForRow(spanningCellEndIndex - 1);
+
+ extraHeightToPropagate = m_rowPos[spanningCellEndIndex] - originalBeforePosition;
+ continue;
+ }
+
+ if (spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing <= spanningRowsHeight.totalRowsHeight) {
extraHeightToPropagate = m_rowPos[rowIndex + rowSpan] - originalBeforePosition;
continue;
}
+ // Below we are handling only row(s) who have at least one visible cell without rowspan value.
int totalPercent = 0;
int totalAutoRowsHeight = 0;
int totalRemainingRowsHeight = spanningRowsHeight.totalRowsHeight;
« no previous file with comments | « Source/core/rendering/RenderTableSection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698