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

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: 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 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])
Julien - ping for review 2014/02/06 20:30:45 You misunderstood what I said: this code is equiva
a.suchit 2014/02/18 13:07:10 We are checking all the rows of rowspanning cell.
292 spanningRowsHeight.rowWithOnlySpanningCells |= rowHasOnlySpanningCel ls(actualRow); 292 spanningRowsHeight.rowWithOnlySpanningCells = rowHasOnlySpanningCell s(actualRow);
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 // if only spanning cells are present in spanning rows then apply height based on spanning cells.
546 // Here we are handling only row(s) who have only rowspanning cells and do not have any empty cell.
545 if (spanningRowsHeight.rowWithOnlySpanningCells) 547 if (spanningRowsHeight.rowWithOnlySpanningCells)
546 updateRowsHeightHavingOnlySpanningCells(cell, spanningRowsHeight); 548 updateRowsHeightHavingOnlySpanningCells(cell, spanningRowsHeight);
547 549
548 if (!spanningRowsHeight.totalRowsHeight || spanningRowsHeight.spanningCe llHeightIgnoringBorderSpacing <= spanningRowsHeight.totalRowsHeight) { 550 // else if total height of spanning rows are 0 then apply rowspanning ce lls height here.
551 // Here we are handling only row(s) who have rowspanning cell(s) and at least one empty cell.
Julien - ping for review 2014/02/06 20:30:45 I tried reading those comments several times but a
a.suchit 2014/02/18 13:07:10 Done.
552 if (!spanningRowsHeight.totalRowsHeight) {
553 if (spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing)
554 m_rowPos[rowIndex + rowSpan] += spanningRowsHeight.spanningCellH eightIgnoringBorderSpacing + borderSpacingForRow(rowIndex + rowSpan - 1);
Julien - ping for review 2014/02/06 20:30:45 This should be spanningCellEndIndex for consistenc
a.suchit 2014/02/18 13:07:10 Done.
555
549 extraHeightToPropagate = m_rowPos[rowIndex + rowSpan] - originalBefo rePosition; 556 extraHeightToPropagate = m_rowPos[rowIndex + rowSpan] - originalBefo rePosition;
550 continue; 557 continue;
Julien - ping for review 2014/02/06 20:30:45 My biggest issue with this code is that it will wr
551 } 558 }
552 559
560 if (spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing <= spanni ngRowsHeight.totalRowsHeight) {
561 extraHeightToPropagate = m_rowPos[rowIndex + rowSpan] - originalBefo rePosition;
Julien - ping for review 2014/02/06 20:30:45 How does this ensures that we allocate all of span
a.suchit 2014/02/18 13:07:10 Spanning rows total height is already more then th
562 continue;
563 }
564
565 // else distribute extra height in percent rows, auto rows and fixed row s respectively.
566 // Below we are handling only row(s) who have at least one visible cell without rowspan value.
553 int totalPercent = 0; 567 int totalPercent = 0;
554 int totalAutoRowsHeight = 0; 568 int totalAutoRowsHeight = 0;
555 int totalRemainingRowsHeight = spanningRowsHeight.totalRowsHeight; 569 int totalRemainingRowsHeight = spanningRowsHeight.totalRowsHeight;
556 570
557 // FIXME: Inner spanning cell height should not change if it have fixed height when it's parent spanning cell 571 // 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. 572 // is distributing it's extra height in rows.
559 573
560 // Calculate total percentage, total auto rows height and total rows hei ght except percent rows. 574 // Calculate total percentage, total auto rows height and total rows hei ght except percent rows.
561 for (unsigned row = rowIndex; row < spanningCellEndIndex; row++) { 575 for (unsigned row = rowIndex; row < spanningCellEndIndex; row++) {
562 if (m_grid[row].logicalHeight.isPercent()) { 576 if (m_grid[row].logicalHeight.isPercent()) {
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1730 else 1744 else
1731 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); 1745 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing);
1732 1746
1733 cell->setLogicalLocation(cellLocation); 1747 cell->setLogicalLocation(cellLocation);
1734 1748
1735 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) 1749 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled())
1736 view()->addLayoutDelta(oldCellLocation - cell->location()); 1750 view()->addLayoutDelta(oldCellLocation - cell->location());
1737 } 1751 }
1738 1752
1739 } // namespace WebCore 1753 } // 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