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 26 matching lines...) Expand all Loading... |
586 for (size_t i = 0; i < nEffCols; ++i) { | 587 for (size_t i = 0; i < nEffCols; ++i) { |
587 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; | 588 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; |
588 if (logicalWidth.isFixed() && logicalWidth.value() > m_layoutStruct[
i].computedLogicalWidth) { | 589 if (logicalWidth.isFixed() && logicalWidth.value() > m_layoutStruct[
i].computedLogicalWidth) { |
589 available += m_layoutStruct[i].computedLogicalWidth - logicalWid
th.value(); | 590 available += m_layoutStruct[i].computedLogicalWidth - logicalWid
th.value(); |
590 m_layoutStruct[i].computedLogicalWidth = logicalWidth.value(); | 591 m_layoutStruct[i].computedLogicalWidth = logicalWidth.value(); |
591 } | 592 } |
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 || numAutoEmptyCellsOnly)) { |
597 available += allocAuto; | 598 available += allocAuto; |
598 distributeWidthToColumns<float, Auto, NonEmptyCells, InitialWidth, Start
ToEnd>(available, totalAuto); | 599 if (numAuto) |
599 } | 600 distributeWidthToColumns<float, Auto, NonEmptyCells, InitialWidth, S
tartToEnd>(available, totalAuto); |
600 if (available > 0 && numAutoEmptyCellsOnly) { | 601 if (numAutoEmptyCellsOnly) |
601 unsigned total = numAutoEmptyCellsOnly; | 602 distributeWidthToColumns<unsigned, Auto, EmptyCells, InitialWidth, S
tartToEnd>(available, numAutoEmptyCellsOnly); |
602 distributeWidthToColumns<unsigned, Auto, EmptyCells, InitialWidth, Start
ToEnd>(available, total); | |
603 } | 603 } |
604 | 604 |
605 // Any remaining available width expands fixed width, percent width, and non
-empty auto width columns, in that order. | 605 // Any remaining available width expands fixed width, percent width, and non
-empty auto width columns, in that order. |
606 if (available > 0 && numFixed) | 606 if (available > 0 && numFixed) |
607 distributeWidthToColumns<float, Fixed, AllCells, ExtraWidth, StartToEnd>
(available, totalFixed); | 607 distributeWidthToColumns<float, Fixed, AllCells, ExtraWidth, StartToEnd>
(available, totalFixed); |
608 | 608 |
609 if (available > 0 && m_hasPercent && totalPercent < 100) | 609 if (available > 0 && m_hasPercent && totalPercent < 100) |
610 distributeWidthToColumns<float, Percent, AllCells, ExtraWidth, StartToEn
d>(available, totalPercent); | 610 distributeWidthToColumns<float, Percent, AllCells, ExtraWidth, StartToEn
d>(available, totalPercent); |
611 | 611 |
612 if (available > 0 && nEffCols > numAutoEmptyCellsOnly) { | 612 if (available > 0 && nEffCols > numAutoEmptyCellsOnly) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 int reduce = available * minMaxDiff / logicalWidthBeyondMin; | 692 int reduce = available * minMaxDiff / logicalWidthBeyondMin; |
693 m_layoutStruct[i].computedLogicalWidth += reduce; | 693 m_layoutStruct[i].computedLogicalWidth += reduce; |
694 available -= reduce; | 694 available -= reduce; |
695 logicalWidthBeyondMin -= minMaxDiff; | 695 logicalWidthBeyondMin -= minMaxDiff; |
696 if (available >= 0) | 696 if (available >= 0) |
697 break; | 697 break; |
698 } | 698 } |
699 } | 699 } |
700 } | 700 } |
701 } | 701 } |
OLD | NEW |