Chromium Code Reviews| 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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 538 numFixed++; | 538 numFixed++; |
| 539 totalFixed += m_layoutStruct[i].clampedEffectiveMaxLogicalWidth(); | 539 totalFixed += m_layoutStruct[i].clampedEffectiveMaxLogicalWidth(); |
| 540 // fall through | 540 // fall through |
| 541 break; | 541 break; |
| 542 case Auto: | 542 case Auto: |
| 543 if (m_layoutStruct[i].emptyCellsOnly) { | 543 if (m_layoutStruct[i].emptyCellsOnly) { |
| 544 numAutoEmptyCellsOnly++; | 544 numAutoEmptyCellsOnly++; |
| 545 } else { | 545 } else { |
| 546 numAuto++; | 546 numAuto++; |
| 547 totalAuto += m_layoutStruct[i].clampedEffectiveMaxLogicalWidth() ; | 547 totalAuto += m_layoutStruct[i].clampedEffectiveMaxLogicalWidth() ; |
| 548 } | |
| 549 if (!m_layoutStruct[i].columnHasNoCells) | |
| 548 allocAuto += cellLogicalWidth; | 550 allocAuto += cellLogicalWidth; |
| 549 } | |
| 550 break; | 551 break; |
| 551 default: | 552 default: |
| 552 break; | 553 break; |
| 553 } | 554 } |
| 554 } | 555 } |
| 555 | 556 |
| 556 // allocate width to percent cols | 557 // allocate width to percent cols |
| 557 if (available > 0 && havePercent) { | 558 if (available > 0 && havePercent) { |
| 558 for (size_t i = 0; i < nEffCols; ++i) { | 559 for (size_t i = 0; i < nEffCols; ++i) { |
| 559 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; | 560 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 592 } | 593 } |
| 593 } | 594 } |
| 594 | 595 |
| 595 // Give each auto width column its share of the available width, non-empty c olumns then empty columns. | 596 // Give each auto width column its share of the available width, non-empty c olumns then empty columns. |
| 596 if (available > 0 && numAuto) { | 597 if (available > 0 && numAuto) { |
| 597 available += allocAuto; | 598 available += allocAuto; |
| 598 distributeWidthToColumns<float, Auto, NonEmptyCells, InitialWidth, Start ToEnd>(available, totalAuto); | 599 distributeWidthToColumns<float, Auto, NonEmptyCells, InitialWidth, Start ToEnd>(available, totalAuto); |
| 599 } | 600 } |
| 600 if (available > 0 && numAutoEmptyCellsOnly) { | 601 if (available > 0 && numAutoEmptyCellsOnly) { |
| 601 unsigned total = numAutoEmptyCellsOnly; | 602 unsigned total = numAutoEmptyCellsOnly; |
| 603 available += allocAuto; | |
|
mstensho (USE GERRIT)
2015/09/30 11:09:39
|available| already contains |allocAuto|, if |numA
| |
| 602 distributeWidthToColumns<unsigned, Auto, EmptyCells, InitialWidth, Start ToEnd>(available, total); | 604 distributeWidthToColumns<unsigned, Auto, EmptyCells, InitialWidth, Start ToEnd>(available, total); |
| 603 } | 605 } |
| 604 | 606 |
| 605 // Any remaining available width expands fixed width, percent width, and non -empty auto width columns, in that order. | 607 // Any remaining available width expands fixed width, percent width, and non -empty auto width columns, in that order. |
| 606 if (available > 0 && numFixed) | 608 if (available > 0 && numFixed) |
| 607 distributeWidthToColumns<float, Fixed, AllCells, ExtraWidth, StartToEnd> (available, totalFixed); | 609 distributeWidthToColumns<float, Fixed, AllCells, ExtraWidth, StartToEnd> (available, totalFixed); |
| 608 | 610 |
| 609 if (available > 0 && m_hasPercent && totalPercent < 100) | 611 if (available > 0 && m_hasPercent && totalPercent < 100) |
| 610 distributeWidthToColumns<float, Percent, AllCells, ExtraWidth, StartToEn d>(available, totalPercent); | 612 distributeWidthToColumns<float, Percent, AllCells, ExtraWidth, StartToEn d>(available, totalPercent); |
| 611 | 613 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 692 int reduce = available * minMaxDiff / logicalWidthBeyondMin; | 694 int reduce = available * minMaxDiff / logicalWidthBeyondMin; |
| 693 m_layoutStruct[i].computedLogicalWidth += reduce; | 695 m_layoutStruct[i].computedLogicalWidth += reduce; |
| 694 available -= reduce; | 696 available -= reduce; |
| 695 logicalWidthBeyondMin -= minMaxDiff; | 697 logicalWidthBeyondMin -= minMaxDiff; |
| 696 if (available >= 0) | 698 if (available >= 0) |
| 697 break; | 699 break; |
| 698 } | 700 } |
| 699 } | 701 } |
| 700 } | 702 } |
| 701 } | 703 } |
| OLD | NEW |