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 Apple Inc. All rights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 | 335 |
336 const unsigned rowSpan = cell->rowSpan(); | 336 const unsigned rowSpan = cell->rowSpan(); |
337 const unsigned rowIndex = cell->rowIndex(); | 337 const unsigned rowIndex = cell->rowIndex(); |
338 int accumulatedPositionIncrease = 0; | 338 int accumulatedPositionIncrease = 0; |
339 int remainder = 0; | 339 int remainder = 0; |
340 | 340 |
341 // Aspect ratios of auto rows should not change otherwise table may look dif ferent than user expected. | 341 // Aspect ratios of auto rows should not change otherwise table may look dif ferent than user expected. |
342 // So extra height distributed in auto spanning rows based on their weight i n spanning cell. | 342 // So extra height distributed in auto spanning rows based on their weight i n spanning cell. |
343 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { | 343 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { |
344 if (m_grid[row].logicalHeight.isAuto()) { | 344 if (m_grid[row].logicalHeight.isAuto()) { |
345 accumulatedPositionIncrease += (extraRowSpanningHeight * rowsHeight[ row - rowIndex]) / totalAutoRowsHeight; | 345 // Some time multiplecation of below 2 values is getting overflowing from integer. So |
346 remainder += (extraRowSpanningHeight * rowsHeight[row - rowIndex]) % totalAutoRowsHeight; | 346 // One of the variable in calculation typecasted with 'long long'. |
leviw_travelin_and_unemployed
2014/03/05 23:01:43
There are some grammar ("getting overflowing"), sp
a.suchit
2014/03/10 09:37:56
Done.
| |
347 // Final result of below calculation would not be more than extraRow SpanningHeight because | |
348 // 'totalAutoRowsHeight' would be equal or more than auto row height . | |
349 accumulatedPositionIncrease += ((long long)extraRowSpanningHeight * rowsHeight[row - rowIndex]) / totalAutoRowsHeight; | |
leviw_travelin_and_unemployed
2014/03/05 23:01:43
I'm not sure if this is the fix we want, but I'd e
Julien - ping for review
2014/03/06 00:29:18
This doesn't solve the problem in general as the i
a.suchit
2014/03/10 09:37:56
Removing the assert will just prevent assertion fa
a.suchit
2014/03/10 09:37:56
Done.
Julien - ping for review
2014/03/10 18:36:39
You're assuming a certain platform. C allows integ
| |
350 remainder += ((long long)extraRowSpanningHeight * rowsHeight[row - r owIndex]) % totalAutoRowsHeight; | |
347 | 351 |
348 // While whole extra spanning height is distributing in auto spannin g rows, rational parts remains | 352 // While whole extra spanning height is distributing in auto spannin g rows, rational parts remains |
349 // in every integer division. So accumulating all remainder part in integer division and when total remainder | 353 // in every integer division. So accumulating all remainder part in integer division and when total remainder |
350 // is equvalent to divisor then 1 unit increased in row position. | 354 // is equvalent to divisor then 1 unit increased in row position. |
351 // Note that this algorithm is biased towards adding more space towa rds the lower rows. | 355 // Note that this algorithm is biased towards adding more space towa rds the lower rows. |
352 if (remainder >= totalAutoRowsHeight) { | 356 if (remainder >= totalAutoRowsHeight) { |
353 remainder -= totalAutoRowsHeight; | 357 remainder -= totalAutoRowsHeight; |
354 accumulatedPositionIncrease++; | 358 accumulatedPositionIncrease++; |
355 } | 359 } |
356 } | 360 } |
(...skipping 12 matching lines...) Expand all Loading... | |
369 | 373 |
370 const unsigned rowSpan = cell->rowSpan(); | 374 const unsigned rowSpan = cell->rowSpan(); |
371 const unsigned rowIndex = cell->rowIndex(); | 375 const unsigned rowIndex = cell->rowIndex(); |
372 int accumulatedPositionIncrease = 0; | 376 int accumulatedPositionIncrease = 0; |
373 int remainder = 0; | 377 int remainder = 0; |
374 | 378 |
375 // Aspect ratios of the rows should not change otherwise table may look diff erent than user expected. | 379 // Aspect ratios of the rows should not change otherwise table may look diff erent than user expected. |
376 // So extra height distribution in remaining spanning rows based on their we ight in spanning cell. | 380 // So extra height distribution in remaining spanning rows based on their we ight in spanning cell. |
377 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { | 381 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { |
378 if (!m_grid[row].logicalHeight.isPercent()) { | 382 if (!m_grid[row].logicalHeight.isPercent()) { |
379 accumulatedPositionIncrease += (extraRowSpanningHeight * rowsHeight[ row - rowIndex]) / totalRemainingRowsHeight; | 383 // Some time multiplecation of below 2 values is getting overflowing from integer. So |
380 remainder += (extraRowSpanningHeight * rowsHeight[row - rowIndex]) % totalRemainingRowsHeight; | 384 // One of the variable in calculation typecasted with 'long long'. |
385 // Final result of below calculation would not be more than extraRow SpanningHeight because | |
386 // 'totalAutoRowsHeight' would be equal or more than auto row height . | |
387 accumulatedPositionIncrease += ((long long)extraRowSpanningHeight * rowsHeight[row - rowIndex]) / totalRemainingRowsHeight; | |
388 remainder += ((long long)extraRowSpanningHeight * rowsHeight[row - r owIndex]) % totalRemainingRowsHeight; | |
381 | 389 |
382 // While whole extra spanning height is distributing in remaining sp anning rows, rational parts remains | 390 // While whole extra spanning height is distributing in remaining sp anning rows, rational parts remains |
383 // in every integer division. So accumulating all remainder part in integer division and when total remainder | 391 // in every integer division. So accumulating all remainder part in integer division and when total remainder |
384 // is equvalent to divisor then 1 unit increased in row position. | 392 // is equvalent to divisor then 1 unit increased in row position. |
385 // Note that this algorithm is biased towards adding more space towa rds the lower rows. | 393 // Note that this algorithm is biased towards adding more space towa rds the lower rows. |
386 if (remainder >= totalRemainingRowsHeight) { | 394 if (remainder >= totalRemainingRowsHeight) { |
387 remainder -= totalRemainingRowsHeight; | 395 remainder -= totalRemainingRowsHeight; |
388 accumulatedPositionIncrease++; | 396 accumulatedPositionIncrease++; |
389 } | 397 } |
390 } | 398 } |
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1727 else | 1735 else |
1728 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); | 1736 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); |
1729 | 1737 |
1730 cell->setLogicalLocation(cellLocation); | 1738 cell->setLogicalLocation(cellLocation); |
1731 | 1739 |
1732 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) | 1740 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) |
1733 view()->addLayoutDelta(oldCellLocation - cell->location()); | 1741 view()->addLayoutDelta(oldCellLocation - cell->location()); |
1734 } | 1742 } |
1735 | 1743 |
1736 } // namespace WebCore | 1744 } // namespace WebCore |
OLD | NEW |