Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/LayoutTableSection.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp |
| index afb1424af20b17dd535baaf7b8b72eb90a7b5c23..defb9b1615fb154cc41bfffd95ad8c1bbff6d81e 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp |
| @@ -303,14 +303,16 @@ void LayoutTableSection::populateSpanningRowsHeightFromCell(LayoutTableCell* cel |
| spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing += borderSpacingForRow(rowIndex + rowSpan - 1); |
| } |
| -void LayoutTableSection::distributeExtraRowSpanHeightToPercentRows(LayoutTableCell* cell, int totalPercent, int& extraRowSpanningHeight, Vector<int>& rowsHeight) |
| +void LayoutTableSection::distributeExtraRowSpanHeightToPercentRows( |
| + 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.
|
| + Vector<int>& rowsHeight) |
| { |
| if (!extraRowSpanningHeight || !totalPercent) |
| return; |
| const unsigned rowSpan = cell->rowSpan(); |
| const unsigned rowIndex = cell->rowIndex(); |
| - int percent = std::min(totalPercent, 100); |
| + float percent = std::min(totalPercent, 100.0f); |
| const int tableHeight = m_rowPos[m_grid.size()] + extraRowSpanningHeight; |
| // Our algorithm matches Firefox. Extra spanning height would be distributed Only in first percent height rows |
| @@ -320,9 +322,9 @@ void LayoutTableSection::distributeExtraRowSpanHeightToPercentRows(LayoutTableCe |
| if (percent > 0 && extraRowSpanningHeight > 0) { |
| // TODO(alancutter): Make this work correctly for calc lengths. |
| if (m_grid[row].logicalHeight.hasPercent()) { |
| - int toAdd = (tableHeight * m_grid[row].logicalHeight.percent() / 100) - rowsHeight[row - rowIndex]; |
| - // FIXME: Note that this is wrong if we have a percentage above 100% and may make us grow |
| - // above the available space. |
| + int toAdd = (tableHeight * |
| + 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.
|
| + - rowsHeight[row - rowIndex]; |
| toAdd = std::max(std::min(toAdd, extraRowSpanningHeight), 0); |
| accumulatedPositionIncrease += toAdd; |