| 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, 2013 Apple Inc. All r
ights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2013 Apple Inc. All r
ights 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 | 388 |
| 389 int accumulatedPositionIncrease = 0; | 389 int accumulatedPositionIncrease = 0; |
| 390 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { | 390 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { |
| 391 // TODO(alancutter): Make this work correctly for calc lengths. | 391 // TODO(alancutter): Make this work correctly for calc lengths. |
| 392 if (m_grid[row].logicalHeight.hasPercent()) { | 392 if (m_grid[row].logicalHeight.hasPercent()) { |
| 393 updatePositionIncreasedWithRowHeight(extraRowSpanningHeight, m_grid[
row].logicalHeight.percent(), totalPercent, accumulatedPositionIncrease, remaind
er); | 393 updatePositionIncreasedWithRowHeight(extraRowSpanningHeight, m_grid[
row].logicalHeight.percent(), totalPercent, accumulatedPositionIncrease, remaind
er); |
| 394 } | 394 } |
| 395 m_rowPos[row + 1] += accumulatedPositionIncrease; | 395 m_rowPos[row + 1] += accumulatedPositionIncrease; |
| 396 } | 396 } |
| 397 | 397 |
| 398 ASSERT_WITH_MESSAGE(!round(remainder), "remainder was %f", remainder); | 398 DCHECK(!round(remainder)) << "remainder was " << remainder; |
| 399 | 399 |
| 400 extraRowSpanningHeight -= accumulatedPositionIncrease; | 400 extraRowSpanningHeight -= accumulatedPositionIncrease; |
| 401 } | 401 } |
| 402 | 402 |
| 403 void LayoutTableSection::distributeExtraRowSpanHeightToAutoRows(LayoutTableCell*
cell, int totalAutoRowsHeight, int& extraRowSpanningHeight, Vector<int>& rowsHe
ight) | 403 void LayoutTableSection::distributeExtraRowSpanHeightToAutoRows(LayoutTableCell*
cell, int totalAutoRowsHeight, int& extraRowSpanningHeight, Vector<int>& rowsHe
ight) |
| 404 { | 404 { |
| 405 if (!extraRowSpanningHeight || !totalAutoRowsHeight) | 405 if (!extraRowSpanningHeight || !totalAutoRowsHeight) |
| 406 return; | 406 return; |
| 407 | 407 |
| 408 const unsigned rowSpan = cell->rowSpan(); | 408 const unsigned rowSpan = cell->rowSpan(); |
| 409 const unsigned rowIndex = cell->rowIndex(); | 409 const unsigned rowIndex = cell->rowIndex(); |
| 410 int accumulatedPositionIncrease = 0; | 410 int accumulatedPositionIncrease = 0; |
| 411 double remainder = 0; | 411 double remainder = 0; |
| 412 | 412 |
| 413 // Aspect ratios of auto rows should not change otherwise table may look dif
ferent than user expected. | 413 // Aspect ratios of auto rows should not change otherwise table may look dif
ferent than user expected. |
| 414 // So extra height distributed in auto spanning rows based on their weight i
n spanning cell. | 414 // So extra height distributed in auto spanning rows based on their weight i
n spanning cell. |
| 415 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { | 415 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { |
| 416 if (m_grid[row].logicalHeight.isAuto()) { | 416 if (m_grid[row].logicalHeight.isAuto()) { |
| 417 updatePositionIncreasedWithRowHeight(extraRowSpanningHeight, rowsHei
ght[row - rowIndex], totalAutoRowsHeight, accumulatedPositionIncrease, remainder
); | 417 updatePositionIncreasedWithRowHeight(extraRowSpanningHeight, rowsHei
ght[row - rowIndex], totalAutoRowsHeight, accumulatedPositionIncrease, remainder
); |
| 418 } | 418 } |
| 419 m_rowPos[row + 1] += accumulatedPositionIncrease; | 419 m_rowPos[row + 1] += accumulatedPositionIncrease; |
| 420 } | 420 } |
| 421 | 421 |
| 422 ASSERT_WITH_MESSAGE(!round(remainder) , "remainder was %f", remainder); | 422 DCHECK(!round(remainder)) << "remainder was " << remainder; |
| 423 | 423 |
| 424 extraRowSpanningHeight -= accumulatedPositionIncrease; | 424 extraRowSpanningHeight -= accumulatedPositionIncrease; |
| 425 } | 425 } |
| 426 | 426 |
| 427 void LayoutTableSection::distributeExtraRowSpanHeightToRemainingRows(LayoutTable
Cell* cell, int totalRemainingRowsHeight, int& extraRowSpanningHeight, Vector<in
t>& rowsHeight) | 427 void LayoutTableSection::distributeExtraRowSpanHeightToRemainingRows(LayoutTable
Cell* cell, int totalRemainingRowsHeight, int& extraRowSpanningHeight, Vector<in
t>& rowsHeight) |
| 428 { | 428 { |
| 429 if (!extraRowSpanningHeight || !totalRemainingRowsHeight) | 429 if (!extraRowSpanningHeight || !totalRemainingRowsHeight) |
| 430 return; | 430 return; |
| 431 | 431 |
| 432 const unsigned rowSpan = cell->rowSpan(); | 432 const unsigned rowSpan = cell->rowSpan(); |
| 433 const unsigned rowIndex = cell->rowIndex(); | 433 const unsigned rowIndex = cell->rowIndex(); |
| 434 int accumulatedPositionIncrease = 0; | 434 int accumulatedPositionIncrease = 0; |
| 435 double remainder = 0; | 435 double remainder = 0; |
| 436 | 436 |
| 437 // Aspect ratios of the rows should not change otherwise table may look diff
erent than user expected. | 437 // Aspect ratios of the rows should not change otherwise table may look diff
erent than user expected. |
| 438 // So extra height distribution in remaining spanning rows based on their we
ight in spanning cell. | 438 // So extra height distribution in remaining spanning rows based on their we
ight in spanning cell. |
| 439 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { | 439 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { |
| 440 if (!m_grid[row].logicalHeight.hasPercent()) { | 440 if (!m_grid[row].logicalHeight.hasPercent()) { |
| 441 updatePositionIncreasedWithRowHeight(extraRowSpanningHeight, rowsHei
ght[row - rowIndex], totalRemainingRowsHeight, accumulatedPositionIncrease, rema
inder); | 441 updatePositionIncreasedWithRowHeight(extraRowSpanningHeight, rowsHei
ght[row - rowIndex], totalRemainingRowsHeight, accumulatedPositionIncrease, rema
inder); |
| 442 } | 442 } |
| 443 m_rowPos[row + 1] += accumulatedPositionIncrease; | 443 m_rowPos[row + 1] += accumulatedPositionIncrease; |
| 444 } | 444 } |
| 445 | 445 |
| 446 ASSERT_WITH_MESSAGE(!round(remainder), "remainder was %f", remainder); | 446 DCHECK(!round(remainder)) << "remainder was " << remainder; |
| 447 | 447 |
| 448 extraRowSpanningHeight -= accumulatedPositionIncrease; | 448 extraRowSpanningHeight -= accumulatedPositionIncrease; |
| 449 } | 449 } |
| 450 | 450 |
| 451 static bool cellIsFullyIncludedInOtherCell(const LayoutTableCell* cell1, const L
ayoutTableCell* cell2) | 451 static bool cellIsFullyIncludedInOtherCell(const LayoutTableCell* cell1, const L
ayoutTableCell* cell2) |
| 452 { | 452 { |
| 453 return (cell1->rowIndex() >= cell2->rowIndex() && (cell1->rowIndex() + cell1
->rowSpan()) <= (cell2->rowIndex() + cell2->rowSpan())); | 453 return (cell1->rowIndex() >= cell2->rowIndex() && (cell1->rowIndex() + cell1
->rowSpan()) <= (cell2->rowIndex() + cell2->rowSpan())); |
| 454 } | 454 } |
| 455 | 455 |
| 456 // To avoid unneeded extra height distributions, we apply the following sorting
algorithm: | 456 // To avoid unneeded extra height distributions, we apply the following sorting
algorithm: |
| (...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1641 // FIXME: The table's direction should determine our row's direction, not th
e section's (see bug 96691). | 1641 // FIXME: The table's direction should determine our row's direction, not th
e section's (see bug 96691). |
| 1642 if (!style()->isLeftToRightDirection()) | 1642 if (!style()->isLeftToRightDirection()) |
| 1643 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table()
->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute
ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo
ntalBorderSpacing)); | 1643 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table()
->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute
ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo
ntalBorderSpacing)); |
| 1644 else | 1644 else |
| 1645 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti
veColumn] + horizontalBorderSpacing)); | 1645 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti
veColumn] + horizontalBorderSpacing)); |
| 1646 | 1646 |
| 1647 cell->setLogicalLocation(cellLocation); | 1647 cell->setLogicalLocation(cellLocation); |
| 1648 } | 1648 } |
| 1649 | 1649 |
| 1650 } // namespace blink | 1650 } // namespace blink |
| OLD | NEW |