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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 unsigned lastRowIndex = 0; | 399 unsigned lastRowIndex = 0; | 
| 400 unsigned lastRowSpan = 0; | 400 unsigned lastRowSpan = 0; | 
| 401 | 401 | 
| 402 for (unsigned i = 0; i < rowSpanCells.size(); i++) { | 402 for (unsigned i = 0; i < rowSpanCells.size(); i++) { | 
| 403 RenderTableCell* cell = rowSpanCells[i]; | 403 RenderTableCell* cell = rowSpanCells[i]; | 
| 404 | 404 | 
| 405 unsigned rowIndex = cell->rowIndex(); | 405 unsigned rowIndex = cell->rowIndex(); | 
| 406 | 406 | 
| 407 unsigned rowSpan = cell->rowSpan(); | 407 unsigned rowSpan = cell->rowSpan(); | 
| 408 | 408 | 
| 409 unsigned spanningCellEndBoundry = rowIndex + rowSpan; | |
| 410 unsigned lastSpanningCellEndBoundry = lastRowIndex + lastRowSpan; | |
| 
 
Julien - ping for review
2013/08/08 20:08:43
typo: "boundry" is not an English word, "boundary"
 
 | |
| 411 | |
| 409 // Only heightest spanning cell will distribute it's extra height in row if more then one spanning cells | 412 // Only heightest spanning cell will distribute it's extra height in row if more then one spanning cells | 
| 410 // present at same level. | 413 // present at same level. | 
| 411 if (rowIndex == lastRowIndex && rowSpan == lastRowSpan) | 414 if (rowIndex == lastRowIndex && rowSpan == lastRowSpan) | 
| 412 continue; | 415 continue; | 
| 413 | 416 | 
| 414 int originalBeforePosition = m_rowPos[rowIndex + rowSpan]; | 417 int originalBeforePosition = m_rowPos[spanningCellEndBoundry]; | 
| 418 | |
| 419 // When 2 spanning cells are ending at same row index then while extra h eight distribution of first spanning | |
| 420 // cell updates position of the last row so getting the original positio n of the last row in second spanning | |
| 421 // cell need to reduce the height changed by first spanning cell. | |
| 422 if (spanningCellEndBoundry == lastSpanningCellEndBoundry) | |
| 423 originalBeforePosition -= extraHeightToPropagate; | |
| 415 | 424 | 
| 416 if (extraHeightToPropagate) { | 425 if (extraHeightToPropagate) { | 
| 417 for (unsigned row = lastRowIndex + lastRowSpan; row <= rowIndex + ro wSpan; row++) | 426 for (unsigned row = lastSpanningCellEndBoundry + 1; row <= spanningC ellEndBoundry; row++) | 
| 418 m_rowPos[row] += extraHeightToPropagate; | 427 m_rowPos[row] += extraHeightToPropagate; | 
| 419 } | 428 } | 
| 420 | 429 | 
| 421 lastRowIndex = rowIndex; | 430 lastRowIndex = rowIndex; | 
| 422 lastRowSpan = rowSpan; | 431 lastRowSpan = rowSpan; | 
| 423 | 432 | 
| 424 struct SpanningRowsHeight spanningRowsHeight; | 433 struct SpanningRowsHeight spanningRowsHeight; | 
| 425 | 434 | 
| 426 populateSpanningRowsHeightFromCell(cell, spanningRowsHeight); | 435 populateSpanningRowsHeightFromCell(cell, spanningRowsHeight); | 
| 427 | 436 | 
| 428 if (!spanningRowsHeight.totalRowsHeight || spanningRowsHeight.spanningCe llHeightIgnoringBorderSpacing <= spanningRowsHeight.totalRowsHeight) | 437 if (!spanningRowsHeight.totalRowsHeight || spanningRowsHeight.spanningCe llHeightIgnoringBorderSpacing <= spanningRowsHeight.totalRowsHeight) | 
| 429 continue; | 438 continue; | 
| 430 | 439 | 
| 431 int totalPercent = 0; | 440 int totalPercent = 0; | 
| 432 int totalAutoRowsHeight = 0; | 441 int totalAutoRowsHeight = 0; | 
| 433 int totalRemainingRowsHeight = spanningRowsHeight.totalRowsHeight; | 442 int totalRemainingRowsHeight = spanningRowsHeight.totalRowsHeight; | 
| 434 | 443 | 
| 435 // FIXME: Inner spanning cell height should not change if it have fixed height when it's parent spanning cell | 444 // FIXME: Inner spanning cell height should not change if it have fixed height when it's parent spanning cell | 
| 436 // is distributing it's extra height in rows. | 445 // is distributing it's extra height in rows. | 
| 437 | 446 | 
| 438 // Calculate total percentage, total auto rows height and total rows hei ght except percent rows. | 447 // Calculate total percentage, total auto rows height and total rows hei ght except percent rows. | 
| 439 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { | 448 for (unsigned row = rowIndex; row < spanningCellEndBoundry; row++) { | 
| 440 if (m_grid[row].logicalHeight.isPercent()) { | 449 if (m_grid[row].logicalHeight.isPercent()) { | 
| 441 totalPercent += m_grid[row].logicalHeight.percent(); | 450 totalPercent += m_grid[row].logicalHeight.percent(); | 
| 442 totalRemainingRowsHeight -= spanningRowsHeight.rowHeight[row - r owIndex]; | 451 totalRemainingRowsHeight -= spanningRowsHeight.rowHeight[row - r owIndex]; | 
| 443 } else if (m_grid[row].logicalHeight.isAuto()) { | 452 } else if (m_grid[row].logicalHeight.isAuto()) { | 
| 444 totalAutoRowsHeight += spanningRowsHeight.rowHeight[row - rowInd ex]; | 453 totalAutoRowsHeight += spanningRowsHeight.rowHeight[row - rowInd ex]; | 
| 445 } | 454 } | 
| 446 } | 455 } | 
| 447 | 456 | 
| 448 int extraRowSpanningHeight = spanningRowsHeight.spanningCellHeightIgnori ngBorderSpacing - spanningRowsHeight.totalRowsHeight; | 457 int extraRowSpanningHeight = spanningRowsHeight.spanningCellHeightIgnori ngBorderSpacing - spanningRowsHeight.totalRowsHeight; | 
| 449 | 458 | 
| 450 distributeExtraRowSpanHeightToPercentRows(cell, totalPercent, extraRowSp anningHeight, spanningRowsHeight.rowHeight); | 459 distributeExtraRowSpanHeightToPercentRows(cell, totalPercent, extraRowSp anningHeight, spanningRowsHeight.rowHeight); | 
| 451 distributeExtraRowSpanHeightToAutoRows(cell, totalAutoRowsHeight, extraR owSpanningHeight, spanningRowsHeight.rowHeight); | 460 distributeExtraRowSpanHeightToAutoRows(cell, totalAutoRowsHeight, extraR owSpanningHeight, spanningRowsHeight.rowHeight); | 
| 452 distributeExtraRowSpanHeightToRemainingRows(cell, totalRemainingRowsHeig ht, extraRowSpanningHeight, spanningRowsHeight.rowHeight); | 461 distributeExtraRowSpanHeightToRemainingRows(cell, totalRemainingRowsHeig ht, extraRowSpanningHeight, spanningRowsHeight.rowHeight); | 
| 453 | 462 | 
| 454 ASSERT(!extraRowSpanningHeight); | 463 ASSERT(!extraRowSpanningHeight); | 
| 455 | 464 | 
| 456 // Getting total changed height in the table | 465 // Getting total changed height in the table | 
| 457 extraHeightToPropagate = m_rowPos[rowIndex + rowSpan] - originalBeforePo sition; | 466 extraHeightToPropagate = m_rowPos[spanningCellEndBoundry] - originalBefo rePosition; | 
| 458 m_rowPos[rowIndex + rowSpan] -= extraHeightToPropagate; | |
| 459 } | 467 } | 
| 460 | 468 | 
| 461 if (extraHeightToPropagate) { | 469 if (extraHeightToPropagate) { | 
| 462 // Apply changed height by rowSpan cells to rows present at the end of t he table | 470 // Apply changed height by rowSpan cells to rows present at the end of t he table | 
| 463 for (unsigned row = lastRowIndex + lastRowSpan; row <= m_grid.size(); ro w++) | 471 for (unsigned row = lastRowIndex + lastRowSpan + 1; row <= m_grid.size() ; row++) | 
| 464 m_rowPos[row] += extraHeightToPropagate; | 472 m_rowPos[row] += extraHeightToPropagate; | 
| 465 } | 473 } | 
| 466 } | 474 } | 
| 467 | 475 | 
| 468 // Find out the baseline of the cell | 476 // Find out the baseline of the cell | 
| 469 // If the cell's baseline is more then the row's baseline then the cell's baseli ne become the row's baseline | 477 // If the cell's baseline is more then the row's baseline then the cell's baseli ne become the row's baseline | 
| 470 // and if the row's baseline goes out of the row's boundries then adjust row hei ght accordingly. | 478 // and if the row's baseline goes out of the row's boundries then adjust row hei ght accordingly. | 
| 471 void RenderTableSection::updateBaselineForCell(RenderTableCell* cell, unsigned r ow, LayoutUnit& baselineDescent) | 479 void RenderTableSection::updateBaselineForCell(RenderTableCell* cell, unsigned r ow, LayoutUnit& baselineDescent) | 
| 472 { | 480 { | 
| 473 if (!cell->isBaselineAligned()) | 481 if (!cell->isBaselineAligned()) | 
| (...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1675 if (!style()->isLeftToRightDirection()) | 1683 if (!style()->isLeftToRightDirection()) | 
| 1676 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); | 1684 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); | 
| 1677 else | 1685 else | 
| 1678 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); | 1686 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); | 
| 1679 | 1687 | 
| 1680 cell->setLogicalLocation(cellLocation); | 1688 cell->setLogicalLocation(cellLocation); | 
| 1681 view()->addLayoutDelta(oldCellLocation - cell->location()); | 1689 view()->addLayoutDelta(oldCellLocation - cell->location()); | 
| 1682 } | 1690 } | 
| 1683 | 1691 | 
| 1684 } // namespace WebCore | 1692 } // namespace WebCore | 
| OLD | NEW |