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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 365 m_rowPos[row + 1] += accumulatedPositionIncrease; | 365 m_rowPos[row + 1] += accumulatedPositionIncrease; |
| 366 } | 366 } |
| 367 | 367 |
| 368 ASSERT(!remainder); | 368 ASSERT(!remainder); |
| 369 | 369 |
| 370 extraRowSpanningHeight -= accumulatedPositionIncrease; | 370 extraRowSpanningHeight -= accumulatedPositionIncrease; |
| 371 } | 371 } |
| 372 | 372 |
| 373 // To avoid unneeded extra height distributions, we apply the following sorting algorithm: | 373 // To avoid unneeded extra height distributions, we apply the following sorting algorithm: |
| 374 // 1. We sort by increasing start row but decreasing last row (ie the top-most, shortest cells first). | 374 // 1. We sort by increasing start row but decreasing last row (ie the top-most, shortest cells first). |
| 375 // 2. For cells spanning the same rows, we sort by intrinsic size. | 375 // 2. For cells spanning the same rows, we sort by intrinsic size. |
|
Julien - ping for review
2013/09/04 20:46:27
As you inlined the description of what you do, the
a.suchit
2013/09/05 06:35:01
Done.
| |
| 376 static bool compareRowSpanCellsInHeightDistributionOrder(const RenderTableCell* cell2, const RenderTableCell* cell1) | 376 static bool compareRowSpanCellsInHeightDistributionOrder(const RenderTableCell* cell1, const RenderTableCell* cell2) |
| 377 { | 377 { |
| 378 unsigned cellRowIndex1 = cell1->rowIndex(); | 378 unsigned cell1RowIndex = cell1->rowIndex(); |
| 379 unsigned cellRowSpan1 = cell1->rowSpan(); | 379 unsigned cell1RowSpan = cell1->rowSpan(); |
| 380 unsigned cellRowIndex2 = cell2->rowIndex(); | 380 unsigned cell2RowIndex = cell2->rowIndex(); |
| 381 unsigned cellRowSpan2 = cell2->rowSpan(); | 381 unsigned cell2RowSpan = cell2->rowSpan(); |
| 382 | 382 |
| 383 if (cellRowIndex1 == cellRowIndex2 && cellRowSpan1 == cellRowSpan2) | 383 // Sorting bigger height cell first if cells are at same index with same spa n because we will skip smaller |
| 384 return (cell2->logicalHeightForRowSizing() > cell1->logicalHeightForRowS izing()); | 384 // height cell to distribute it's extra height. |
| 385 if (cell1RowIndex == cell2RowIndex && cell1RowSpan == cell2RowSpan) | |
| 386 return (cell1->logicalHeightForRowSizing() > cell2->logicalHeightForRowS izing()); | |
| 387 // Sorting inner most cell first because if inner spanning cell'e extra heig ht is distributed then outer | |
| 388 // spanning cell's extra height will adjust accordingly. In reverse order, t here is more chances that outer | |
| 389 // spanning cell's height will exceed than defined by user. | |
| 390 if (cell1RowIndex >= cell2RowIndex && (cell1RowIndex + cell1RowSpan) <= (cel l2RowIndex + cell2RowSpan)) | |
|
Julien - ping for review
2013/09/04 18:35:45
This should be a function as you use it twice:
bo
a.suchit
2013/09/05 06:35:01
Done.
| |
| 391 return true; | |
| 392 // Sorting lower row index first because first we need to apply the extra he ight of spanning cell which | |
| 393 // comes first in the table so lower rows's position would increment in sequ ence. | |
| 394 if (!(cell2RowIndex >= cell1RowIndex && (cell2RowIndex + cell2RowSpan) <= (c ell1RowIndex + cell1RowSpan))) | |
| 395 return (cell1RowIndex < cell2RowIndex); | |
| 385 | 396 |
| 386 return (cellRowIndex2 >= cellRowIndex1 && (cellRowIndex2 + cellRowSpan2) <= (cellRowIndex1 + cellRowSpan1)); | 397 return false; |
|
Julien - ping for review
2013/09/04 18:35:45
I am concerned about always returning false here b
| |
| 387 } | 398 } |
| 388 | 399 |
| 389 // Distribute rowSpan cell height in rows those comes in rowSpan cell based on t he ratio of row's height if | 400 // Distribute rowSpan cell height in rows those comes in rowSpan cell based on t he ratio of row's height if |
| 390 // 1. RowSpan cell height is greater then the total height of rows in rowSpan ce ll | 401 // 1. RowSpan cell height is greater then the total height of rows in rowSpan ce ll |
| 391 void RenderTableSection::distributeRowSpanHeightToRows(SpanningRenderTableCells& rowSpanCells) | 402 void RenderTableSection::distributeRowSpanHeightToRows(SpanningRenderTableCells& rowSpanCells) |
| 392 { | 403 { |
| 393 ASSERT(rowSpanCells.size()); | 404 ASSERT(rowSpanCells.size()); |
| 394 | 405 |
| 395 // 'rowSpanCells' list is already sorted based on the cells rowIndex in asce nding order | 406 // 'rowSpanCells' list is already sorted based on the cells rowIndex in asce nding order |
| 396 // Arrange row spanning cell in the order in which we need to process first. | 407 // Arrange row spanning cell in the order in which we need to process first. |
| (...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1683 if (!style()->isLeftToRightDirection()) | 1694 if (!style()->isLeftToRightDirection()) |
| 1684 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); | 1695 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); |
| 1685 else | 1696 else |
| 1686 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); | 1697 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); |
| 1687 | 1698 |
| 1688 cell->setLogicalLocation(cellLocation); | 1699 cell->setLogicalLocation(cellLocation); |
| 1689 view()->addLayoutDelta(oldCellLocation - cell->location()); | 1700 view()->addLayoutDelta(oldCellLocation - cell->location()); |
| 1690 } | 1701 } |
| 1691 | 1702 |
| 1692 } // namespace WebCore | 1703 } // namespace WebCore |
| OLD | NEW |