OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the layout object implementation for KHTML. | 2 * This file is part of the layout object implementation for KHTML. |
3 * | 3 * |
4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
5 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 5 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
6 * Copyright (C) 2003 Apple Computer, Inc. | 6 * Copyright (C) 2003 Apple Computer, Inc. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 } | 641 } |
642 | 642 |
643 // We didn't find any children that could grow. | 643 // We didn't find any children that could grow. |
644 if (haveFlex && !flexingChildren) | 644 if (haveFlex && !flexingChildren) |
645 haveFlex = false; | 645 haveFlex = false; |
646 } | 646 } |
647 } while (haveFlex); | 647 } while (haveFlex); |
648 | 648 |
649 LayoutBlock::finishDelayUpdateScrollInfo(nullptr, nullptr); | 649 LayoutBlock::finishDelayUpdateScrollInfo(nullptr, nullptr); |
650 | 650 |
651 if (remainingSpace > 0 && ((style()->isLeftToRightDirection() && style()->bo
xPack() != Start) | 651 if (remainingSpace > 0 && ((style()->isLeftToRightDirection() && style()->bo
xPack() != BoxPackStart) |
652 || (!style()->isLeftToRightDirection() && style()->boxPack() != End))) { | 652 || (!style()->isLeftToRightDirection() && style()->boxPack() != BoxPackE
nd))) { |
653 // Children must be repositioned. | 653 // Children must be repositioned. |
654 LayoutUnit offset; | 654 LayoutUnit offset; |
655 if (style()->boxPack() == Justify) { | 655 if (style()->boxPack() == BoxPackJustify) { |
656 // Determine the total number of children. | 656 // Determine the total number of children. |
657 int totalChildren = 0; | 657 int totalChildren = 0; |
658 for (LayoutBox* child = iterator.first(); child; child = iterator.ne
xt()) { | 658 for (LayoutBox* child = iterator.first(); child; child = iterator.ne
xt()) { |
659 if (childDoesNotAffectWidthOrFlexing(child)) | 659 if (childDoesNotAffectWidthOrFlexing(child)) |
660 continue; | 660 continue; |
661 ++totalChildren; | 661 ++totalChildren; |
662 } | 662 } |
663 | 663 |
664 // Iterate over the children and space them out according to the | 664 // Iterate over the children and space them out according to the |
665 // justification level. | 665 // justification level. |
(...skipping 10 matching lines...) Expand all Loading... |
676 } | 676 } |
677 | 677 |
678 offset += remainingSpace / totalChildren; | 678 offset += remainingSpace / totalChildren; |
679 remainingSpace -= (remainingSpace / totalChildren); | 679 remainingSpace -= (remainingSpace / totalChildren); |
680 --totalChildren; | 680 --totalChildren; |
681 | 681 |
682 placeChild(child, child->location() + LayoutSize(offset, Lay
outUnit())); | 682 placeChild(child, child->location() + LayoutSize(offset, Lay
outUnit())); |
683 } | 683 } |
684 } | 684 } |
685 } else { | 685 } else { |
686 if (style()->boxPack() == Center) | 686 if (style()->boxPack() == BoxPackCenter) |
687 offset += remainingSpace / 2; | 687 offset += remainingSpace / 2; |
688 else // END for LTR, START for RTL | 688 else // END for LTR, START for RTL |
689 offset += remainingSpace; | 689 offset += remainingSpace; |
690 for (LayoutBox* child = iterator.first(); child; child = iterator.ne
xt()) { | 690 for (LayoutBox* child = iterator.first(); child; child = iterator.ne
xt()) { |
691 if (childDoesNotAffectWidthOrFlexing(child)) | 691 if (childDoesNotAffectWidthOrFlexing(child)) |
692 continue; | 692 continue; |
693 | 693 |
694 placeChild(child, child->location() + LayoutSize(offset, LayoutU
nit())); | 694 placeChild(child, child->location() + LayoutSize(offset, LayoutU
nit())); |
695 } | 695 } |
696 } | 696 } |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 } | 892 } |
893 | 893 |
894 // We didn't find any children that could grow. | 894 // We didn't find any children that could grow. |
895 if (haveFlex && !flexingChildren) | 895 if (haveFlex && !flexingChildren) |
896 haveFlex = false; | 896 haveFlex = false; |
897 } | 897 } |
898 } while (haveFlex); | 898 } while (haveFlex); |
899 | 899 |
900 LayoutBlock::finishDelayUpdateScrollInfo(nullptr, nullptr); | 900 LayoutBlock::finishDelayUpdateScrollInfo(nullptr, nullptr); |
901 | 901 |
902 if (style()->boxPack() != Start && remainingSpace > 0) { | 902 if (style()->boxPack() != BoxPackStart && remainingSpace > 0) { |
903 // Children must be repositioned. | 903 // Children must be repositioned. |
904 LayoutUnit offset; | 904 LayoutUnit offset; |
905 if (style()->boxPack() == Justify) { | 905 if (style()->boxPack() == BoxPackJustify) { |
906 // Determine the total number of children. | 906 // Determine the total number of children. |
907 int totalChildren = 0; | 907 int totalChildren = 0; |
908 for (LayoutBox* child = iterator.first(); child; child = iterator.ne
xt()) { | 908 for (LayoutBox* child = iterator.first(); child; child = iterator.ne
xt()) { |
909 if (childDoesNotAffectWidthOrFlexing(child)) | 909 if (childDoesNotAffectWidthOrFlexing(child)) |
910 continue; | 910 continue; |
911 | 911 |
912 ++totalChildren; | 912 ++totalChildren; |
913 } | 913 } |
914 | 914 |
915 // Iterate over the children and space them out according to the | 915 // Iterate over the children and space them out according to the |
(...skipping 10 matching lines...) Expand all Loading... |
926 continue; | 926 continue; |
927 } | 927 } |
928 | 928 |
929 offset += remainingSpace / totalChildren; | 929 offset += remainingSpace / totalChildren; |
930 remainingSpace -= (remainingSpace / totalChildren); | 930 remainingSpace -= (remainingSpace / totalChildren); |
931 --totalChildren; | 931 --totalChildren; |
932 placeChild(child, child->location() + LayoutSize(LayoutUnit(
), offset)); | 932 placeChild(child, child->location() + LayoutSize(LayoutUnit(
), offset)); |
933 } | 933 } |
934 } | 934 } |
935 } else { | 935 } else { |
936 if (style()->boxPack() == Center) | 936 if (style()->boxPack() == BoxPackCenter) |
937 offset += remainingSpace / 2; | 937 offset += remainingSpace / 2; |
938 else // END | 938 else // END |
939 offset += remainingSpace; | 939 offset += remainingSpace; |
940 for (LayoutBox* child = iterator.first(); child; child = iterator.ne
xt()) { | 940 for (LayoutBox* child = iterator.first(); child; child = iterator.ne
xt()) { |
941 if (childDoesNotAffectWidthOrFlexing(child)) | 941 if (childDoesNotAffectWidthOrFlexing(child)) |
942 continue; | 942 continue; |
943 placeChild(child, child->location() + LayoutSize(LayoutUnit(), o
ffset)); | 943 placeChild(child, child->location() + LayoutSize(LayoutUnit(), o
ffset)); |
944 } | 944 } |
945 } | 945 } |
946 } | 946 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 if (minHeight.isFixed() || minHeight.isAuto()) { | 1112 if (minHeight.isFixed() || minHeight.isAuto()) { |
1113 LayoutUnit minHeight(child->style()->minHeight().value()); | 1113 LayoutUnit minHeight(child->style()->minHeight().value()); |
1114 LayoutUnit height = contentHeightForChild(child); | 1114 LayoutUnit height = contentHeightForChild(child); |
1115 LayoutUnit allowedShrinkage = (minHeight - height).clampPositiveToZero()
; | 1115 LayoutUnit allowedShrinkage = (minHeight - height).clampPositiveToZero()
; |
1116 return allowedShrinkage; | 1116 return allowedShrinkage; |
1117 } | 1117 } |
1118 return LayoutUnit(); | 1118 return LayoutUnit(); |
1119 } | 1119 } |
1120 | 1120 |
1121 } // namespace blink | 1121 } // namespace blink |
OLD | NEW |