Index: Source/core/rendering/RenderTableSection.cpp |
diff --git a/Source/core/rendering/RenderTableSection.cpp b/Source/core/rendering/RenderTableSection.cpp |
index d0e9ba961b9e24556333e02eb4e43e5edbe99931..6a8366e6d380c556c38279ff59934ca3e16e624d 100644 |
--- a/Source/core/rendering/RenderTableSection.cpp |
+++ b/Source/core/rendering/RenderTableSection.cpp |
@@ -328,6 +328,16 @@ void RenderTableSection::distributeExtraRowSpanHeightToPercentRows(RenderTableCe |
} |
} |
+// Some time multiplication of below 2 values is overflowing from integer. So |
+// type of variable in computation are taken as 'long long' in place of int. |
+// In this computation, only 2 integer variables are multiplied which would not |
+// overflow long long. |
+static int calcIncreasedRowHeight(long long extraHeight, long long rowHeight, long long totalHeight, int& remainder) |
Julien - ping for review
2014/03/10 18:36:39
Let's not abbreviate function names.
I don't real
a.suchit
2014/03/11 12:33:56
Done.
|
+{ |
+ remainder += (extraHeight * rowHeight) % totalHeight; |
Julien - ping for review
2014/03/10 18:36:39
Per my comment, there should be some ASSERT about
a.suchit
2014/03/11 12:33:56
Done.
|
+ return (extraHeight * rowHeight) / totalHeight; |
+} |
+ |
void RenderTableSection::distributeExtraRowSpanHeightToAutoRows(RenderTableCell* cell, int totalAutoRowsHeight, int& extraRowSpanningHeight, Vector<int>& rowsHeight) |
{ |
if (!extraRowSpanningHeight || !totalAutoRowsHeight) |
@@ -342,8 +352,7 @@ void RenderTableSection::distributeExtraRowSpanHeightToAutoRows(RenderTableCell* |
// So extra height distributed in auto spanning rows based on their weight in spanning cell. |
for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { |
if (m_grid[row].logicalHeight.isAuto()) { |
- accumulatedPositionIncrease += (extraRowSpanningHeight * rowsHeight[row - rowIndex]) / totalAutoRowsHeight; |
- remainder += (extraRowSpanningHeight * rowsHeight[row - rowIndex]) % totalAutoRowsHeight; |
+ accumulatedPositionIncrease += calcIncreasedRowHeight(extraRowSpanningHeight, rowsHeight[row - rowIndex], totalAutoRowsHeight, remainder); |
// While whole extra spanning height is distributing in auto spanning rows, rational parts remains |
// in every integer division. So accumulating all remainder part in integer division and when total remainder |
@@ -376,8 +385,7 @@ void RenderTableSection::distributeExtraRowSpanHeightToRemainingRows(RenderTable |
// So extra height distribution in remaining spanning rows based on their weight in spanning cell. |
for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { |
if (!m_grid[row].logicalHeight.isPercent()) { |
- accumulatedPositionIncrease += (extraRowSpanningHeight * rowsHeight[row - rowIndex]) / totalRemainingRowsHeight; |
- remainder += (extraRowSpanningHeight * rowsHeight[row - rowIndex]) % totalRemainingRowsHeight; |
+ accumulatedPositionIncrease += calcIncreasedRowHeight(extraRowSpanningHeight, rowsHeight[row - rowIndex], totalRemainingRowsHeight, remainder); |
// While whole extra spanning height is distributing in remaining spanning rows, rational parts remains |
// in every integer division. So accumulating all remainder part in integer division and when total remainder |