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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 if (!spanningRowsHeight.rowHeight[row]) | 296 if (!spanningRowsHeight.rowHeight[row]) |
| 297 spanningRowsHeight.isAnyRowWithOnlySpanningCells |= rowHasOnlySpanni ngCells(actualRow); | 297 spanningRowsHeight.isAnyRowWithOnlySpanningCells |= rowHasOnlySpanni ngCells(actualRow); |
| 298 | 298 |
| 299 spanningRowsHeight.totalRowsHeight += spanningRowsHeight.rowHeight[row]; | 299 spanningRowsHeight.totalRowsHeight += spanningRowsHeight.rowHeight[row]; |
| 300 spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing -= borderSpac ingForRow(actualRow); | 300 spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing -= borderSpac ingForRow(actualRow); |
| 301 } | 301 } |
| 302 // We don't span the following row so its border-spacing (if any) should be included. | 302 // We don't span the following row so its border-spacing (if any) should be included. |
| 303 spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing += borderSpacingF orRow(rowIndex + rowSpan - 1); | 303 spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing += borderSpacingF orRow(rowIndex + rowSpan - 1); |
| 304 } | 304 } |
| 305 | 305 |
| 306 void LayoutTableSection::distributeExtraRowSpanHeightToPercentRows(LayoutTableCe ll* cell, int totalPercent, int& extraRowSpanningHeight, Vector<int>& rowsHeight ) | 306 void LayoutTableSection::distributeExtraRowSpanHeightToPercentRows( |
| 307 LayoutTableCell* cell, float totalPercent, int& extraRowSpanningHeight, | |
|
mstensho (USE GERRIT)
2015/11/02 10:46:42
Please put this back on one line.
a.suchit2
2016/01/12 06:46:35
Done.
| |
| 308 Vector<int>& rowsHeight) | |
| 307 { | 309 { |
| 308 if (!extraRowSpanningHeight || !totalPercent) | 310 if (!extraRowSpanningHeight || !totalPercent) |
| 309 return; | 311 return; |
| 310 | 312 |
| 311 const unsigned rowSpan = cell->rowSpan(); | 313 const unsigned rowSpan = cell->rowSpan(); |
| 312 const unsigned rowIndex = cell->rowIndex(); | 314 const unsigned rowIndex = cell->rowIndex(); |
| 313 int percent = std::min(totalPercent, 100); | 315 float percent = std::min(totalPercent, 100.0f); |
| 314 const int tableHeight = m_rowPos[m_grid.size()] + extraRowSpanningHeight; | 316 const int tableHeight = m_rowPos[m_grid.size()] + extraRowSpanningHeight; |
| 315 | 317 |
| 316 // Our algorithm matches Firefox. Extra spanning height would be distributed Only in first percent height rows | 318 // Our algorithm matches Firefox. Extra spanning height would be distributed Only in first percent height rows |
| 317 // those total percent is 100. Other percent rows would be uneffected even e xtra spanning height is remain. | 319 // those total percent is 100. Other percent rows would be uneffected even e xtra spanning height is remain. |
| 318 int accumulatedPositionIncrease = 0; | 320 int accumulatedPositionIncrease = 0; |
| 319 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { | 321 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { |
| 320 if (percent > 0 && extraRowSpanningHeight > 0) { | 322 if (percent > 0 && extraRowSpanningHeight > 0) { |
| 321 // TODO(alancutter): Make this work correctly for calc lengths. | 323 // TODO(alancutter): Make this work correctly for calc lengths. |
| 322 if (m_grid[row].logicalHeight.hasPercent()) { | 324 if (m_grid[row].logicalHeight.hasPercent()) { |
| 323 int toAdd = (tableHeight * m_grid[row].logicalHeight.percent() / 100) - rowsHeight[row - rowIndex]; | 325 int toAdd = (tableHeight * |
| 324 // FIXME: Note that this is wrong if we have a percentage above 100% and may make us grow | 326 std::min(m_grid[row].logicalHeight.percent(), percent) / 100) |
|
mstensho (USE GERRIT)
2015/11/02 10:46:42
OK, so what you want to avoid here is integer over
a.suchit2
2016/01/12 06:46:35
I am avoiding high value of percent which is not a
mstensho (USE GERRIT)
2016/01/18 14:37:03
Because LayoutUnit cannot overflow, since it uses
a.suchit2
2016/01/19 13:02:16
Replied on latest patch set 5.
| |
| 325 // above the available space. | 327 - rowsHeight[row - rowIndex]; |
| 326 | 328 |
| 327 toAdd = std::max(std::min(toAdd, extraRowSpanningHeight), 0); | 329 toAdd = std::max(std::min(toAdd, extraRowSpanningHeight), 0); |
| 328 accumulatedPositionIncrease += toAdd; | 330 accumulatedPositionIncrease += toAdd; |
| 329 extraRowSpanningHeight -= toAdd; | 331 extraRowSpanningHeight -= toAdd; |
| 330 percent -= m_grid[row].logicalHeight.percent(); | 332 percent -= m_grid[row].logicalHeight.percent(); |
| 331 } | 333 } |
| 332 } | 334 } |
| 333 m_rowPos[row + 1] += accumulatedPositionIncrease; | 335 m_rowPos[row + 1] += accumulatedPositionIncrease; |
| 334 } | 336 } |
| 335 } | 337 } |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 648 if (m_grid[row].logicalHeight.hasPercent()) { | 650 if (m_grid[row].logicalHeight.hasPercent()) { |
| 649 totalPercent += m_grid[row].logicalHeight.percent(); | 651 totalPercent += m_grid[row].logicalHeight.percent(); |
| 650 totalRemainingRowsHeight -= spanningRowsHeight.rowHeight[row - r owIndex]; | 652 totalRemainingRowsHeight -= spanningRowsHeight.rowHeight[row - r owIndex]; |
| 651 } else if (m_grid[row].logicalHeight.isAuto()) { | 653 } else if (m_grid[row].logicalHeight.isAuto()) { |
| 652 totalAutoRowsHeight += spanningRowsHeight.rowHeight[row - rowInd ex]; | 654 totalAutoRowsHeight += spanningRowsHeight.rowHeight[row - rowInd ex]; |
| 653 } | 655 } |
| 654 } | 656 } |
| 655 | 657 |
| 656 int extraRowSpanningHeight = spanningRowsHeight.spanningCellHeightIgnori ngBorderSpacing - spanningRowsHeight.totalRowsHeight; | 658 int extraRowSpanningHeight = spanningRowsHeight.spanningCellHeightIgnori ngBorderSpacing - spanningRowsHeight.totalRowsHeight; |
| 657 | 659 |
| 658 if (totalPercent < 100 && !totalAutoRowsHeight && !totalRemainingRowsHei ght) { | 660 if (totalPercent < 100 && !totalAutoRowsHeight && !totalRemainingRowsHei ght) { |
|
a.suchit2
2015/10/30 01:43:50
Yes, when auto height and remaining height are 0 t
mstensho (USE GERRIT)
2015/11/02 10:46:42
I guess that's for a separate CL to sort out, righ
| |
| 659 // Distributing whole extra rowspanning height in percent row when o nly non-percent rows height is 0. | 661 // Distributing whole extra rowspanning height in percent row when o nly non-percent rows height is 0. |
| 660 distributeWholeExtraRowSpanHeightToPercentRows(cell, totalPercent, e xtraRowSpanningHeight, spanningRowsHeight.rowHeight); | 662 distributeWholeExtraRowSpanHeightToPercentRows(cell, totalPercent, e xtraRowSpanningHeight, spanningRowsHeight.rowHeight); |
| 661 } else { | 663 } else { |
| 662 distributeExtraRowSpanHeightToPercentRows(cell, totalPercent, extraR owSpanningHeight, spanningRowsHeight.rowHeight); | 664 distributeExtraRowSpanHeightToPercentRows(cell, totalPercent, extraR owSpanningHeight, spanningRowsHeight.rowHeight); |
| 663 distributeExtraRowSpanHeightToAutoRows(cell, totalAutoRowsHeight, ex traRowSpanningHeight, spanningRowsHeight.rowHeight); | 665 distributeExtraRowSpanHeightToAutoRows(cell, totalAutoRowsHeight, ex traRowSpanningHeight, spanningRowsHeight.rowHeight); |
| 664 distributeExtraRowSpanHeightToRemainingRows(cell, totalRemainingRows Height, extraRowSpanningHeight, spanningRowsHeight.rowHeight); | 666 distributeExtraRowSpanHeightToRemainingRows(cell, totalRemainingRows Height, extraRowSpanningHeight, spanningRowsHeight.rowHeight); |
| 665 } | 667 } |
| 666 | 668 |
| 667 ASSERT(!extraRowSpanningHeight); | 669 ASSERT(!extraRowSpanningHeight); |
| 668 | 670 |
| (...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1644 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). | 1646 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). |
| 1645 if (!style()->isLeftToRightDirection()) | 1647 if (!style()->isLeftToRightDirection()) |
| 1646 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); | 1648 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); |
| 1647 else | 1649 else |
| 1648 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); | 1650 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); |
| 1649 | 1651 |
| 1650 cell->setLogicalLocation(cellLocation); | 1652 cell->setLogicalLocation(cellLocation); |
| 1651 } | 1653 } |
| 1652 | 1654 |
| 1653 } // namespace blink | 1655 } // namespace blink |
| OLD | NEW |