| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 parentBox = parentBox->parent(); | 96 parentBox = parentBox->parent(); |
| 97 } while (parentBox); | 97 } while (parentBox); |
| 98 return false; | 98 return false; |
| 99 } | 99 } |
| 100 | 100 |
| 101 InlineFlowBox* LayoutBlockFlow::createLineBoxes(LayoutObject* obj, const LineInf
o& lineInfo, InlineBox* childBox) | 101 InlineFlowBox* LayoutBlockFlow::createLineBoxes(LayoutObject* obj, const LineInf
o& lineInfo, InlineBox* childBox) |
| 102 { | 102 { |
| 103 // See if we have an unconstructed line box for this object that is also | 103 // See if we have an unconstructed line box for this object that is also |
| 104 // the last item on the line. | 104 // the last item on the line. |
| 105 unsigned lineDepth = 1; | 105 unsigned lineDepth = 1; |
| 106 InlineFlowBox* parentBox = 0; | 106 InlineFlowBox* parentBox = nullptr; |
| 107 InlineFlowBox* result = 0; | 107 InlineFlowBox* result = nullptr; |
| 108 bool hasDefaultLineBoxContain = style()->lineBoxContain() == ComputedStyle::
initialLineBoxContain(); | 108 bool hasDefaultLineBoxContain = style()->lineBoxContain() == ComputedStyle::
initialLineBoxContain(); |
| 109 do { | 109 do { |
| 110 ASSERT_WITH_SECURITY_IMPLICATION(obj->isLayoutInline() || obj == this); | 110 ASSERT_WITH_SECURITY_IMPLICATION(obj->isLayoutInline() || obj == this); |
| 111 | 111 |
| 112 LayoutInline* inlineFlow = (obj != this) ? toLayoutInline(obj) : 0; | 112 LayoutInline* inlineFlow = (obj != this) ? toLayoutInline(obj) : 0; |
| 113 | 113 |
| 114 // Get the last box we made for this layout object. | 114 // Get the last box we made for this layout object. |
| 115 parentBox = inlineFlow ? inlineFlow->lastLineBox() : toLayoutBlock(obj)-
>lastLineBox(); | 115 parentBox = inlineFlow ? inlineFlow->lastLineBox() : toLayoutBlock(obj)-
>lastLineBox(); |
| 116 | 116 |
| 117 // If this box or its ancestor is constructed then it is from a previous
line, and we need | 117 // If this box or its ancestor is constructed then it is from a previous
line, and we need |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 if (layoutText->is8Bit()) | 188 if (layoutText->is8Bit()) |
| 189 return endsWithASCIISpaces(layoutText->characters8(), pos, length); | 189 return endsWithASCIISpaces(layoutText->characters8(), pos, length); |
| 190 return endsWithASCIISpaces(layoutText->characters16(), pos, length); | 190 return endsWithASCIISpaces(layoutText->characters16(), pos, length); |
| 191 } | 191 } |
| 192 | 192 |
| 193 RootInlineBox* LayoutBlockFlow::constructLine(BidiRunList<BidiRun>& bidiRuns, co
nst LineInfo& lineInfo) | 193 RootInlineBox* LayoutBlockFlow::constructLine(BidiRunList<BidiRun>& bidiRuns, co
nst LineInfo& lineInfo) |
| 194 { | 194 { |
| 195 ASSERT(bidiRuns.firstRun()); | 195 ASSERT(bidiRuns.firstRun()); |
| 196 | 196 |
| 197 bool rootHasSelectedChildren = false; | 197 bool rootHasSelectedChildren = false; |
| 198 InlineFlowBox* parentBox = 0; | 198 InlineFlowBox* parentBox = nullptr; |
| 199 int runCount = bidiRuns.runCount() - lineInfo.runsFromLeadingWhitespace(); | 199 int runCount = bidiRuns.runCount() - lineInfo.runsFromLeadingWhitespace(); |
| 200 for (BidiRun* r = bidiRuns.firstRun(); r; r = r->next()) { | 200 for (BidiRun* r = bidiRuns.firstRun(); r; r = r->next()) { |
| 201 // Create a box for our object. | 201 // Create a box for our object. |
| 202 bool isOnlyRun = (runCount == 1); | 202 bool isOnlyRun = (runCount == 1); |
| 203 if (runCount == 2 && !r->m_object->isListMarker()) | 203 if (runCount == 2 && !r->m_object->isListMarker()) |
| 204 isOnlyRun = (!style()->isLeftToRightDirection() ? bidiRuns.lastRun()
: bidiRuns.firstRun())->m_object->isListMarker(); | 204 isOnlyRun = (!style()->isLeftToRightDirection() ? bidiRuns.lastRun()
: bidiRuns.firstRun())->m_object->isListMarker(); |
| 205 | 205 |
| 206 if (lineInfo.isEmpty()) | 206 if (lineInfo.isEmpty()) |
| 207 continue; | 207 continue; |
| 208 | 208 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 if (isLeftToRightDirection) | 345 if (isLeftToRightDirection) |
| 346 logicalLeft += std::max((availableLogicalWidth - totalLogicalWidth) / 2,
LayoutUnit()); | 346 logicalLeft += std::max((availableLogicalWidth - totalLogicalWidth) / 2,
LayoutUnit()); |
| 347 else | 347 else |
| 348 logicalLeft += totalLogicalWidth > availableLogicalWidth ? (availableLog
icalWidth - totalLogicalWidth) : (availableLogicalWidth - totalLogicalWidth) / 2
- trailingSpaceWidth; | 348 logicalLeft += totalLogicalWidth > availableLogicalWidth ? (availableLog
icalWidth - totalLogicalWidth) : (availableLogicalWidth - totalLogicalWidth) / 2
- trailingSpaceWidth; |
| 349 } | 349 } |
| 350 | 350 |
| 351 void LayoutBlockFlow::setMarginsForRubyRun(BidiRun* run, LayoutRubyRun* layoutRu
byRun, LayoutObject* previousObject, const LineInfo& lineInfo) | 351 void LayoutBlockFlow::setMarginsForRubyRun(BidiRun* run, LayoutRubyRun* layoutRu
byRun, LayoutObject* previousObject, const LineInfo& lineInfo) |
| 352 { | 352 { |
| 353 int startOverhang; | 353 int startOverhang; |
| 354 int endOverhang; | 354 int endOverhang; |
| 355 LayoutObject* nextObject = 0; | 355 LayoutObject* nextObject = nullptr; |
| 356 for (BidiRun* runWithNextObject = run->next(); runWithNextObject; runWithNex
tObject = runWithNextObject->next()) { | 356 for (BidiRun* runWithNextObject = run->next(); runWithNextObject; runWithNex
tObject = runWithNextObject->next()) { |
| 357 if (!runWithNextObject->m_object->isOutOfFlowPositioned() && !runWithNex
tObject->m_box->isLineBreak()) { | 357 if (!runWithNextObject->m_object->isOutOfFlowPositioned() && !runWithNex
tObject->m_box->isLineBreak()) { |
| 358 nextObject = runWithNextObject->m_object; | 358 nextObject = runWithNextObject->m_object; |
| 359 break; | 359 break; |
| 360 } | 360 } |
| 361 } | 361 } |
| 362 layoutRubyRun->getOverhang(lineInfo.isFirstLine(), layoutRubyRun->style()->i
sLeftToRightDirection() ? previousObject : nextObject, layoutRubyRun->style()->i
sLeftToRightDirection() ? nextObject : previousObject, startOverhang, endOverhan
g); | 362 layoutRubyRun->getOverhang(lineInfo.isFirstLine(), layoutRubyRun->style()->i
sLeftToRightDirection() ? previousObject : nextObject, layoutRubyRun->style()->i
sLeftToRightDirection() ? nextObject : previousObject, startOverhang, endOverhan
g); |
| 363 setMarginStartForChild(*layoutRubyRun, -startOverhang); | 363 setMarginStartForChild(*layoutRubyRun, -startOverhang); |
| 364 setMarginEndForChild(*layoutRubyRun, -endOverhang); | 364 setMarginEndForChild(*layoutRubyRun, -endOverhang); |
| 365 } | 365 } |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 | 580 |
| 581 BidiRun* LayoutBlockFlow::computeInlineDirectionPositionsForSegment(RootInlineBo
x* lineBox, const LineInfo& lineInfo, ETextAlign textAlign, LayoutUnit& logicalL
eft, | 581 BidiRun* LayoutBlockFlow::computeInlineDirectionPositionsForSegment(RootInlineBo
x* lineBox, const LineInfo& lineInfo, ETextAlign textAlign, LayoutUnit& logicalL
eft, |
| 582 LayoutUnit& availableLogicalWidth, BidiRun* firstRun, BidiRun* trailingSpace
Run, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& ve
rticalPositionCache, | 582 LayoutUnit& availableLogicalWidth, BidiRun* firstRun, BidiRun* trailingSpace
Run, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& ve
rticalPositionCache, |
| 583 WordMeasurements& wordMeasurements) | 583 WordMeasurements& wordMeasurements) |
| 584 { | 584 { |
| 585 bool needsWordSpacing = true; | 585 bool needsWordSpacing = true; |
| 586 LayoutUnit totalLogicalWidth = lineBox->getFlowSpacingLogicalWidth(); | 586 LayoutUnit totalLogicalWidth = lineBox->getFlowSpacingLogicalWidth(); |
| 587 unsigned expansionOpportunityCount = 0; | 587 unsigned expansionOpportunityCount = 0; |
| 588 bool isAfterExpansion = true; | 588 bool isAfterExpansion = true; |
| 589 Vector<unsigned, 16> expansionOpportunities; | 589 Vector<unsigned, 16> expansionOpportunities; |
| 590 LayoutObject* previousObject = 0; | 590 LayoutObject* previousObject = nullptr; |
| 591 TextJustify textJustify = style()->textJustify(); | 591 TextJustify textJustify = style()->textJustify(); |
| 592 | 592 |
| 593 BidiRun* r = firstRun; | 593 BidiRun* r = firstRun; |
| 594 for (; r; r = r->next()) { | 594 for (; r; r = r->next()) { |
| 595 if (!r->m_box || r->m_object->isOutOfFlowPositioned() || r->m_box->isLin
eBreak()) { | 595 if (!r->m_box || r->m_object->isOutOfFlowPositioned() || r->m_box->isLin
eBreak()) { |
| 596 continue; // Positioned objects are only participating to figure out
their | 596 continue; // Positioned objects are only participating to figure out
their |
| 597 // correct static x position. They have no effect on the width. | 597 // correct static x position. They have no effect on the width. |
| 598 // Similarly, line break boxes have no effect on the width. | 598 // Similarly, line break boxes have no effect on the width. |
| 599 } | 599 } |
| 600 if (r->m_object->isText()) { | 600 if (r->m_object->isText()) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 { | 675 { |
| 676 ASSERT(!floatingObject->originatingLine()); | 676 ASSERT(!floatingObject->originatingLine()); |
| 677 floatingObject->setOriginatingLine(lastRootBox()); | 677 floatingObject->setOriginatingLine(lastRootBox()); |
| 678 lastRootBox()->appendFloat(floatingObject->layoutObject()); | 678 lastRootBox()->appendFloat(floatingObject->layoutObject()); |
| 679 } | 679 } |
| 680 | 680 |
| 681 // This function constructs line boxes for all of the text runs in the resolver
and computes their position. | 681 // This function constructs line boxes for all of the text runs in the resolver
and computes their position. |
| 682 RootInlineBox* LayoutBlockFlow::createLineBoxesFromBidiRuns(unsigned bidiLevel,
BidiRunList<BidiRun>& bidiRuns, const InlineIterator& end, LineInfo& lineInfo, V
erticalPositionCache& verticalPositionCache, BidiRun* trailingSpaceRun, WordMeas
urements& wordMeasurements) | 682 RootInlineBox* LayoutBlockFlow::createLineBoxesFromBidiRuns(unsigned bidiLevel,
BidiRunList<BidiRun>& bidiRuns, const InlineIterator& end, LineInfo& lineInfo, V
erticalPositionCache& verticalPositionCache, BidiRun* trailingSpaceRun, WordMeas
urements& wordMeasurements) |
| 683 { | 683 { |
| 684 if (!bidiRuns.runCount()) | 684 if (!bidiRuns.runCount()) |
| 685 return 0; | 685 return nullptr; |
| 686 | 686 |
| 687 // FIXME: Why is this only done when we had runs? | 687 // FIXME: Why is this only done when we had runs? |
| 688 lineInfo.setLastLine(!end.object()); | 688 lineInfo.setLastLine(!end.object()); |
| 689 | 689 |
| 690 RootInlineBox* lineBox = constructLine(bidiRuns, lineInfo); | 690 RootInlineBox* lineBox = constructLine(bidiRuns, lineInfo); |
| 691 if (!lineBox) | 691 if (!lineBox) |
| 692 return 0; | 692 return nullptr; |
| 693 | 693 |
| 694 lineBox->setBidiLevel(bidiLevel); | 694 lineBox->setBidiLevel(bidiLevel); |
| 695 lineBox->setEndsWithBreak(lineInfo.previousLineBrokeCleanly()); | 695 lineBox->setEndsWithBreak(lineInfo.previousLineBrokeCleanly()); |
| 696 | 696 |
| 697 bool isSVGRootInlineBox = lineBox->isSVGRootInlineBox(); | 697 bool isSVGRootInlineBox = lineBox->isSVGRootInlineBox(); |
| 698 | 698 |
| 699 GlyphOverflowAndFallbackFontsMap textBoxDataMap; | 699 GlyphOverflowAndFallbackFontsMap textBoxDataMap; |
| 700 | 700 |
| 701 // Now we position all of our text runs horizontally. | 701 // Now we position all of our text runs horizontally. |
| 702 if (!isSVGRootInlineBox) | 702 if (!isSVGRootInlineBox) |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 : parent(p), current(p), endOfInline(end) | 1074 : parent(p), current(p), endOfInline(end) |
| 1075 { | 1075 { |
| 1076 | 1076 |
| 1077 } | 1077 } |
| 1078 | 1078 |
| 1079 LayoutObject* next(); | 1079 LayoutObject* next(); |
| 1080 }; | 1080 }; |
| 1081 | 1081 |
| 1082 LayoutObject* InlineMinMaxIterator::next() | 1082 LayoutObject* InlineMinMaxIterator::next() |
| 1083 { | 1083 { |
| 1084 LayoutObject* result = 0; | 1084 LayoutObject* result = nullptr; |
| 1085 bool oldEndOfInline = endOfInline; | 1085 bool oldEndOfInline = endOfInline; |
| 1086 endOfInline = false; | 1086 endOfInline = false; |
| 1087 while (current || current == parent) { | 1087 while (current || current == parent) { |
| 1088 if (!oldEndOfInline && (current == parent || (!current->isFloating() &&
!current->isReplaced() && !current->isOutOfFlowPositioned()))) | 1088 if (!oldEndOfInline && (current == parent || (!current->isFloating() &&
!current->isReplaced() && !current->isOutOfFlowPositioned()))) |
| 1089 result = current->slowFirstChild(); | 1089 result = current->slowFirstChild(); |
| 1090 | 1090 |
| 1091 if (!result) { | 1091 if (!result) { |
| 1092 // We hit the end of our inline. (It was empty, e.g., <span></span>.
) | 1092 // We hit the end of our inline. (It was empty, e.g., <span></span>.
) |
| 1093 if (!oldEndOfInline && current->isLayoutInline()) { | 1093 if (!oldEndOfInline && current->isLayoutInline()) { |
| 1094 result = current; | 1094 result = current; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1109 } | 1109 } |
| 1110 } | 1110 } |
| 1111 | 1111 |
| 1112 if (!result) | 1112 if (!result) |
| 1113 break; | 1113 break; |
| 1114 | 1114 |
| 1115 if (!result->isOutOfFlowPositioned() && (result->isText() || result->isF
loating() || result->isReplaced() || result->isLayoutInline())) | 1115 if (!result->isOutOfFlowPositioned() && (result->isText() || result->isF
loating() || result->isReplaced() || result->isLayoutInline())) |
| 1116 break; | 1116 break; |
| 1117 | 1117 |
| 1118 current = result; | 1118 current = result; |
| 1119 result = 0; | 1119 result = nullptr; |
| 1120 } | 1120 } |
| 1121 | 1121 |
| 1122 // Update our position. | 1122 // Update our position. |
| 1123 current = result; | 1123 current = result; |
| 1124 return current; | 1124 return current; |
| 1125 } | 1125 } |
| 1126 | 1126 |
| 1127 static LayoutUnit getBPMWidth(LayoutUnit childValue, Length cssUnit) | 1127 static LayoutUnit getBPMWidth(LayoutUnit childValue, Length cssUnit) |
| 1128 { | 1128 { |
| 1129 if (cssUnit.type() != Auto) | 1129 if (cssUnit.type() != Auto) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 LayoutUnit inlineMax; | 1191 LayoutUnit inlineMax; |
| 1192 LayoutUnit inlineMin; | 1192 LayoutUnit inlineMin; |
| 1193 | 1193 |
| 1194 const ComputedStyle& styleToUse = styleRef(); | 1194 const ComputedStyle& styleToUse = styleRef(); |
| 1195 LayoutBlock* containingBlock = this->containingBlock(); | 1195 LayoutBlock* containingBlock = this->containingBlock(); |
| 1196 LayoutUnit cw = containingBlock ? containingBlock->contentLogicalWidth() : L
ayoutUnit(); | 1196 LayoutUnit cw = containingBlock ? containingBlock->contentLogicalWidth() : L
ayoutUnit(); |
| 1197 | 1197 |
| 1198 // If we are at the start of a line, we want to ignore all white-space. | 1198 // If we are at the start of a line, we want to ignore all white-space. |
| 1199 // Also strip spaces if we previously had text that ended in a trailing spac
e. | 1199 // Also strip spaces if we previously had text that ended in a trailing spac
e. |
| 1200 bool stripFrontSpaces = true; | 1200 bool stripFrontSpaces = true; |
| 1201 LayoutObject* trailingSpaceChild = 0; | 1201 LayoutObject* trailingSpaceChild = nullptr; |
| 1202 | 1202 |
| 1203 // Firefox and Opera will allow a table cell to grow to fit an image inside
it under | 1203 // Firefox and Opera will allow a table cell to grow to fit an image inside
it under |
| 1204 // very specific cirucumstances (in order to match common WinIE layouts). | 1204 // very specific cirucumstances (in order to match common WinIE layouts). |
| 1205 // Not supporting the quirk has caused us to mis-layout some real sites. (Se
e Bugzilla 10517.) | 1205 // Not supporting the quirk has caused us to mis-layout some real sites. (Se
e Bugzilla 10517.) |
| 1206 bool allowImagesToBreak = !document().inQuirksMode() || !isTableCell() || !s
tyleToUse.logicalWidth().isIntrinsicOrAuto(); | 1206 bool allowImagesToBreak = !document().inQuirksMode() || !isTableCell() || !s
tyleToUse.logicalWidth().isIntrinsicOrAuto(); |
| 1207 | 1207 |
| 1208 bool autoWrap, oldAutoWrap; | 1208 bool autoWrap, oldAutoWrap; |
| 1209 autoWrap = oldAutoWrap = styleToUse.autoWrap(); | 1209 autoWrap = oldAutoWrap = styleToUse.autoWrap(); |
| 1210 | 1210 |
| 1211 InlineMinMaxIterator childIterator(this); | 1211 InlineMinMaxIterator childIterator(this); |
| 1212 | 1212 |
| 1213 // Only gets added to the max preffered width once. | 1213 // Only gets added to the max preffered width once. |
| 1214 bool addedTextIndent = false; | 1214 bool addedTextIndent = false; |
| 1215 // Signals the text indent was more negative than the min preferred width | 1215 // Signals the text indent was more negative than the min preferred width |
| 1216 bool hasRemainingNegativeTextIndent = false; | 1216 bool hasRemainingNegativeTextIndent = false; |
| 1217 | 1217 |
| 1218 LayoutUnit textIndent = minimumValueForLength(styleToUse.textIndent(), cw); | 1218 LayoutUnit textIndent = minimumValueForLength(styleToUse.textIndent(), cw); |
| 1219 LayoutObject* prevFloat = 0; | 1219 LayoutObject* prevFloat = nullptr; |
| 1220 bool isPrevChildInlineFlow = false; | 1220 bool isPrevChildInlineFlow = false; |
| 1221 bool shouldBreakLineAfterText = false; | 1221 bool shouldBreakLineAfterText = false; |
| 1222 while (LayoutObject* child = childIterator.next()) { | 1222 while (LayoutObject* child = childIterator.next()) { |
| 1223 autoWrap = child->isReplaced() ? child->parent()->style()->autoWrap() : | 1223 autoWrap = child->isReplaced() ? child->parent()->style()->autoWrap() : |
| 1224 child->style()->autoWrap(); | 1224 child->style()->autoWrap(); |
| 1225 | 1225 |
| 1226 if (!child->isBR()) { | 1226 if (!child->isBR()) { |
| 1227 // Step One: determine whether or not we need to go ahead and | 1227 // Step One: determine whether or not we need to go ahead and |
| 1228 // terminate our current line. Each discrete chunk can become | 1228 // terminate our current line. Each discrete chunk can become |
| 1229 // the new min-width, if it is the widest chunk seen so far, and | 1229 // the new min-width, if it is the widest chunk seen so far, and |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 | 1358 |
| 1359 if (autoWrap && canBreakReplacedElement && isPrevChildInlineFlow
) { | 1359 if (autoWrap && canBreakReplacedElement && isPrevChildInlineFlow
) { |
| 1360 minLogicalWidth = std::max(minLogicalWidth, inlineMin); | 1360 minLogicalWidth = std::max(minLogicalWidth, inlineMin); |
| 1361 inlineMin = LayoutUnit(); | 1361 inlineMin = LayoutUnit(); |
| 1362 } | 1362 } |
| 1363 | 1363 |
| 1364 // We are no longer stripping whitespace at the start of | 1364 // We are no longer stripping whitespace at the start of |
| 1365 // a line. | 1365 // a line. |
| 1366 if (!child->isFloating()) { | 1366 if (!child->isFloating()) { |
| 1367 stripFrontSpaces = false; | 1367 stripFrontSpaces = false; |
| 1368 trailingSpaceChild = 0; | 1368 trailingSpaceChild = nullptr; |
| 1369 } | 1369 } |
| 1370 } else if (child->isText()) { | 1370 } else if (child->isText()) { |
| 1371 // Case (3). Text. | 1371 // Case (3). Text. |
| 1372 LayoutText* t = toLayoutText(child); | 1372 LayoutText* t = toLayoutText(child); |
| 1373 | 1373 |
| 1374 if (t->isWordBreak()) { | 1374 if (t->isWordBreak()) { |
| 1375 minLogicalWidth = std::max(minLogicalWidth, inlineMin); | 1375 minLogicalWidth = std::max(minLogicalWidth, inlineMin); |
| 1376 inlineMin = LayoutUnit(); | 1376 inlineMin = LayoutUnit(); |
| 1377 continue; | 1377 continue; |
| 1378 } | 1378 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1396 if (autoWrap && (hasBreakableStart || hasBreakableEnd)) { | 1396 if (autoWrap && (hasBreakableStart || hasBreakableEnd)) { |
| 1397 minLogicalWidth = std::max(minLogicalWidth, inlineMin); | 1397 minLogicalWidth = std::max(minLogicalWidth, inlineMin); |
| 1398 inlineMin = LayoutUnit(); | 1398 inlineMin = LayoutUnit(); |
| 1399 } | 1399 } |
| 1400 continue; | 1400 continue; |
| 1401 } | 1401 } |
| 1402 | 1402 |
| 1403 if (stripFrontSpaces) | 1403 if (stripFrontSpaces) |
| 1404 trailingSpaceChild = child; | 1404 trailingSpaceChild = child; |
| 1405 else | 1405 else |
| 1406 trailingSpaceChild = 0; | 1406 trailingSpaceChild = nullptr; |
| 1407 | 1407 |
| 1408 // Add in text-indent. This is added in only once. | 1408 // Add in text-indent. This is added in only once. |
| 1409 LayoutUnit ti; | 1409 LayoutUnit ti; |
| 1410 if (!addedTextIndent || hasRemainingNegativeTextIndent) { | 1410 if (!addedTextIndent || hasRemainingNegativeTextIndent) { |
| 1411 ti = textIndent; | 1411 ti = textIndent; |
| 1412 childMin += ti; | 1412 childMin += ti; |
| 1413 firstLineMinWidth += ti; | 1413 firstLineMinWidth += ti; |
| 1414 | 1414 |
| 1415 // It the text indent negative and larger than the child min
imum, we re-use the remainder | 1415 // It the text indent negative and larger than the child min
imum, we re-use the remainder |
| 1416 // in future minimum calculations, but using the negative va
lue again on the maximum | 1416 // in future minimum calculations, but using the negative va
lue again on the maximum |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 } | 1466 } |
| 1467 | 1467 |
| 1468 // Ignore spaces after a list marker. | 1468 // Ignore spaces after a list marker. |
| 1469 if (child->isListMarker()) | 1469 if (child->isListMarker()) |
| 1470 stripFrontSpaces = true; | 1470 stripFrontSpaces = true; |
| 1471 } else { | 1471 } else { |
| 1472 minLogicalWidth = std::max(minLogicalWidth, inlineMin); | 1472 minLogicalWidth = std::max(minLogicalWidth, inlineMin); |
| 1473 maxLogicalWidth = std::max(maxLogicalWidth, inlineMax); | 1473 maxLogicalWidth = std::max(maxLogicalWidth, inlineMax); |
| 1474 inlineMin = inlineMax = LayoutUnit(); | 1474 inlineMin = inlineMax = LayoutUnit(); |
| 1475 stripFrontSpaces = true; | 1475 stripFrontSpaces = true; |
| 1476 trailingSpaceChild = 0; | 1476 trailingSpaceChild = nullptr; |
| 1477 addedTextIndent = true; | 1477 addedTextIndent = true; |
| 1478 } | 1478 } |
| 1479 | 1479 |
| 1480 if (!child->isText() && child->isLayoutInline()) | 1480 if (!child->isText() && child->isLayoutInline()) |
| 1481 isPrevChildInlineFlow = true; | 1481 isPrevChildInlineFlow = true; |
| 1482 else | 1482 else |
| 1483 isPrevChildInlineFlow = false; | 1483 isPrevChildInlineFlow = false; |
| 1484 | 1484 |
| 1485 oldAutoWrap = autoWrap; | 1485 oldAutoWrap = autoWrap; |
| 1486 } | 1486 } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1623 markLinesDirtyInBlockRange(line->lineBottomWithLeading(), floatTop +
floatHeight, line); | 1623 markLinesDirtyInBlockRange(line->lineBottomWithLeading(), floatTop +
floatHeight, line); |
| 1624 floats[floatIndex].rect.setSize(newSize); | 1624 floats[floatIndex].rect.setSize(newSize); |
| 1625 dirtiedByFloat = true; | 1625 dirtiedByFloat = true; |
| 1626 } | 1626 } |
| 1627 floatIndex++; | 1627 floatIndex++; |
| 1628 } | 1628 } |
| 1629 } | 1629 } |
| 1630 | 1630 |
| 1631 RootInlineBox* LayoutBlockFlow::determineStartPosition(LineLayoutState& layoutSt
ate, InlineBidiResolver& resolver) | 1631 RootInlineBox* LayoutBlockFlow::determineStartPosition(LineLayoutState& layoutSt
ate, InlineBidiResolver& resolver) |
| 1632 { | 1632 { |
| 1633 RootInlineBox* curr = 0; | 1633 RootInlineBox* curr = nullptr; |
| 1634 RootInlineBox* last = 0; | 1634 RootInlineBox* last = nullptr; |
| 1635 | 1635 |
| 1636 // FIXME: This entire float-checking block needs to be broken into a new fun
ction. | 1636 // FIXME: This entire float-checking block needs to be broken into a new fun
ction. |
| 1637 bool dirtiedByFloat = false; | 1637 bool dirtiedByFloat = false; |
| 1638 if (!layoutState.isFullLayout()) { | 1638 if (!layoutState.isFullLayout()) { |
| 1639 // Paginate all of the clean lines. | 1639 // Paginate all of the clean lines. |
| 1640 bool paginated = view()->layoutState() && view()->layoutState()->isPagin
ated(); | 1640 bool paginated = view()->layoutState() && view()->layoutState()->isPagin
ated(); |
| 1641 LayoutUnit paginationDelta = 0; | 1641 LayoutUnit paginationDelta = 0; |
| 1642 size_t floatIndex = 0; | 1642 size_t floatIndex = 0; |
| 1643 for (curr = firstRootBox(); curr && !curr->isDirty(); curr = curr->nextR
ootBox()) { | 1643 for (curr = firstRootBox(); curr && !curr->isDirty(); curr = curr->nextR
ootBox()) { |
| 1644 if (paginated) { | 1644 if (paginated) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1671 } | 1671 } |
| 1672 | 1672 |
| 1673 if (layoutState.isFullLayout()) { | 1673 if (layoutState.isFullLayout()) { |
| 1674 // If we encountered a new float and have inline children, mark ourself
to force us to issue paint invalidations. | 1674 // If we encountered a new float and have inline children, mark ourself
to force us to issue paint invalidations. |
| 1675 if (layoutState.hasInlineChild() && !selfNeedsLayout()) { | 1675 if (layoutState.hasInlineChild() && !selfNeedsLayout()) { |
| 1676 setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::Flo
atDescendantChanged, MarkOnlyThis); | 1676 setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::Flo
atDescendantChanged, MarkOnlyThis); |
| 1677 setShouldDoFullPaintInvalidation(); | 1677 setShouldDoFullPaintInvalidation(); |
| 1678 } | 1678 } |
| 1679 | 1679 |
| 1680 deleteLineBoxTree(); | 1680 deleteLineBoxTree(); |
| 1681 curr = 0; | 1681 curr = nullptr; |
| 1682 ASSERT(!firstLineBox() && !lastLineBox()); | 1682 ASSERT(!firstLineBox() && !lastLineBox()); |
| 1683 } else { | 1683 } else { |
| 1684 if (curr) { | 1684 if (curr) { |
| 1685 // We have a dirty line. | 1685 // We have a dirty line. |
| 1686 if (RootInlineBox* prevRootBox = curr->prevRootBox()) { | 1686 if (RootInlineBox* prevRootBox = curr->prevRootBox()) { |
| 1687 // We have a previous line. | 1687 // We have a previous line. |
| 1688 if (!dirtiedByFloat && (!prevRootBox->endsWithBreak() || !prevRo
otBox->lineBreakObj() || (prevRootBox->lineBreakObj()->isText() && prevRootBox->
lineBreakPos() >= toLayoutText(prevRootBox->lineBreakObj())->textLength()))) { | 1688 if (!dirtiedByFloat && (!prevRootBox->endsWithBreak() || !prevRo
otBox->lineBreakObj() || (prevRootBox->lineBreakObj()->isText() && prevRootBox->
lineBreakPos() >= toLayoutText(prevRootBox->lineBreakObj())->textLength()))) { |
| 1689 // The previous line didn't break cleanly or broke at a newl
ine | 1689 // The previous line didn't break cleanly or broke at a newl
ine |
| 1690 // that has been deleted, so treat it as dirty too. | 1690 // that has been deleted, so treat it as dirty too. |
| 1691 curr = prevRootBox; | 1691 curr = prevRootBox; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1741 InlineIterator iter = InlineIterator(this, bidiFirstSkippingEmptyInlines
(this, resolver.runs(), &resolver), 0); | 1741 InlineIterator iter = InlineIterator(this, bidiFirstSkippingEmptyInlines
(this, resolver.runs(), &resolver), 0); |
| 1742 resolver.setPosition(iter, numberOfIsolateAncestors(iter)); | 1742 resolver.setPosition(iter, numberOfIsolateAncestors(iter)); |
| 1743 } | 1743 } |
| 1744 return curr; | 1744 return curr; |
| 1745 } | 1745 } |
| 1746 | 1746 |
| 1747 void LayoutBlockFlow::determineEndPosition(LineLayoutState& layoutState, RootInl
ineBox* startLine, InlineIterator& cleanLineStart, BidiStatus& cleanLineBidiStat
us) | 1747 void LayoutBlockFlow::determineEndPosition(LineLayoutState& layoutState, RootInl
ineBox* startLine, InlineIterator& cleanLineStart, BidiStatus& cleanLineBidiStat
us) |
| 1748 { | 1748 { |
| 1749 ASSERT(!layoutState.endLine()); | 1749 ASSERT(!layoutState.endLine()); |
| 1750 size_t floatIndex = layoutState.floatIndex(); | 1750 size_t floatIndex = layoutState.floatIndex(); |
| 1751 RootInlineBox* last = 0; | 1751 RootInlineBox* last = nullptr; |
| 1752 for (RootInlineBox* curr = startLine->nextRootBox(); curr; curr = curr->next
RootBox()) { | 1752 for (RootInlineBox* curr = startLine->nextRootBox(); curr; curr = curr->next
RootBox()) { |
| 1753 if (!curr->isDirty()) { | 1753 if (!curr->isDirty()) { |
| 1754 bool encounteredNewFloat = false; | 1754 bool encounteredNewFloat = false; |
| 1755 bool dirtiedByFloat = false; | 1755 bool dirtiedByFloat = false; |
| 1756 checkFloatsInCleanLine(curr, layoutState.floats(), floatIndex, encou
nteredNewFloat, dirtiedByFloat); | 1756 checkFloatsInCleanLine(curr, layoutState.floats(), floatIndex, encou
nteredNewFloat, dirtiedByFloat); |
| 1757 if (encounteredNewFloat) | 1757 if (encounteredNewFloat) |
| 1758 return; | 1758 return; |
| 1759 } | 1759 } |
| 1760 if (curr->isDirty()) | 1760 if (curr->isDirty()) |
| 1761 last = 0; | 1761 last = nullptr; |
| 1762 else if (!last) | 1762 else if (!last) |
| 1763 last = curr; | 1763 last = curr; |
| 1764 } | 1764 } |
| 1765 | 1765 |
| 1766 if (!last) | 1766 if (!last) |
| 1767 return; | 1767 return; |
| 1768 | 1768 |
| 1769 // At this point, |last| is the first line in a run of clean lines that ends
with the last line | 1769 // At this point, |last| is the first line in a run of clean lines that ends
with the last line |
| 1770 // in the block. | 1770 // in the block. |
| 1771 | 1771 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2028 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); | 2028 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); |
| 2029 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight()
, false) - logicalLeft; | 2029 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight()
, false) - logicalLeft; |
| 2030 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); | 2030 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); |
| 2031 | 2031 |
| 2032 if (!style()->isLeftToRightDirection()) | 2032 if (!style()->isLeftToRightDirection()) |
| 2033 return logicalWidth() - logicalLeft; | 2033 return logicalWidth() - logicalLeft; |
| 2034 return logicalLeft; | 2034 return logicalLeft; |
| 2035 } | 2035 } |
| 2036 | 2036 |
| 2037 } | 2037 } |
| OLD | NEW |