| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2002 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2002 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2002 Dirk Mueller (mueller@kde.org) | 3 * (C) 2002 Dirk Mueller (mueller@kde.org) |
| 4 * Copyright (C) 2003, 2006, 2008, 2010 Apple Inc. All rights reserved. | 4 * Copyright (C) 2003, 2006, 2008, 2010 Apple Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License. | 9 * version 2 of the License. |
| 10 * | 10 * |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 static_cast<int>(percent * cellMinLogicalWidth / totalPercent); | 493 static_cast<int>(percent * cellMinLogicalWidth / totalPercent); |
| 494 int columnMaxLogicalWidth = | 494 int columnMaxLogicalWidth = |
| 495 static_cast<int>(percent * cellMaxLogicalWidth / totalPercent); | 495 static_cast<int>(percent * cellMaxLogicalWidth / totalPercent); |
| 496 m_layoutStruct[pos].effectiveMinLogicalWidth = | 496 m_layoutStruct[pos].effectiveMinLogicalWidth = |
| 497 std::max(m_layoutStruct[pos].effectiveMinLogicalWidth, | 497 std::max(m_layoutStruct[pos].effectiveMinLogicalWidth, |
| 498 columnMinLogicalWidth); | 498 columnMinLogicalWidth); |
| 499 m_layoutStruct[pos].effectiveMaxLogicalWidth = columnMaxLogicalWidth; | 499 m_layoutStruct[pos].effectiveMaxLogicalWidth = columnMaxLogicalWidth; |
| 500 allocatedMinLogicalWidth += columnMinLogicalWidth; | 500 allocatedMinLogicalWidth += columnMinLogicalWidth; |
| 501 allocatedMaxLogicalWidth += columnMaxLogicalWidth; | 501 allocatedMaxLogicalWidth += columnMaxLogicalWidth; |
| 502 } | 502 } |
| 503 ASSERT(allocatedMinLogicalWidth <= cellMinLogicalWidth); | 503 DCHECK_LE(allocatedMinLogicalWidth, cellMinLogicalWidth); |
| 504 ASSERT(allocatedMaxLogicalWidth <= cellMaxLogicalWidth); | 504 DCHECK_LE(allocatedMaxLogicalWidth, cellMaxLogicalWidth); |
| 505 cellMinLogicalWidth -= allocatedMinLogicalWidth; | 505 cellMinLogicalWidth -= allocatedMinLogicalWidth; |
| 506 cellMaxLogicalWidth -= allocatedMaxLogicalWidth; | 506 cellMaxLogicalWidth -= allocatedMaxLogicalWidth; |
| 507 } else { | 507 } else { |
| 508 int remainingMaxLogicalWidth = spanMaxLogicalWidth; | 508 int remainingMaxLogicalWidth = spanMaxLogicalWidth; |
| 509 int remainingMinLogicalWidth = spanMinLogicalWidth; | 509 int remainingMinLogicalWidth = spanMinLogicalWidth; |
| 510 | 510 |
| 511 // Give min to variable first, to fixed second, and to others third. | 511 // Give min to variable first, to fixed second, and to others third. |
| 512 for (unsigned pos = effCol; | 512 for (unsigned pos = effCol; |
| 513 remainingMaxLogicalWidth >= 0 && pos < lastCol; ++pos) { | 513 remainingMaxLogicalWidth >= 0 && pos < lastCol; ++pos) { |
| 514 if (m_layoutStruct[pos].logicalWidth.isFixed() && haveAuto && | 514 if (m_layoutStruct[pos].logicalWidth.isFixed() && haveAuto && |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 // between desired width and minwidth. This seems to produce to the pixel | 761 // between desired width and minwidth. This seems to produce to the pixel |
| 762 // exact results with IE. Wonder is some of this also holds for width | 762 // exact results with IE. Wonder is some of this also holds for width |
| 763 // distributing. This is basically the reverse of how we grew the cells. | 763 // distributing. This is basically the reverse of how we grew the cells. |
| 764 if (available < 0) | 764 if (available < 0) |
| 765 shrinkColumnWidth(Auto, available); | 765 shrinkColumnWidth(Auto, available); |
| 766 if (available < 0) | 766 if (available < 0) |
| 767 shrinkColumnWidth(Fixed, available); | 767 shrinkColumnWidth(Fixed, available); |
| 768 if (available < 0) | 768 if (available < 0) |
| 769 shrinkColumnWidth(Percent, available); | 769 shrinkColumnWidth(Percent, available); |
| 770 | 770 |
| 771 ASSERT(m_table->effectiveColumnPositions().size() == nEffCols + 1); | 771 DCHECK_EQ(m_table->effectiveColumnPositions().size(), nEffCols + 1); |
| 772 int pos = 0; | 772 int pos = 0; |
| 773 for (size_t i = 0; i < nEffCols; ++i) { | 773 for (size_t i = 0; i < nEffCols; ++i) { |
| 774 m_table->setEffectiveColumnPosition(i, pos); | 774 m_table->setEffectiveColumnPosition(i, pos); |
| 775 pos += m_layoutStruct[i].computedLogicalWidth + m_table->hBorderSpacing(); | 775 pos += m_layoutStruct[i].computedLogicalWidth + m_table->hBorderSpacing(); |
| 776 } | 776 } |
| 777 // The extra position is for the imaginary column after the last column. | 777 // The extra position is for the imaginary column after the last column. |
| 778 m_table->setEffectiveColumnPosition(nEffCols, pos); | 778 m_table->setEffectiveColumnPosition(nEffCols, pos); |
| 779 } | 779 } |
| 780 | 780 |
| 781 template <typename Total, | 781 template <typename Total, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 int reduce = available * minMaxDiff / logicalWidthBeyondMin; | 853 int reduce = available * minMaxDiff / logicalWidthBeyondMin; |
| 854 m_layoutStruct[i].computedLogicalWidth += reduce; | 854 m_layoutStruct[i].computedLogicalWidth += reduce; |
| 855 available -= reduce; | 855 available -= reduce; |
| 856 logicalWidthBeyondMin -= minMaxDiff; | 856 logicalWidthBeyondMin -= minMaxDiff; |
| 857 if (available >= 0) | 857 if (available >= 0) |
| 858 break; | 858 break; |
| 859 } | 859 } |
| 860 } | 860 } |
| 861 } | 861 } |
| 862 } // namespace blink | 862 } // namespace blink |
| OLD | NEW |