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, 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 if (!spanningRowsHeight.rowHeight[row]) | 323 if (!spanningRowsHeight.rowHeight[row]) |
| 324 spanningRowsHeight.isAnyRowWithOnlySpanningCells |= rowHasOnlySpanni ngCells(actualRow); | 324 spanningRowsHeight.isAnyRowWithOnlySpanningCells |= rowHasOnlySpanni ngCells(actualRow); |
| 325 | 325 |
| 326 spanningRowsHeight.totalRowsHeight += spanningRowsHeight.rowHeight[row]; | 326 spanningRowsHeight.totalRowsHeight += spanningRowsHeight.rowHeight[row]; |
| 327 spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing -= borderSpac ingForRow(actualRow); | 327 spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing -= borderSpac ingForRow(actualRow); |
| 328 } | 328 } |
| 329 // We don't span the following row so its border-spacing (if any) should be included. | 329 // We don't span the following row so its border-spacing (if any) should be included. |
| 330 spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing += borderSpacingF orRow(rowIndex + rowSpan - 1); | 330 spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing += borderSpacingF orRow(rowIndex + rowSpan - 1); |
| 331 } | 331 } |
| 332 | 332 |
| 333 void LayoutTableSection::distributeExtraRowSpanHeightToPercentRows(LayoutTableCe ll* cell, int totalPercent, int& extraRowSpanningHeight, Vector<int>& rowsHeight ) | 333 void LayoutTableSection::distributeExtraRowSpanHeightToPercentRows(LayoutTableCe ll* cell, float totalPercent, int& extraRowSpanningHeight, Vector<int>& rowsHeig ht) |
| 334 { | 334 { |
| 335 if (!extraRowSpanningHeight || !totalPercent) | 335 if (!extraRowSpanningHeight || !totalPercent) |
| 336 return; | 336 return; |
| 337 | 337 |
| 338 const unsigned rowSpan = cell->rowSpan(); | 338 const unsigned rowSpan = cell->rowSpan(); |
| 339 const unsigned rowIndex = cell->rowIndex(); | 339 const unsigned rowIndex = cell->rowIndex(); |
| 340 int percent = std::min(totalPercent, 100); | 340 float percent = std::min(totalPercent, 100.0f); |
| 341 const int tableHeight = m_rowPos[m_grid.size()] + extraRowSpanningHeight; | 341 const int tableHeight = m_rowPos[m_grid.size()] + extraRowSpanningHeight; |
| 342 | 342 |
| 343 // Our algorithm matches Firefox. Extra spanning height would be distributed Only in first percent height rows | 343 // Our algorithm matches Firefox. Extra spanning height would be distributed Only in first percent height rows |
| 344 // those total percent is 100. Other percent rows would be uneffected even e xtra spanning height is remain. | 344 // those total percent is 100. Other percent rows would be uneffected even e xtra spanning height is remain. |
| 345 int accumulatedPositionIncrease = 0; | 345 int accumulatedPositionIncrease = 0; |
| 346 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { | 346 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { |
| 347 if (percent > 0 && extraRowSpanningHeight > 0) { | 347 if (percent > 0 && extraRowSpanningHeight > 0) { |
| 348 // TODO(alancutter): Make this work correctly for calc lengths. | 348 // TODO(alancutter): Make this work correctly for calc lengths. |
| 349 if (m_grid[row].logicalHeight.hasPercent()) { | 349 if (m_grid[row].logicalHeight.hasPercent()) { |
| 350 int toAdd = (tableHeight * m_grid[row].logicalHeight.percent() / 100) - rowsHeight[row - rowIndex]; | 350 int toAdd = (tableHeight * std::min(m_grid[row].logicalHeight.pe rcent(), percent) / 100) - rowsHeight[row - rowIndex]; |
|
a.suchit2
2016/01/19 13:02:16
Do we need to use LayoutUnit here after this chang
mstensho (USE GERRIT)
2016/01/20 13:00:59
OK, I get it now. I had a hard time following the
| |
| 351 // FIXME: Note that this is wrong if we have a percentage above 100% and may make us grow | |
| 352 // above the available space. | |
| 353 | 351 |
| 354 toAdd = std::max(std::min(toAdd, extraRowSpanningHeight), 0); | 352 toAdd = std::max(std::min(toAdd, extraRowSpanningHeight), 0); |
| 355 accumulatedPositionIncrease += toAdd; | 353 accumulatedPositionIncrease += toAdd; |
| 356 extraRowSpanningHeight -= toAdd; | 354 extraRowSpanningHeight -= toAdd; |
| 357 percent -= m_grid[row].logicalHeight.percent(); | 355 percent -= m_grid[row].logicalHeight.percent(); |
| 358 } | 356 } |
| 359 } | 357 } |
| 360 m_rowPos[row + 1] += accumulatedPositionIncrease; | 358 m_rowPos[row + 1] += accumulatedPositionIncrease; |
| 361 } | 359 } |
| 362 } | 360 } |
| (...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1671 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). | 1669 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). |
| 1672 if (!style()->isLeftToRightDirection()) | 1670 if (!style()->isLeftToRightDirection()) |
| 1673 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); | 1671 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); |
| 1674 else | 1672 else |
| 1675 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); | 1673 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); |
| 1676 | 1674 |
| 1677 cell->setLogicalLocation(cellLocation); | 1675 cell->setLogicalLocation(cellLocation); |
| 1678 } | 1676 } |
| 1679 | 1677 |
| 1680 } // namespace blink | 1678 } // namespace blink |
| OLD | NEW |