Chromium Code Reviews| OLD | NEW | 
|---|---|
| 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 413 if (cellIsFullyIncludedInOtherCell(cell1, cell2)) | 413 if (cellIsFullyIncludedInOtherCell(cell1, cell2)) | 
| 414 return true; | 414 return true; | 
| 415 // Sorting lower row index first because first we need to apply the extra he ight of spanning cell which | 415 // Sorting lower row index first because first we need to apply the extra he ight of spanning cell which | 
| 416 // comes first in the table so lower rows's position would increment in sequ ence. | 416 // comes first in the table so lower rows's position would increment in sequ ence. | 
| 417 if (cellIsFullyIncludedInOtherCell(cell2, cell1)) | 417 if (cellIsFullyIncludedInOtherCell(cell2, cell1)) | 
| 418 return (cell1->rowIndex() < cell2->rowIndex()); | 418 return (cell1->rowIndex() < cell2->rowIndex()); | 
| 419 | 419 | 
| 420 return false; | 420 return false; | 
| 421 } | 421 } | 
| 422 | 422 | 
| 423 bool RenderTableSection::isHeightNeededForRowHavingOnlySpanningCells(unsigned ro w) | |
| 424 { | |
| 425 unsigned totalCols = m_grid[row].row.size(); | |
| 426 | |
| 427 if (!totalCols) | |
| 428 return false; | |
| 429 | |
| 430 for (unsigned col = 0; col < totalCols; col++) { | |
| 431 const CellStruct& rowSpanCell = cellAt(row, col); | |
| 432 | |
| 433 if (rowSpanCell.cells.size()) { | |
| 434 RenderTableCell* cell = rowSpanCell.cells[0]; | |
| 435 const unsigned rowIndex = cell->rowIndex(); | |
| 436 const unsigned rowSpan = cell->rowSpan(); | |
| 437 unsigned totalRowSpanCellHeight = 0; | |
| 438 | |
| 439 for (unsigned row = 0; row < rowSpan; row++) { | |
| 440 unsigned actualRow = row + rowIndex; | |
| 441 totalRowSpanCellHeight += m_rowPos[actualRow + 1] - m_rowPos[act ualRow]; | |
| 442 } | |
| 443 totalRowSpanCellHeight -= borderSpacingForRow(rowIndex + rowSpan - 1 ); | |
| 444 | |
| 445 if (totalRowSpanCellHeight < cell->logicalHeightForRowSizing()) | |
| 446 return true; | |
| 447 } | |
| 448 } | |
| 449 | |
| 450 return false; | |
| 451 } | |
| 
 
Julien - ping for review
2013/09/20 18:34:53
This really looks like it should be folded into ro
 
 | |
| 452 | |
| 423 unsigned RenderTableSection::calcRowHeightHavingOnlySpanningCells(unsigned row) | 453 unsigned RenderTableSection::calcRowHeightHavingOnlySpanningCells(unsigned row) | 
| 424 { | 454 { | 
| 425 ASSERT(rowHasOnlySpanningCells(row)); | 455 ASSERT(rowHasOnlySpanningCells(row)); | 
| 426 | 456 | 
| 427 unsigned totalCols = m_grid[row].row.size(); | 457 unsigned totalCols = m_grid[row].row.size(); | 
| 428 | 458 | 
| 429 if (!totalCols) | 459 if (!totalCols) | 
| 430 return 0; | 460 return 0; | 
| 431 | 461 | 
| 432 unsigned rowHeight = 0; | 462 unsigned rowHeight = 0; | 
| (...skipping 12 matching lines...) Expand all Loading... | |
| 445 ASSERT(spanningRowsHeight.rowHeight.size()); | 475 ASSERT(spanningRowsHeight.rowHeight.size()); | 
| 446 | 476 | 
| 447 int accumulatedPositionIncrease = 0; | 477 int accumulatedPositionIncrease = 0; | 
| 448 const unsigned rowSpan = cell->rowSpan(); | 478 const unsigned rowSpan = cell->rowSpan(); | 
| 449 const unsigned rowIndex = cell->rowIndex(); | 479 const unsigned rowIndex = cell->rowIndex(); | 
| 450 | 480 | 
| 451 ASSERT(rowSpan == spanningRowsHeight.rowHeight.size()); | 481 ASSERT(rowSpan == spanningRowsHeight.rowHeight.size()); | 
| 452 | 482 | 
| 453 for (unsigned row = 0; row < spanningRowsHeight.rowHeight.size(); row++) { | 483 for (unsigned row = 0; row < spanningRowsHeight.rowHeight.size(); row++) { | 
| 454 unsigned actualRow = row + rowIndex; | 484 unsigned actualRow = row + rowIndex; | 
| 455 if (!spanningRowsHeight.rowHeight[row] && rowHasOnlySpanningCells(actual Row)) { | 485 if (!spanningRowsHeight.rowHeight[row] && rowHasOnlySpanningCells(actual Row) && isHeightNeededForRowHavingOnlySpanningCells(actualRow)) { | 
| 
 
Julien - ping for review
2013/09/20 18:34:53
Is the !spanningRowsHeight.rowHeight[row] still ne
 
suchit.agrawal
2013/09/20 22:12:00
Yes !spanningRowsHeight.rowHeight[row] is needed b
 
 | |
| 456 spanningRowsHeight.rowHeight[row] = calcRowHeightHavingOnlySpanningC ells(actualRow); | 486 spanningRowsHeight.rowHeight[row] = calcRowHeightHavingOnlySpanningC ells(actualRow); | 
| 457 accumulatedPositionIncrease += spanningRowsHeight.rowHeight[row]; | 487 accumulatedPositionIncrease += spanningRowsHeight.rowHeight[row]; | 
| 458 } | 488 } | 
| 459 m_rowPos[actualRow + 1] += accumulatedPositionIncrease; | 489 m_rowPos[actualRow + 1] += accumulatedPositionIncrease; | 
| 460 } | 490 } | 
| 461 | 491 | 
| 462 spanningRowsHeight.totalRowsHeight += accumulatedPositionIncrease; | 492 spanningRowsHeight.totalRowsHeight += accumulatedPositionIncrease; | 
| 463 } | 493 } | 
| 464 | 494 | 
| 465 // Distribute rowSpan cell height in rows those comes in rowSpan cell based on t he ratio of row's height if | 495 // Distribute rowSpan cell height in rows those comes in rowSpan cell based on t he ratio of row's height if | 
| (...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1779 if (!style()->isLeftToRightDirection()) | 1809 if (!style()->isLeftToRightDirection()) | 
| 1780 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); | 1810 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); | 
| 1781 else | 1811 else | 
| 1782 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); | 1812 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); | 
| 1783 | 1813 | 
| 1784 cell->setLogicalLocation(cellLocation); | 1814 cell->setLogicalLocation(cellLocation); | 
| 1785 view()->addLayoutDelta(oldCellLocation - cell->location()); | 1815 view()->addLayoutDelta(oldCellLocation - cell->location()); | 
| 1786 } | 1816 } | 
| 1787 | 1817 | 
| 1788 } // namespace WebCore | 1818 } // namespace WebCore | 
| OLD | NEW |