Index: Source/core/rendering/RenderTableSection.cpp |
diff --git a/Source/core/rendering/RenderTableSection.cpp b/Source/core/rendering/RenderTableSection.cpp |
index d0e9ba961b9e24556333e02eb4e43e5edbe99931..913692d3bdfa7d914e8e87ddc34c628daa91df68 100644 |
--- a/Source/core/rendering/RenderTableSection.cpp |
+++ b/Source/core/rendering/RenderTableSection.cpp |
@@ -328,6 +328,18 @@ void RenderTableSection::distributeExtraRowSpanHeightToPercentRows(RenderTableCe |
} |
} |
+// Some time multiplication of below 2 values is overflowing from integer. So |
Julien - ping for review
2014/03/21 04:18:05
In correct English:
Sometimes the multiplication
a.suchit
2014/03/24 10:53:59
Done.
|
+// type of variable in computation are taken as 'long long' in place of int. |
Julien - ping for review
2014/03/21 04:18:05
So we convert the parameters to 'long long' instea
a.suchit
2014/03/24 10:53:59
Done.
|
+// In this computation, only 2 integer variables are multiplied which would not |
Julien - ping for review
2014/03/21 04:18:05
This sentence really doesn't add much IMO.
|
+// overflow long long. |
+static void updatePositionIncreasedWithRowHeight(long long extraHeight, long long rowHeight, long long totalHeight, int& accumulatedPositionIncrease, int& remainder) |
+{ |
+ COMPILE_ASSERT(sizeof(long long int) > sizeof(int), int_should_be_less_than_longlong); |
+ |
+ accumulatedPositionIncrease += (extraHeight * rowHeight) / totalHeight; |
+ remainder += (extraHeight * rowHeight) % totalHeight; |
+} |
+ |
void RenderTableSection::distributeExtraRowSpanHeightToAutoRows(RenderTableCell* cell, int totalAutoRowsHeight, int& extraRowSpanningHeight, Vector<int>& rowsHeight) |
{ |
if (!extraRowSpanningHeight || !totalAutoRowsHeight) |
@@ -342,8 +354,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; |
+ updatePositionIncreasedWithRowHeight(extraRowSpanningHeight, rowsHeight[row - rowIndex], totalAutoRowsHeight, accumulatedPositionIncrease, 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 +387,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; |
+ updatePositionIncreasedWithRowHeight(extraRowSpanningHeight, rowsHeight[row - rowIndex], totalRemainingRowsHeight, accumulatedPositionIncrease, 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 |