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 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 if (childDoesNotAffectWidthOrFlexing(child) || child->style()->boxFlex() ==
0.0f || child->style()->boxFlexGroup() != group) | 956 if (childDoesNotAffectWidthOrFlexing(child) || child->style()->boxFlex() ==
0.0f || child->style()->boxFlexGroup() != group) |
957 return 0; | 957 return 0; |
958 | 958 |
959 if (expanding) { | 959 if (expanding) { |
960 if (isHorizontal()) { | 960 if (isHorizontal()) { |
961 // FIXME: For now just handle fixed values. | 961 // FIXME: For now just handle fixed values. |
962 LayoutUnit maxWidth = LayoutUnit::max(); | 962 LayoutUnit maxWidth = LayoutUnit::max(); |
963 LayoutUnit width = contentWidthForChild(child); | 963 LayoutUnit width = contentWidthForChild(child); |
964 if (child->style()->maxWidth().isFixed()) | 964 if (child->style()->maxWidth().isFixed()) |
965 maxWidth = child->style()->maxWidth().value(); | 965 maxWidth = child->style()->maxWidth().value(); |
966 else if (child->style()->maxWidth().type() == Intrinsic) | |
967 maxWidth = child->maxPreferredLogicalWidth(); | |
968 else if (child->style()->maxWidth().type() == MinIntrinsic) | |
969 maxWidth = child->minPreferredLogicalWidth(); | |
970 if (maxWidth == LayoutUnit::max()) | 966 if (maxWidth == LayoutUnit::max()) |
971 return maxWidth; | 967 return maxWidth; |
972 return std::max<LayoutUnit>(0, maxWidth - width); | 968 return std::max<LayoutUnit>(0, maxWidth - width); |
973 } | 969 } |
974 // FIXME: For now just handle fixed values. | 970 // FIXME: For now just handle fixed values. |
975 LayoutUnit maxHeight = LayoutUnit::max(); | 971 LayoutUnit maxHeight = LayoutUnit::max(); |
976 LayoutUnit height = contentHeightForChild(child); | 972 LayoutUnit height = contentHeightForChild(child); |
977 if (child->style()->maxHeight().isFixed()) | 973 if (child->style()->maxHeight().isFixed()) |
978 maxHeight = child->style()->maxHeight().value(); | 974 maxHeight = child->style()->maxHeight().value(); |
979 if (maxHeight == LayoutUnit::max()) | 975 if (maxHeight == LayoutUnit::max()) |
980 return maxHeight; | 976 return maxHeight; |
981 return std::max<LayoutUnit>(0, maxHeight - height); | 977 return std::max<LayoutUnit>(0, maxHeight - height); |
982 } | 978 } |
983 | 979 |
984 // FIXME: For now just handle fixed values. | 980 // FIXME: For now just handle fixed values. |
985 if (isHorizontal()) { | 981 if (isHorizontal()) { |
986 LayoutUnit minWidth = child->minPreferredLogicalWidth(); | 982 LayoutUnit minWidth = child->minPreferredLogicalWidth(); |
987 LayoutUnit width = contentWidthForChild(child); | 983 LayoutUnit width = contentWidthForChild(child); |
988 if (child->style()->minWidth().isFixed()) | 984 if (child->style()->minWidth().isFixed()) |
989 minWidth = child->style()->minWidth().value(); | 985 minWidth = child->style()->minWidth().value(); |
990 else if (child->style()->minWidth().type() == Intrinsic) | |
991 minWidth = child->maxPreferredLogicalWidth(); | |
992 else if (child->style()->minWidth().type() == MinIntrinsic) | |
993 minWidth = child->minPreferredLogicalWidth(); | |
994 else if (child->style()->minWidth().type() == Auto) | 986 else if (child->style()->minWidth().type() == Auto) |
995 minWidth = 0; | 987 minWidth = 0; |
996 | 988 |
997 LayoutUnit allowedShrinkage = std::min<LayoutUnit>(0, minWidth - width); | 989 LayoutUnit allowedShrinkage = std::min<LayoutUnit>(0, minWidth - width); |
998 return allowedShrinkage; | 990 return allowedShrinkage; |
999 } | 991 } |
1000 Length minHeight = child->style()->minHeight(); | 992 Length minHeight = child->style()->minHeight(); |
1001 if (minHeight.isFixed() || minHeight.isAuto()) { | 993 if (minHeight.isFixed() || minHeight.isAuto()) { |
1002 LayoutUnit minHeight = child->style()->minHeight().value(); | 994 LayoutUnit minHeight = child->style()->minHeight().value(); |
1003 LayoutUnit height = contentHeightForChild(child); | 995 LayoutUnit height = contentHeightForChild(child); |
1004 LayoutUnit allowedShrinkage = std::min<LayoutUnit>(0, minHeight - height
); | 996 LayoutUnit allowedShrinkage = std::min<LayoutUnit>(0, minHeight - height
); |
1005 return allowedShrinkage; | 997 return allowedShrinkage; |
1006 } | 998 } |
1007 return 0; | 999 return 0; |
1008 } | 1000 } |
1009 | 1001 |
1010 } // namespace blink | 1002 } // namespace blink |
OLD | NEW |