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

Side by Side 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: Patch updated Created 6 years, 9 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/platform/win/tables/mozilla/bugs/bug220536-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org) 3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org) 4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 const unsigned rowIndex = cell->rowIndex(); 281 const unsigned rowIndex = cell->rowIndex();
282 282
283 spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing = cell->logicalHe ightForRowSizing(); 283 spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing = cell->logicalHe ightForRowSizing();
284 284
285 spanningRowsHeight.rowHeight.resize(rowSpan); 285 spanningRowsHeight.rowHeight.resize(rowSpan);
286 spanningRowsHeight.totalRowsHeight = 0; 286 spanningRowsHeight.totalRowsHeight = 0;
287 for (unsigned row = 0; row < rowSpan; row++) { 287 for (unsigned row = 0; row < rowSpan; row++) {
288 unsigned actualRow = row + rowIndex; 288 unsigned actualRow = row + rowIndex;
289 289
290 spanningRowsHeight.rowHeight[row] = m_rowPos[actualRow + 1] - m_rowPos[a ctualRow] - borderSpacingForRow(actualRow); 290 spanningRowsHeight.rowHeight[row] = m_rowPos[actualRow + 1] - m_rowPos[a ctualRow] - borderSpacingForRow(actualRow);
291 if (!spanningRowsHeight.rowHeight[row]) 291 if (!spanningRowsHeight.rowWithOnlySpanningCells && !spanningRowsHeight. rowHeight[row])
292 spanningRowsHeight.rowWithOnlySpanningCells |= rowHasOnlySpanningCel ls(actualRow); 292 spanningRowsHeight.rowWithOnlySpanningCells = rowHasOnlySpanningCell s(actualRow);
Julien - ping for review 2014/02/26 22:29:31 As mentioned previously, this change should be rem
a.suchit 2014/03/03 12:28:31 change variable name |rowWithOnlySpanningCells| to
293 293
294 spanningRowsHeight.totalRowsHeight += spanningRowsHeight.rowHeight[row]; 294 spanningRowsHeight.totalRowsHeight += spanningRowsHeight.rowHeight[row];
295 spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing -= borderSpac ingForRow(actualRow); 295 spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing -= borderSpac ingForRow(actualRow);
296 } 296 }
297 // We don't span the following row so its border-spacing (if any) should be included. 297 // We don't span the following row so its border-spacing (if any) should be included.
298 spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing += borderSpacingF orRow(rowIndex + rowSpan - 1); 298 spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing += borderSpacingF orRow(rowIndex + rowSpan - 1);
299 } 299 }
300 300
301 void RenderTableSection::distributeExtraRowSpanHeightToPercentRows(RenderTableCe ll* cell, int totalPercent, int& extraRowSpanningHeight, Vector<int>& rowsHeight ) 301 void RenderTableSection::distributeExtraRowSpanHeightToPercentRows(RenderTableCe ll* cell, int totalPercent, int& extraRowSpanningHeight, Vector<int>& rowsHeight )
302 { 302 {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 m_rowPos[row] += extraHeightToPropagate; 535 m_rowPos[row] += extraHeightToPropagate;
536 } 536 }
537 537
538 lastRowIndex = rowIndex; 538 lastRowIndex = rowIndex;
539 lastRowSpan = rowSpan; 539 lastRowSpan = rowSpan;
540 540
541 struct SpanningRowsHeight spanningRowsHeight; 541 struct SpanningRowsHeight spanningRowsHeight;
542 542
543 populateSpanningRowsHeightFromCell(cell, spanningRowsHeight); 543 populateSpanningRowsHeightFromCell(cell, spanningRowsHeight);
544 544
545 // Here we are handling only row(s) who have only rowspanning cells and do not have any empty cell.
545 if (spanningRowsHeight.rowWithOnlySpanningCells) 546 if (spanningRowsHeight.rowWithOnlySpanningCells)
546 updateRowsHeightHavingOnlySpanningCells(cell, spanningRowsHeight); 547 updateRowsHeightHavingOnlySpanningCells(cell, spanningRowsHeight);
547 548
548 if (!spanningRowsHeight.totalRowsHeight || spanningRowsHeight.spanningCe llHeightIgnoringBorderSpacing <= spanningRowsHeight.totalRowsHeight) { 549 // Here we are handling only row(s) who have rowspanning cell(s) and at least one empty cell.
550 // We are not considered the row as rowWithOnlySpanningCells when row co ntains spanningcells and
551 // at least one empty cell. So These type of rows does not get any heigh t. And when any spanning cell
552 // present with only such type of rows than spanning cell height becomes 0. In this senario, text
553 // present in spanning cells will overlap with other cells because it do n't have any height.
554 // Spanning cell should have at least the height of the text present in spanning cell. So in place of
555 // distributing this height in all the spanning rows, we can give this h eight to one of the row of
556 // spanning cell because finally it have to look as one cell.
557 // So here, we are giving text'height of spanning cell to the last row o f spanning cell.
Julien - ping for review 2014/02/26 22:29:31 First and this is a recurring issue, I have a hard
a.suchit 2014/03/03 12:28:31 Done.
558 if (!spanningRowsHeight.totalRowsHeight) {
559 if (spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing)
560 m_rowPos[spanningCellEndIndex] += spanningRowsHeight.spanningCel lHeightIgnoringBorderSpacing + borderSpacingForRow(spanningCellEndIndex - 1);
561
562 extraHeightToPropagate = m_rowPos[spanningCellEndIndex] - originalBe forePosition;
563 continue;
564 }
565
566 if (spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing <= spanni ngRowsHeight.totalRowsHeight) {
549 extraHeightToPropagate = m_rowPos[rowIndex + rowSpan] - originalBefo rePosition; 567 extraHeightToPropagate = m_rowPos[rowIndex + rowSpan] - originalBefo rePosition;
550 continue; 568 continue;
551 } 569 }
552 570
571 // Below we are handling only row(s) who have at least one visible cell without rowspan value.
553 int totalPercent = 0; 572 int totalPercent = 0;
554 int totalAutoRowsHeight = 0; 573 int totalAutoRowsHeight = 0;
555 int totalRemainingRowsHeight = spanningRowsHeight.totalRowsHeight; 574 int totalRemainingRowsHeight = spanningRowsHeight.totalRowsHeight;
556 575
557 // FIXME: Inner spanning cell height should not change if it have fixed height when it's parent spanning cell 576 // FIXME: Inner spanning cell height should not change if it have fixed height when it's parent spanning cell
558 // is distributing it's extra height in rows. 577 // is distributing it's extra height in rows.
559 578
560 // Calculate total percentage, total auto rows height and total rows hei ght except percent rows. 579 // Calculate total percentage, total auto rows height and total rows hei ght except percent rows.
561 for (unsigned row = rowIndex; row < spanningCellEndIndex; row++) { 580 for (unsigned row = rowIndex; row < spanningCellEndIndex; row++) {
562 if (m_grid[row].logicalHeight.isPercent()) { 581 if (m_grid[row].logicalHeight.isPercent()) {
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 else 1729 else
1711 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); 1730 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing);
1712 1731
1713 cell->setLogicalLocation(cellLocation); 1732 cell->setLogicalLocation(cellLocation);
1714 1733
1715 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) 1734 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled())
1716 view()->addLayoutDelta(oldCellLocation - cell->location()); 1735 view()->addLayoutDelta(oldCellLocation - cell->location());
1717 } 1736 }
1718 1737
1719 } // namespace WebCore 1738 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/platform/win/tables/mozilla/bugs/bug220536-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698