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

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

Issue 19635004: Row spanning cell content is flowing out of the cell border if this row spanning cell comes under t… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@RowSpan_B249600_9
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/tables/mozilla/bugs/bug13169-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 524dc9b2620a52fae195c3218b14a2c2f0766ed6..7bd443359e355938b2044e683827cb9af469f036 100644
--- a/Source/core/rendering/RenderTableSection.cpp
+++ b/Source/core/rendering/RenderTableSection.cpp
@@ -369,12 +369,32 @@ void RenderTableSection::distributeExtraRowSpanHeightToRemainingRows(RenderTable
extraRowSpanningHeight -= accumulatedPositionIncrease;
}
+// To avoid unneeded extra height distributions, we apply the following sorting algorithm:
+// 1. We sort by increasing start row but decreasing last row (ie the top-most, shortest cells first).
+// 2. For cells spanning the same rows, we sort by intrinsic size.
+static bool compareRowSpanCellsInHeightDistributionOrder(const RenderTableCell* cell2, const RenderTableCell* cell1)
+{
+ unsigned cellRowIndex1 = cell1->rowIndex();
+ unsigned cellRowSpan1 = cell1->rowSpan();
+ unsigned cellRowIndex2 = cell2->rowIndex();
+ unsigned cellRowSpan2 = cell2->rowSpan();
+
+ if (cellRowIndex1 == cellRowIndex2 && cellRowSpan1 == cellRowSpan2)
+ return (cell2->logicalHeightForRowSizing() > cell1->logicalHeightForRowSizing());
+
+ return (cellRowIndex2 >= cellRowIndex1 && (cellRowIndex2 + cellRowSpan2) <= (cellRowIndex1 + cellRowSpan1));
+}
+
// Distribute rowSpan cell height in rows those comes in rowSpan cell based on the ratio of row's height if
// 1. RowSpan cell height is greater then the total height of rows in rowSpan cell
void RenderTableSection::distributeRowSpanHeightToRows(SpanningRenderTableCells& rowSpanCells)
{
ASSERT(rowSpanCells.size());
+ // 'rowSpanCells' list is already sorted based on the cells rowIndex in ascending order
+ // Arrange row spanning cell in the order in which we need to process first.
+ std::sort(rowSpanCells.begin(), rowSpanCells.end(), compareRowSpanCellsInHeightDistributionOrder);
+
unsigned extraHeightToPropagate = 0;
unsigned lastRowIndex = 0;
unsigned lastRowSpan = 0;
@@ -384,12 +404,13 @@ void RenderTableSection::distributeRowSpanHeightToRows(SpanningRenderTableCells&
unsigned rowIndex = cell->rowIndex();
- // 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)
+ unsigned rowSpan = cell->rowSpan();
+
+ // Only heightest spanning cell will distribute it's extra height in row if more then one spanning cells
+ // present at same level.
+ if (rowIndex == lastRowIndex && rowSpan == lastRowSpan)
continue;
- unsigned rowSpan = cell->rowSpan();
int originalBeforePosition = m_rowPos[rowIndex + rowSpan];
if (extraHeightToPropagate) {
@@ -411,6 +432,9 @@ void RenderTableSection::distributeRowSpanHeightToRows(SpanningRenderTableCells&
int totalAutoRowsHeight = 0;
int totalRemainingRowsHeight = spanningRowsHeight.totalRowsHeight;
+ // FIXME: Inner spanning cell height should not change if it have fixed height when it's parent spanning cell
+ // is distributing it's extra height in rows.
+
// 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()) {
« no previous file with comments | « LayoutTests/tables/mozilla/bugs/bug13169-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698