OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
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 6116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6127 | 6127 |
6128 if (t->style()->hasTextCombine() && t->isCombineText()) | 6128 if (t->style()->hasTextCombine() && t->isCombineText()) |
6129 toRenderCombineText(t)->combineText(); | 6129 toRenderCombineText(t)->combineText(); |
6130 | 6130 |
6131 // Determine if we have a breakable character. Pass in | 6131 // Determine if we have a breakable character. Pass in |
6132 // whether or not we should ignore any spaces at the front | 6132 // whether or not we should ignore any spaces at the front |
6133 // of the string. If those are going to be stripped out, | 6133 // of the string. If those are going to be stripped out, |
6134 // then they shouldn't be considered in the breakable char | 6134 // then they shouldn't be considered in the breakable char |
6135 // check. | 6135 // check. |
6136 bool hasBreakableChar, hasBreak; | 6136 bool hasBreakableChar, hasBreak; |
6137 float beginMin, endMin; | 6137 float firstLineMinWidth, lastLineMinWidth; |
6138 bool beginWS, endWS; | 6138 bool hasBreakableStart, hasBreakableEnd; |
6139 float beginMax, endMax; | 6139 float firstLineMaxWidth, lastLineMaxWidth; |
6140 t->trimmedPrefWidths(inlineMax, beginMin, beginWS, endMin, endWS
, | 6140 t->trimmedPrefWidths(inlineMax, |
6141 hasBreakableChar, hasBreak, beginMax, endMa
x, | 6141 firstLineMinWidth, hasBreakableStart, lastLineMinWidth, hasB
reakableEnd, |
6142 childMin, childMax, stripFrontSpaces); | 6142 hasBreakableChar, hasBreak, firstLineMaxWidth, lastLineMaxWi
dth, |
| 6143 childMin, childMax, stripFrontSpaces); |
6143 | 6144 |
6144 // This text object will not be rendered, but it may still provi
de a breaking opportunity. | 6145 // This text object will not be rendered, but it may still provi
de a breaking opportunity. |
6145 if (!hasBreak && childMax == 0) { | 6146 if (!hasBreak && childMax == 0) { |
6146 if (autoWrap && (beginWS || endWS)) { | 6147 if (autoWrap && (hasBreakableStart || hasBreakableEnd)) { |
6147 updatePreferredWidth(minLogicalWidth, inlineMin); | 6148 updatePreferredWidth(minLogicalWidth, inlineMin); |
6148 inlineMin = 0; | 6149 inlineMin = 0; |
6149 } | 6150 } |
6150 continue; | 6151 continue; |
6151 } | 6152 } |
6152 | 6153 |
6153 if (stripFrontSpaces) | 6154 if (stripFrontSpaces) |
6154 trailingSpaceChild = child; | 6155 trailingSpaceChild = child; |
6155 else | 6156 else |
6156 trailingSpaceChild = 0; | 6157 trailingSpaceChild = 0; |
6157 | 6158 |
6158 // Add in text-indent. This is added in only once. | 6159 // Add in text-indent. This is added in only once. |
6159 float ti = 0; | 6160 float ti = 0; |
6160 if (!addedTextIndent || hasRemainingNegativeTextIndent) { | 6161 if (!addedTextIndent || hasRemainingNegativeTextIndent) { |
6161 ti = textIndent.ceilToFloat(); | 6162 ti = textIndent.ceilToFloat(); |
6162 childMin += ti; | 6163 childMin += ti; |
6163 beginMin += ti; | 6164 firstLineMinWidth += ti; |
6164 | 6165 |
6165 // It the text indent negative and larger than the child min
imum, we re-use the remainder | 6166 // It the text indent negative and larger than the child min
imum, we re-use the remainder |
6166 // in future minimum calculations, but using the negative va
lue again on the maximum | 6167 // in future minimum calculations, but using the negative va
lue again on the maximum |
6167 // will lead to under-counting the max pref width. | 6168 // will lead to under-counting the max pref width. |
6168 if (!addedTextIndent) { | 6169 if (!addedTextIndent) { |
6169 childMax += ti; | 6170 childMax += ti; |
6170 beginMax += ti; | 6171 firstLineMaxWidth += ti; |
6171 addedTextIndent = true; | 6172 addedTextIndent = true; |
6172 } | 6173 } |
6173 | 6174 |
6174 if (childMin < 0) { | 6175 if (childMin < 0) { |
6175 textIndent = childMin; | 6176 textIndent = childMin; |
6176 hasRemainingNegativeTextIndent = true; | 6177 hasRemainingNegativeTextIndent = true; |
6177 } | 6178 } |
6178 } | 6179 } |
6179 | 6180 |
6180 // If we have no breakable characters at all, | 6181 // If we have no breakable characters at all, |
6181 // then this is the easy case. We add ourselves to the current | 6182 // then this is the easy case. We add ourselves to the current |
6182 // min and max and continue. | 6183 // min and max and continue. |
6183 if (!hasBreakableChar) { | 6184 if (!hasBreakableChar) { |
6184 inlineMin += childMin; | 6185 inlineMin += childMin; |
6185 } else { | 6186 } else { |
6186 // We have a breakable character. Now we need to know if | 6187 if (hasBreakableStart) { |
6187 // we start and end with whitespace. | |
6188 if (beginWS) | |
6189 // Go ahead and end the current line. | |
6190 updatePreferredWidth(minLogicalWidth, inlineMin); | 6188 updatePreferredWidth(minLogicalWidth, inlineMin); |
6191 else { | 6189 } else { |
6192 inlineMin += beginMin; | 6190 inlineMin += firstLineMinWidth; |
6193 updatePreferredWidth(minLogicalWidth, inlineMin); | 6191 updatePreferredWidth(minLogicalWidth, inlineMin); |
6194 childMin -= ti; | 6192 childMin -= ti; |
6195 } | 6193 } |
6196 | 6194 |
6197 inlineMin = childMin; | 6195 inlineMin = childMin; |
6198 | 6196 |
6199 if (endWS) { | 6197 if (hasBreakableEnd) { |
6200 // We end in whitespace, which means we can go ahead | |
6201 // and end our current line. | |
6202 updatePreferredWidth(minLogicalWidth, inlineMin); | 6198 updatePreferredWidth(minLogicalWidth, inlineMin); |
6203 inlineMin = 0; | 6199 inlineMin = 0; |
6204 shouldBreakLineAfterText = false; | 6200 shouldBreakLineAfterText = false; |
6205 } else { | 6201 } else { |
6206 updatePreferredWidth(minLogicalWidth, inlineMin); | 6202 updatePreferredWidth(minLogicalWidth, inlineMin); |
6207 inlineMin = endMin; | 6203 inlineMin = lastLineMinWidth; |
6208 shouldBreakLineAfterText = true; | 6204 shouldBreakLineAfterText = true; |
6209 } | 6205 } |
6210 } | 6206 } |
6211 | 6207 |
6212 if (hasBreak) { | 6208 if (hasBreak) { |
6213 inlineMax += beginMax; | 6209 inlineMax += firstLineMaxWidth; |
6214 updatePreferredWidth(maxLogicalWidth, inlineMax); | 6210 updatePreferredWidth(maxLogicalWidth, inlineMax); |
6215 updatePreferredWidth(maxLogicalWidth, childMax); | 6211 updatePreferredWidth(maxLogicalWidth, childMax); |
6216 inlineMax = endMax; | 6212 inlineMax = lastLineMaxWidth; |
6217 addedTextIndent = true; | 6213 addedTextIndent = true; |
6218 } else | 6214 } else { |
6219 inlineMax += max<float>(0, childMax); | 6215 inlineMax += max<float>(0, childMax); |
| 6216 } |
6220 } | 6217 } |
6221 | 6218 |
6222 // Ignore spaces after a list marker. | 6219 // Ignore spaces after a list marker. |
6223 if (child->isListMarker()) | 6220 if (child->isListMarker()) |
6224 stripFrontSpaces = true; | 6221 stripFrontSpaces = true; |
6225 } else { | 6222 } else { |
6226 updatePreferredWidth(minLogicalWidth, inlineMin); | 6223 updatePreferredWidth(minLogicalWidth, inlineMin); |
6227 updatePreferredWidth(maxLogicalWidth, inlineMax); | 6224 updatePreferredWidth(maxLogicalWidth, inlineMax); |
6228 inlineMin = inlineMax = 0; | 6225 inlineMin = inlineMax = 0; |
6229 stripFrontSpaces = true; | 6226 stripFrontSpaces = true; |
(...skipping 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8112 { | 8109 { |
8113 memoryInstrumentation->addRootObject(gColumnInfoMap, WebCoreMemoryTypes::Ren
deringStructures); | 8110 memoryInstrumentation->addRootObject(gColumnInfoMap, WebCoreMemoryTypes::Ren
deringStructures); |
8114 memoryInstrumentation->addRootObject(gPositionedDescendantsMap, WebCoreMemor
yTypes::RenderingStructures); | 8111 memoryInstrumentation->addRootObject(gPositionedDescendantsMap, WebCoreMemor
yTypes::RenderingStructures); |
8115 memoryInstrumentation->addRootObject(gPercentHeightDescendantsMap, WebCoreMe
moryTypes::RenderingStructures); | 8112 memoryInstrumentation->addRootObject(gPercentHeightDescendantsMap, WebCoreMe
moryTypes::RenderingStructures); |
8116 memoryInstrumentation->addRootObject(gPositionedContainerMap, WebCoreMemoryT
ypes::RenderingStructures); | 8113 memoryInstrumentation->addRootObject(gPositionedContainerMap, WebCoreMemoryT
ypes::RenderingStructures); |
8117 memoryInstrumentation->addRootObject(gPercentHeightContainerMap, WebCoreMemo
ryTypes::RenderingStructures); | 8114 memoryInstrumentation->addRootObject(gPercentHeightContainerMap, WebCoreMemo
ryTypes::RenderingStructures); |
8118 memoryInstrumentation->addRootObject(gDelayedUpdateScrollInfoSet, WebCoreMem
oryTypes::RenderingStructures); | 8115 memoryInstrumentation->addRootObject(gDelayedUpdateScrollInfoSet, WebCoreMem
oryTypes::RenderingStructures); |
8119 } | 8116 } |
8120 | 8117 |
8121 } // namespace WebCore | 8118 } // namespace WebCore |
OLD | NEW |