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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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. |
| 376 static bool compareRowSpanCellsInHeightDistributionOrder(const RenderTableCell* cell2, const RenderTableCell* cell1) | 376 static bool compareRowSpanCellsInHeightDistributionOrder(const RenderTableCell* secondCell, const RenderTableCell* firstCell) |
|
Julien - ping for review
2013/08/23 22:00:47
The arguments are still backwards :-/
I was fine
a.suchit
2013/09/04 13:21:48
Done.
| |
| 377 { | 377 { |
| 378 unsigned cellRowIndex1 = cell1->rowIndex(); | 378 unsigned firstCellRowIndex = firstCell->rowIndex(); |
| 379 unsigned cellRowSpan1 = cell1->rowSpan(); | 379 unsigned firstCellRowSpan = firstCell->rowSpan(); |
| 380 unsigned cellRowIndex2 = cell2->rowIndex(); | 380 unsigned secondCellRowIndex = secondCell->rowIndex(); |
| 381 unsigned cellRowSpan2 = cell2->rowSpan(); | 381 unsigned secondCellRowSpan = secondCell->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 (firstCellRowIndex == secondCellRowIndex && firstCellRowSpan == secondCel lRowSpan) | |
| 386 return (secondCell->logicalHeightForRowSizing() > firstCell->logicalHeig htForRowSizing()); | |
| 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 (secondCellRowIndex >= firstCellRowIndex && (secondCellRowIndex + secondC ellRowSpan) <= (firstCellRowIndex + firstCellRowSpan)) | |
| 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 (!(firstCellRowIndex >= secondCellRowIndex && (firstCellRowIndex + firstC ellRowSpan) <= (secondCellRowIndex + secondCellRowSpan))) | |
| 395 return (secondCellRowIndex < firstCellRowIndex); | |
| 385 | 396 |
| 386 return (cellRowIndex2 >= cellRowIndex1 && (cellRowIndex2 + cellRowSpan2) <= (cellRowIndex1 + cellRowSpan1)); | 397 return false; |
| 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 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1684 if (!style()->isLeftToRightDirection()) | 1695 if (!style()->isLeftToRightDirection()) |
| 1685 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); | 1696 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); |
| 1686 else | 1697 else |
| 1687 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); | 1698 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); |
| 1688 | 1699 |
| 1689 cell->setLogicalLocation(cellLocation); | 1700 cell->setLogicalLocation(cellLocation); |
| 1690 view()->addLayoutDelta(oldCellLocation - cell->location()); | 1701 view()->addLayoutDelta(oldCellLocation - cell->location()); |
| 1691 } | 1702 } |
| 1692 | 1703 |
| 1693 } // namespace WebCore | 1704 } // namespace WebCore |
| OLD | NEW |