OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. |
4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google 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, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 removeFloatingObjectsBelow(lastFloatFromPreviousLine, oldLogicalHeight); | 778 removeFloatingObjectsBelow(lastFloatFromPreviousLine, oldLogicalHeight); |
779 setLogicalHeight(newLogicalHeight); | 779 setLogicalHeight(newLogicalHeight); |
780 resolver.setPositionIgnoringNestedIsolates(oldEnd); | 780 resolver.setPositionIgnoringNestedIsolates(oldEnd); |
781 return oldEnd; | 781 return oldEnd; |
782 } | 782 } |
783 | 783 |
784 void RenderBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, | 784 void RenderBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, |
785 InlineBidiResolver& resolver, const InlineIterator& cleanLineStart, | 785 InlineBidiResolver& resolver, const InlineIterator& cleanLineStart, |
786 const BidiStatus& cleanLineBidiStatus) | 786 const BidiStatus& cleanLineBidiStatus) |
787 { | 787 { |
788 RenderStyle* styleToUse = style(); | 788 const RenderStyle* styleToUse = style(); |
789 bool paginated = view()->layoutState() && view()->layoutState()->isPaginated
(); | 789 bool paginated = view()->layoutState() && view()->layoutState()->isPaginated
(); |
790 LineMidpointState& lineMidpointState = resolver.midpointState(); | 790 LineMidpointState& lineMidpointState = resolver.midpointState(); |
791 InlineIterator endOfLine = resolver.position(); | 791 InlineIterator endOfLine = resolver.position(); |
792 bool checkForEndLineMatch = layoutState.endLine(); | 792 bool checkForEndLineMatch = layoutState.endLine(); |
793 RenderTextInfo renderTextInfo; | 793 RenderTextInfo renderTextInfo; |
794 VerticalPositionCache verticalPositionCache; | 794 VerticalPositionCache verticalPositionCache; |
795 | 795 |
796 LineBreaker lineBreaker(this); | 796 LineBreaker lineBreaker(this); |
797 | 797 |
798 while (!endOfLine.atEnd()) { | 798 while (!endOfLine.atEnd()) { |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 | 1146 |
1147 static LayoutUnit getBPMWidth(LayoutUnit childValue, Length cssUnit) | 1147 static LayoutUnit getBPMWidth(LayoutUnit childValue, Length cssUnit) |
1148 { | 1148 { |
1149 if (cssUnit.type() != Auto) | 1149 if (cssUnit.type() != Auto) |
1150 return (cssUnit.isFixed() ? static_cast<LayoutUnit>(cssUnit.value()) : c
hildValue); | 1150 return (cssUnit.isFixed() ? static_cast<LayoutUnit>(cssUnit.value()) : c
hildValue); |
1151 return LayoutUnit(); | 1151 return LayoutUnit(); |
1152 } | 1152 } |
1153 | 1153 |
1154 static LayoutUnit getBorderPaddingMargin(RenderBoxModelObject* child, bool endOf
Inline) | 1154 static LayoutUnit getBorderPaddingMargin(RenderBoxModelObject* child, bool endOf
Inline) |
1155 { | 1155 { |
1156 RenderStyle* childStyle = child->style(); | 1156 const RenderStyle* childStyle = child->style(); |
1157 if (endOfInline) { | 1157 if (endOfInline) { |
1158 return getBPMWidth(child->marginEnd(), childStyle->marginEnd()) + | 1158 return getBPMWidth(child->marginEnd(), childStyle->marginEnd()) + |
1159 getBPMWidth(child->paddingEnd(), childStyle->paddingEnd()) + | 1159 getBPMWidth(child->paddingEnd(), childStyle->paddingEnd()) + |
1160 child->borderEnd(); | 1160 child->borderEnd(); |
1161 } | 1161 } |
1162 return getBPMWidth(child->marginStart(), childStyle->marginStart()) + | 1162 return getBPMWidth(child->marginStart(), childStyle->marginStart()) + |
1163 getBPMWidth(child->paddingStart(), childStyle->paddingStart()) + | 1163 getBPMWidth(child->paddingStart(), childStyle->paddingStart()) + |
1164 child->borderStart(); | 1164 child->borderStart(); |
1165 } | 1165 } |
1166 | 1166 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 return LayoutUnit::fromFloatCeil(value); | 1204 return LayoutUnit::fromFloatCeil(value); |
1205 } | 1205 } |
1206 | 1206 |
1207 // FIXME: This function should be broken into something less monolithic. | 1207 // FIXME: This function should be broken into something less monolithic. |
1208 // FIXME: The main loop here is very similar to LineBreaker::nextSegmentBreak. T
hey can probably reuse code. | 1208 // FIXME: The main loop here is very similar to LineBreaker::nextSegmentBreak. T
hey can probably reuse code. |
1209 void RenderBlockFlow::computeInlinePreferredLogicalWidths(LayoutUnit& minLogical
Width, LayoutUnit& maxLogicalWidth) | 1209 void RenderBlockFlow::computeInlinePreferredLogicalWidths(LayoutUnit& minLogical
Width, LayoutUnit& maxLogicalWidth) |
1210 { | 1210 { |
1211 FloatWillBeLayoutUnit inlineMax; | 1211 FloatWillBeLayoutUnit inlineMax; |
1212 FloatWillBeLayoutUnit inlineMin; | 1212 FloatWillBeLayoutUnit inlineMin; |
1213 | 1213 |
1214 RenderStyle* styleToUse = style(); | 1214 const RenderStyle* styleToUse = style(); |
1215 RenderBlock* containingBlock = this->containingBlock(); | 1215 RenderBlock* containingBlock = this->containingBlock(); |
1216 LayoutUnit cw = containingBlock ? containingBlock->contentLogicalWidth() : L
ayoutUnit(); | 1216 LayoutUnit cw = containingBlock ? containingBlock->contentLogicalWidth() : L
ayoutUnit(); |
1217 | 1217 |
1218 // If we are at the start of a line, we want to ignore all white-space. | 1218 // If we are at the start of a line, we want to ignore all white-space. |
1219 // Also strip spaces if we previously had text that ended in a trailing spac
e. | 1219 // Also strip spaces if we previously had text that ended in a trailing spac
e. |
1220 bool stripFrontSpaces = true; | 1220 bool stripFrontSpaces = true; |
1221 RenderObject* trailingSpaceChild = 0; | 1221 RenderObject* trailingSpaceChild = 0; |
1222 | 1222 |
1223 // Firefox and Opera will allow a table cell to grow to fit an image inside
it under | 1223 // Firefox and Opera will allow a table cell to grow to fit an image inside
it under |
1224 // very specific cirucumstances (in order to match common WinIE renderings). | 1224 // very specific cirucumstances (in order to match common WinIE renderings). |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 // If the text string starts with whitespace, then we need to go ahe
ad and | 1272 // If the text string starts with whitespace, then we need to go ahe
ad and |
1273 // terminate our current line (unless we're already in a whitespace
stripping | 1273 // terminate our current line (unless we're already in a whitespace
stripping |
1274 // mode. | 1274 // mode. |
1275 // | 1275 // |
1276 // If the text string has a breakable character in the middle, but d
idn't start | 1276 // If the text string has a breakable character in the middle, but d
idn't start |
1277 // with whitespace, then we add the width of the first non-breakable
run and | 1277 // with whitespace, then we add the width of the first non-breakable
run and |
1278 // then end the current line. We then need to use the intermediate m
in/max width | 1278 // then end the current line. We then need to use the intermediate m
in/max width |
1279 // values (if any of them are larger than our current min/max). We t
hen look at | 1279 // values (if any of them are larger than our current min/max). We t
hen look at |
1280 // the width of the last non-breakable run and use that to start a n
ew line | 1280 // the width of the last non-breakable run and use that to start a n
ew line |
1281 // (unless we end in whitespace). | 1281 // (unless we end in whitespace). |
1282 RenderStyle* childStyle = child->style(); | 1282 const RenderStyle* childStyle = child->style(); |
1283 FloatWillBeLayoutUnit childMin; | 1283 FloatWillBeLayoutUnit childMin; |
1284 FloatWillBeLayoutUnit childMax; | 1284 FloatWillBeLayoutUnit childMax; |
1285 | 1285 |
1286 if (!child->isText()) { | 1286 if (!child->isText()) { |
1287 // Case (1) and (2). Inline replaced and inline flow elements. | 1287 // Case (1) and (2). Inline replaced and inline flow elements. |
1288 if (child->isRenderInline()) { | 1288 if (child->isRenderInline()) { |
1289 // Add in padding/border/margin from the appropriate side of | 1289 // Add in padding/border/margin from the appropriate side of |
1290 // the element. | 1290 // the element. |
1291 FloatWillBeLayoutUnit bpm = getBorderPaddingMargin(toRenderI
nline(child), childIterator.endOfInline); | 1291 FloatWillBeLayoutUnit bpm = getBorderPaddingMargin(toRenderI
nline(child), childIterator.endOfInline); |
1292 childMin += bpm; | 1292 childMin += bpm; |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2051 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat
(); | 2051 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat
(); |
2052 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal
se) - logicalLeft; | 2052 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal
se) - logicalLeft; |
2053 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); | 2053 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); |
2054 | 2054 |
2055 if (!style()->isLeftToRightDirection()) | 2055 if (!style()->isLeftToRightDirection()) |
2056 return logicalWidth() - logicalLeft; | 2056 return logicalWidth() - logicalLeft; |
2057 return logicalLeft; | 2057 return logicalLeft; |
2058 } | 2058 } |
2059 | 2059 |
2060 } | 2060 } |
OLD | NEW |