| 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 317                 toAdd = std::min(toAdd, extraRowSpanningHeight); | 317                 toAdd = std::min(toAdd, extraRowSpanningHeight); | 
| 318                 accumulatedPositionIncrease += toAdd; | 318                 accumulatedPositionIncrease += toAdd; | 
| 319                 extraRowSpanningHeight -= toAdd; | 319                 extraRowSpanningHeight -= toAdd; | 
| 320                 percent -= m_grid[row].logicalHeight.percent(); | 320                 percent -= m_grid[row].logicalHeight.percent(); | 
| 321             } | 321             } | 
| 322         } | 322         } | 
| 323         m_rowPos[row + 1] += accumulatedPositionIncrease; | 323         m_rowPos[row + 1] += accumulatedPositionIncrease; | 
| 324     } | 324     } | 
| 325 } | 325 } | 
| 326 | 326 | 
| 327 // Sometimes the multiplication of the 2 values below will overflow an integer. | 327 | 
| 328 // So we convert the parameters to 'long long' instead of 'int' to avoid the | 328 static void updatePositionIncreasedWithRowHeight(int extraHeight, float rowHeigh
      t, float totalHeight, int& accumulatedPositionIncrease, int& remainder) | 
| 329 // problem in this function. |  | 
| 330 static void updatePositionIncreasedWithRowHeight(long long extraHeight, long lon
      g rowHeight, long long totalHeight, int& accumulatedPositionIncrease, int& remai
      nder) |  | 
