OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the render object implementation for KHTML. | 2 * This file is part of the render 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 margin += marginRight.value(); | 143 margin += marginRight.value(); |
144 return margin; | 144 return margin; |
145 } | 145 } |
146 | 146 |
147 static bool childDoesNotAffectWidthOrFlexing(RenderObject* child) | 147 static bool childDoesNotAffectWidthOrFlexing(RenderObject* child) |
148 { | 148 { |
149 // Positioned children and collapsed children don't affect the min/max width
. | 149 // Positioned children and collapsed children don't affect the min/max width
. |
150 return child->isPositioned() || child->style()->visibility() == COLLAPSE; | 150 return child->isPositioned() || child->style()->visibility() == COLLAPSE; |
151 } | 151 } |
152 | 152 |
| 153 void RenderDeprecatedFlexibleBox::styleWillChange(StyleDifference diff, const Re
nderStyle* newStyle) |
| 154 { |
| 155 RenderStyle* oldStyle = style(); |
| 156 if (oldStyle && !oldStyle->lineClamp().isNone() && newStyle->lineClamp().isN
one()) |
| 157 clearLineClamp(); |
| 158 |
| 159 RenderBlock::styleWillChange(diff, newStyle); |
| 160 } |
| 161 |
153 void RenderDeprecatedFlexibleBox::calcHorizontalPrefWidths() | 162 void RenderDeprecatedFlexibleBox::calcHorizontalPrefWidths() |
154 { | 163 { |
155 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo
x()) { | 164 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo
x()) { |
156 if (childDoesNotAffectWidthOrFlexing(child)) | 165 if (childDoesNotAffectWidthOrFlexing(child)) |
157 continue; | 166 continue; |
158 | 167 |
159 LayoutUnit margin = marginWidthForChild(child); | 168 LayoutUnit margin = marginWidthForChild(child); |
160 m_minPreferredLogicalWidth += child->minPreferredLogicalWidth() + margin
; | 169 m_minPreferredLogicalWidth += child->minPreferredLogicalWidth() + margin
; |
161 m_maxPreferredLogicalWidth += child->maxPreferredLogicalWidth() + margin
; | 170 m_maxPreferredLogicalWidth += child->maxPreferredLogicalWidth() + margin
; |
162 } | 171 } |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 LayoutUnit blockEdge = leftToRight ? blockRightEdge : blockLeftEdge; | 977 LayoutUnit blockEdge = leftToRight ? blockRightEdge : blockLeftEdge; |
969 if (!lastVisibleLine->lineCanAccommodateEllipsis(leftToRight, blockEdge,
lastVisibleLine->x() + lastVisibleLine->logicalWidth(), totalWidth)) | 978 if (!lastVisibleLine->lineCanAccommodateEllipsis(leftToRight, blockEdge,
lastVisibleLine->x() + lastVisibleLine->logicalWidth(), totalWidth)) |
970 continue; | 979 continue; |
971 | 980 |
972 // Let the truncation code kick in. | 981 // Let the truncation code kick in. |
973 lastVisibleLine->placeEllipsis(anchorBox ? ellipsisAndSpaceStr : ellipsi
sStr, leftToRight, blockLeftEdge, blockRightEdge, totalWidth, anchorBox); | 982 lastVisibleLine->placeEllipsis(anchorBox ? ellipsisAndSpaceStr : ellipsi
sStr, leftToRight, blockLeftEdge, blockRightEdge, totalWidth, anchorBox); |
974 destBlock->setHasMarkupTruncation(true); | 983 destBlock->setHasMarkupTruncation(true); |
975 } | 984 } |
976 } | 985 } |
977 | 986 |
| 987 void RenderDeprecatedFlexibleBox::clearLineClamp() |
| 988 { |
| 989 FlexBoxIterator iterator(this); |
| 990 for (RenderBox* child = iterator.first(); child; child = iterator.next()) { |
| 991 if (childDoesNotAffectWidthOrFlexing(child)) |
| 992 continue; |
| 993 |
| 994 if ((child->isReplaced() && (child->style()->width().isPercent() || chil
d->style()->height().isPercent())) |
| 995 || (child->style()->height().isAuto() && child->isBlockFlow())) { |
| 996 child->setChildNeedsLayout(true); |
| 997 |
| 998 if (child->isRenderBlock()) { |
| 999 toRenderBlock(child)->markPositionedObjectsForLayout(); |
| 1000 toRenderBlock(child)->clearTruncation(); |
| 1001 } |
| 1002 } |
| 1003 } |
| 1004 } |
| 1005 |
978 void RenderDeprecatedFlexibleBox::placeChild(RenderBox* child, const LayoutPoint
& location) | 1006 void RenderDeprecatedFlexibleBox::placeChild(RenderBox* child, const LayoutPoint
& location) |
979 { | 1007 { |
980 LayoutRect oldRect = child->frameRect(); | 1008 LayoutRect oldRect = child->frameRect(); |
981 | 1009 |
982 // Place the child. | 1010 // Place the child. |
983 child->setLocation(location); | 1011 child->setLocation(location); |
984 | 1012 |
985 // If the child moved, we have to repaint it as well as any floating/positio
ned | 1013 // If the child moved, we have to repaint it as well as any floating/positio
ned |
986 // descendants. An exception is if we need a layout. In this case, we know
we're going to | 1014 // descendants. An exception is if we need a layout. In this case, we know
we're going to |
987 // repaint ourselves (and the child) anyway. | 1015 // repaint ourselves (and the child) anyway. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 if (isPositioned()) | 1080 if (isPositioned()) |
1053 return "RenderDeprecatedFlexibleBox (positioned)"; | 1081 return "RenderDeprecatedFlexibleBox (positioned)"; |
1054 if (isAnonymous()) | 1082 if (isAnonymous()) |
1055 return "RenderDeprecatedFlexibleBox (generated)"; | 1083 return "RenderDeprecatedFlexibleBox (generated)"; |
1056 if (isRelPositioned()) | 1084 if (isRelPositioned()) |
1057 return "RenderDeprecatedFlexibleBox (relative positioned)"; | 1085 return "RenderDeprecatedFlexibleBox (relative positioned)"; |
1058 return "RenderDeprecatedFlexibleBox"; | 1086 return "RenderDeprecatedFlexibleBox"; |
1059 } | 1087 } |
1060 | 1088 |
1061 } // namespace WebCore | 1089 } // namespace WebCore |
OLD | NEW |