| 331 { | 329 { | 
| 332     static_assert(sizeof(long long int) > sizeof(int), "int should be smaller th
      an long long"); | 330     static_assert(sizeof(long long int) > sizeof(int), "int should be smaller th
      an long long"); | 
| 333 | 331 | 
| 334     accumulatedPositionIncrease += (extraHeight * rowHeight) / totalHeight; | 332     // Sometimes the multiplication of the 2 values below will overflow a float. | 
| 335     remainder += (extraHeight * rowHeight) % totalHeight; | 333     // So we convert them to 'long long' instead of 'float' to avoid the overflo
      w | 
|  | 334     // and multiply with 100 for taking 2 decimal degits in calculation. | 
|  | 335     long long rHeight = rowHeight * 100; | 
|  | 336     long long tHeight = totalHeight * 100; | 
|  | 337 | 
|  | 338     accumulatedPositionIncrease += (extraHeight * rHeight) / tHeight; | 
|  | 339     remainder += ((extraHeight * rHeight) % tHeight) / 100; | 
| 336 } | 340 } | 
| 337 | 341 | 
| 338 // This is mainly used to distribute whole extra rowspanning height in percent r
      ows when all spanning rows are | 342 // This is mainly used to distribute whole extra rowspanning height in percent r
      ows when all spanning rows are | 
| 339 // percent rows. | 343 // percent rows. | 
| 340 // Distributing whole extra rowspanning height in percent rows based on the rati
      os of percent because this method works | 344 // Distributing whole extra rowspanning height in percent rows based on the rati
      os of percent because this method works | 
| 341 // same as percent distribution when only percent rows are present and percent i
      s 100. Also works perfectly fine when | 345 // same as percent distribution when only percent rows are present and percent i
      s 100. Also works perfectly fine when | 
| 342 // percent is not equal to 100. | 346 // percent is not equal to 100. | 
| 343 void LayoutTableSection::distributeWholeExtraRowSpanHeightToPercentRows(LayoutTa
      bleCell* cell, int totalPercent, int& extraRowSpanningHeight, Vector<int>& rowsH
      eight) | 347 void LayoutTableSection::distributeWholeExtraRowSpanHeightToPercentRows(LayoutTa
      bleCell* cell, float totalPercent, int& extraRowSpanningHeight, Vector<int>& row
      sHeight) | 
| 344 { | 348 { | 
| 345     if (!extraRowSpanningHeight || !totalPercent) | 349     if (!extraRowSpanningHeight || !totalPercent) | 
| 346         return; | 350         return; | 
| 347 | 351 | 
| 348     const unsigned rowSpan = cell->rowSpan(); | 352     const unsigned rowSpan = cell->rowSpan(); | 
| 349     const unsigned rowIndex = cell->rowIndex(); | 353     const unsigned rowIndex = cell->rowIndex(); | 
| 350     int remainder = 0; | 354     int remainder = 0; | 
| 351 | 355 | 
| 352     int accumulatedPositionIncrease = 0; | 356     int accumulatedPositionIncrease = 0; | 
| 353     for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { | 357     for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { | 
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 613             extraHeightToPropagate = m_rowPos[spanningCellEndIndex] - originalBe
      forePosition; | 617             extraHeightToPropagate = m_rowPos[spanningCellEndIndex] - originalBe
      forePosition; | 
| 614             continue; | 618             continue; | 
| 615         } | 619         } | 
| 616 | 620 | 
| 617         if (spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing <= spanni
      ngRowsHeight.totalRowsHeight) { | 621         if (spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing <= spanni
      ngRowsHeight.totalRowsHeight) { | 
| 618             extraHeightToPropagate = m_rowPos[rowIndex + rowSpan] - originalBefo
      rePosition; | 622             extraHeightToPropagate = m_rowPos[rowIndex + rowSpan] - originalBefo
      rePosition; | 
| 619             continue; | 623             continue; | 
| 620         } | 624         } | 
| 621 | 625 | 
| 622         // Below we are handling only row(s) who have at least one visible cell 
      without rowspan value. | 626         // Below we are handling only row(s) who have at least one visible cell 
      without rowspan value. | 
| 623         int totalPercent = 0; | 627         float totalPercent = 0; | 
| 624         int totalAutoRowsHeight = 0; | 628         int totalAutoRowsHeight = 0; | 
| 625         int totalRemainingRowsHeight = spanningRowsHeight.totalRowsHeight; | 629         int totalRemainingRowsHeight = spanningRowsHeight.totalRowsHeight; | 
| 626 | 630 | 
| 627         // FIXME: Inner spanning cell height should not change if it have fixed 
      height when it's parent spanning cell | 631         // FIXME: Inner spanning cell height should not change if it have fixed 
      height when it's parent spanning cell | 
| 628         // is distributing it's extra height in rows. | 632         // is distributing it's extra height in rows. | 
| 629 | 633 | 
| 630         // Calculate total percentage, total auto rows height and total rows hei
      ght except percent rows. | 634         // Calculate total percentage, total auto rows height and total rows hei
      ght except percent rows. | 
| 631         for (unsigned row = rowIndex; row < spanningCellEndIndex; row++) { | 635         for (unsigned row = rowIndex; row < spanningCellEndIndex; row++) { | 
| 632             if (m_grid[row].logicalHeight.isPercent()) { | 636             if (m_grid[row].logicalHeight.isPercent()) { | 
| 633                 totalPercent += m_grid[row].logicalHeight.percent(); | 637                 totalPercent += m_grid[row].logicalHeight.percent(); | 
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1616     // FIXME: The table's direction should determine our row's direction, not th
      e section's (see bug 96691). | 1620     // FIXME: The table's direction should determine our row's direction, not th
      e section's (see bug 96691). | 
| 1617     if (!style()->isLeftToRightDirection()) | 1621     if (!style()->isLeftToRightDirection()) | 
| 1618         cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta
      ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + 
      horizontalBorderSpacing); | 1622         cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta
      ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + 
      horizontalBorderSpacing); | 
| 1619     else | 1623     else | 
| 1620         cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont
      alBorderSpacing); | 1624         cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont
      alBorderSpacing); | 
| 1621 | 1625 | 
| 1622     cell->setLogicalLocation(cellLocation); | 1626     cell->setLogicalLocation(cellLocation); | 
| 1623 } | 1627 } | 
| 1624 | 1628 | 
| 1625 } // namespace blink | 1629 } // namespace blink | 
| OLD | NEW | 
|---|