| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 static inline InlineBox* createInlineBoxForRenderer(LayoutObject* obj, bool isRo
otLineBox, bool isOnlyRun = false) | 55 static inline InlineBox* createInlineBoxForRenderer(LayoutObject* obj, bool isRo
otLineBox, bool isOnlyRun = false) |
| 56 { | 56 { |
| 57 // Callers should handle text themselves. | 57 // Callers should handle text themselves. |
| 58 ASSERT(!obj->isText()); | 58 ASSERT(!obj->isText()); |
| 59 | 59 |
| 60 if (isRootLineBox) | 60 if (isRootLineBox) |
| 61 return toRenderBlockFlow(obj)->createAndAppendRootInlineBox(); | 61 return toRenderBlockFlow(obj)->createAndAppendRootInlineBox(); |
| 62 | 62 |
| 63 if (obj->isBox()) | 63 if (obj->isBox()) |
| 64 return toRenderBox(obj)->createInlineBox(); | 64 return toLayoutBox(obj)->createInlineBox(); |
| 65 | 65 |
| 66 return toRenderInline(obj)->createAndAppendInlineFlowBox(); | 66 return toRenderInline(obj)->createAndAppendInlineFlowBox(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 static inline InlineTextBox* createInlineBoxForText(BidiRun& run, bool isOnlyRun
) | 69 static inline InlineTextBox* createInlineBoxForText(BidiRun& run, bool isOnlyRun
) |
| 70 { | 70 { |
| 71 ASSERT(run.m_object->isText()); | 71 ASSERT(run.m_object->isText()); |
| 72 RenderText* text = toRenderText(run.m_object); | 72 RenderText* text = toRenderText(run.m_object); |
| 73 InlineTextBox* textBox = text->createInlineTextBox(run.m_start, run.m_stop -
run.m_start); | 73 InlineTextBox* textBox = text->createInlineTextBox(run.m_start, run.m_stop -
run.m_start); |
| 74 // We only treat a box as text for a <br> if we are on a line by ourself or
in strict mode | 74 // We only treat a box as text for a <br> if we are on a line by ourself or
in strict mode |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 bool isFirstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent(
)->slowFirstChild() != this); | 556 bool isFirstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent(
)->slowFirstChild() != this); |
| 557 bool isAfterHardLineBreak = lineBox->prevRootBox() && lineBox->prevRootBox()
->endsWithBreak(); | 557 bool isAfterHardLineBreak = lineBox->prevRootBox() && lineBox->prevRootBox()
->endsWithBreak(); |
| 558 IndentTextOrNot shouldIndentText = requiresIndent(isFirstLine, isAfterHardLi
neBreak, styleRef()); | 558 IndentTextOrNot shouldIndentText = requiresIndent(isFirstLine, isAfterHardLi
neBreak, styleRef()); |
| 559 float lineLogicalLeft; | 559 float lineLogicalLeft; |
| 560 float lineLogicalRight; | 560 float lineLogicalRight; |
| 561 float availableLogicalWidth; | 561 float availableLogicalWidth; |
| 562 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availa
bleLogicalWidth, isFirstLine, shouldIndentText, 0); | 562 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availa
bleLogicalWidth, isFirstLine, shouldIndentText, 0); |
| 563 bool needsWordSpacing; | 563 bool needsWordSpacing; |
| 564 | 564 |
| 565 if (firstRun && firstRun->m_object->isReplaced()) { | 565 if (firstRun && firstRun->m_object->isReplaced()) { |
| 566 RenderBox* renderBox = toRenderBox(firstRun->m_object); | 566 LayoutBox* layoutBox = toLayoutBox(firstRun->m_object); |
| 567 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, av
ailableLogicalWidth, isFirstLine, shouldIndentText, renderBox->logicalHeight()); | 567 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, av
ailableLogicalWidth, isFirstLine, shouldIndentText, layoutBox->logicalHeight()); |
| 568 } | 568 } |
| 569 | 569 |
| 570 computeInlineDirectionPositionsForSegment(lineBox, lineInfo, textAlign, line
LogicalLeft, availableLogicalWidth, firstRun, trailingSpaceRun, textBoxDataMap,
verticalPositionCache, wordMeasurements); | 570 computeInlineDirectionPositionsForSegment(lineBox, lineInfo, textAlign, line
LogicalLeft, availableLogicalWidth, firstRun, trailingSpaceRun, textBoxDataMap,
verticalPositionCache, wordMeasurements); |
| 571 // The widths of all runs are now known. We can now place every inline box (
and | 571 // The widths of all runs are now known. We can now place every inline box (
and |
| 572 // compute accurate widths for the inline flow boxes). | 572 // compute accurate widths for the inline flow boxes). |
| 573 needsWordSpacing = lineBox->isLeftToRightDirection() ? false: true; | 573 needsWordSpacing = lineBox->isLeftToRightDirection() ? false: true; |
| 574 lineBox->placeBoxesInInlineDirection(lineLogicalLeft, needsWordSpacing); | 574 lineBox->placeBoxesInInlineDirection(lineLogicalLeft, needsWordSpacing); |
| 575 } | 575 } |
| 576 | 576 |
| 577 BidiRun* RenderBlockFlow::computeInlineDirectionPositionsForSegment(RootInlineBo
x* lineBox, const LineInfo& lineInfo, ETextAlign textAlign, float& logicalLeft, | 577 BidiRun* RenderBlockFlow::computeInlineDirectionPositionsForSegment(RootInlineBo
x* lineBox, const LineInfo& lineInfo, ETextAlign textAlign, float& logicalLeft, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 if (rt->textLength()) { | 609 if (rt->textLength()) { |
| 610 if (!r->m_start && needsWordSpacing && isSpaceOrNewline(rt->char
acterAt(r->m_start))) | 610 if (!r->m_start && needsWordSpacing && isSpaceOrNewline(rt->char
acterAt(r->m_start))) |
| 611 totalLogicalWidth += rt->style(lineInfo.isFirstLine())->font
().fontDescription().wordSpacing(); | 611 totalLogicalWidth += rt->style(lineInfo.isFirstLine())->font
().fontDescription().wordSpacing(); |
| 612 needsWordSpacing = !isSpaceOrNewline(rt->characterAt(r->m_stop -
1)); | 612 needsWordSpacing = !isSpaceOrNewline(rt->characterAt(r->m_stop -
1)); |
| 613 } | 613 } |
| 614 | 614 |
| 615 setLogicalWidthForTextRun(lineBox, r, rt, totalLogicalWidth, lineInf
o, textBoxDataMap, verticalPositionCache, wordMeasurements); | 615 setLogicalWidthForTextRun(lineBox, r, rt, totalLogicalWidth, lineInf
o, textBoxDataMap, verticalPositionCache, wordMeasurements); |
| 616 } else { | 616 } else { |
| 617 isAfterExpansion = false; | 617 isAfterExpansion = false; |
| 618 if (!r->m_object->isRenderInline()) { | 618 if (!r->m_object->isRenderInline()) { |
| 619 RenderBox* renderBox = toRenderBox(r->m_object); | 619 LayoutBox* layoutBox = toLayoutBox(r->m_object); |
| 620 if (renderBox->isRubyRun()) | 620 if (layoutBox->isRubyRun()) |
| 621 setMarginsForRubyRun(r, toLayoutRubyRun(renderBox), previous
Object, lineInfo); | 621 setMarginsForRubyRun(r, toLayoutRubyRun(layoutBox), previous
Object, lineInfo); |
| 622 r->m_box->setLogicalWidth(logicalWidthForChild(*renderBox).toFlo
at()); | 622 r->m_box->setLogicalWidth(logicalWidthForChild(*layoutBox).toFlo
at()); |
| 623 totalLogicalWidth += marginStartForChild(*renderBox) + marginEnd
ForChild(*renderBox); | 623 totalLogicalWidth += marginStartForChild(*layoutBox) + marginEnd
ForChild(*layoutBox); |
| 624 needsWordSpacing = true; | 624 needsWordSpacing = true; |
| 625 } | 625 } |
| 626 } | 626 } |
| 627 | 627 |
| 628 totalLogicalWidth += r->m_box->logicalWidth(); | 628 totalLogicalWidth += r->m_box->logicalWidth(); |
| 629 previousObject = r->m_object; | 629 previousObject = r->m_object; |
| 630 } | 630 } |
| 631 | 631 |
| 632 if (isAfterExpansion && !expansionOpportunities.isEmpty()) { | 632 if (isAfterExpansion && !expansionOpportunities.isEmpty()) { |
| 633 expansionOpportunities.last()--; | 633 expansionOpportunities.last()--; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 655 // Align positioned boxes with the top of the line box. This is | 655 // Align positioned boxes with the top of the line box. This is |
| 656 // a reasonable approximation of an appropriate y position. | 656 // a reasonable approximation of an appropriate y position. |
| 657 if (r->m_object->isOutOfFlowPositioned()) | 657 if (r->m_object->isOutOfFlowPositioned()) |
| 658 r->m_box->setLogicalTop(logicalHeight().toFloat()); | 658 r->m_box->setLogicalTop(logicalHeight().toFloat()); |
| 659 | 659 |
| 660 // Position is used to properly position both replaced elements and | 660 // Position is used to properly position both replaced elements and |
| 661 // to update the static normal flow x/y of positioned elements. | 661 // to update the static normal flow x/y of positioned elements. |
| 662 if (r->m_object->isText()) | 662 if (r->m_object->isText()) |
| 663 toRenderText(r->m_object)->positionLineBox(r->m_box); | 663 toRenderText(r->m_object)->positionLineBox(r->m_box); |
| 664 else if (r->m_object->isBox()) | 664 else if (r->m_object->isBox()) |
| 665 toRenderBox(r->m_object)->positionLineBox(r->m_box); | 665 toLayoutBox(r->m_object)->positionLineBox(r->m_box); |
| 666 } | 666 } |
| 667 } | 667 } |
| 668 | 668 |
| 669 void RenderBlockFlow::appendFloatingObjectToLastLine(FloatingObject* floatingObj
ect) | 669 void RenderBlockFlow::appendFloatingObjectToLastLine(FloatingObject* floatingObj
ect) |
| 670 { | 670 { |
| 671 ASSERT(!floatingObject->originatingLine()); | 671 ASSERT(!floatingObject->originatingLine()); |
| 672 floatingObject->setOriginatingLine(lastRootBox()); | 672 floatingObject->setOriginatingLine(lastRootBox()); |
| 673 lastRootBox()->appendFloat(floatingObject->renderer()); | 673 lastRootBox()->appendFloat(floatingObject->renderer()); |
| 674 } | 674 } |
| 675 | 675 |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 for (RootInlineBox* line = layoutState.endLine(); line; line = line-
>nextRootBox()) { | 998 for (RootInlineBox* line = layoutState.endLine(); line; line = line-
>nextRootBox()) { |
| 999 line->attachLine(); | 999 line->attachLine(); |
| 1000 if (paginated) { | 1000 if (paginated) { |
| 1001 delta -= line->paginationStrut(); | 1001 delta -= line->paginationStrut(); |
| 1002 adjustLinePositionForPagination(*line, delta, layoutState.fl
owThread()); | 1002 adjustLinePositionForPagination(*line, delta, layoutState.fl
owThread()); |
| 1003 } | 1003 } |
| 1004 if (delta) { | 1004 if (delta) { |
| 1005 layoutState.updatePaintInvalidationRangeFromBox(line, delta)
; | 1005 layoutState.updatePaintInvalidationRangeFromBox(line, delta)
; |
| 1006 line->adjustBlockDirectionPosition(delta.toFloat()); | 1006 line->adjustBlockDirectionPosition(delta.toFloat()); |
| 1007 } | 1007 } |
| 1008 if (Vector<RenderBox*>* cleanLineFloats = line->floatsPtr()) { | 1008 if (Vector<LayoutBox*>* cleanLineFloats = line->floatsPtr()) { |
| 1009 Vector<RenderBox*>::iterator end = cleanLineFloats->end(); | 1009 Vector<LayoutBox*>::iterator end = cleanLineFloats->end(); |
| 1010 for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin
(); f != end; ++f) { | 1010 for (Vector<LayoutBox*>::iterator f = cleanLineFloats->begin
(); f != end; ++f) { |
| 1011 FloatingObject* floatingObject = insertFloatingObject(**
f); | 1011 FloatingObject* floatingObject = insertFloatingObject(**
f); |
| 1012 ASSERT(!floatingObject->originatingLine()); | 1012 ASSERT(!floatingObject->originatingLine()); |
| 1013 floatingObject->setOriginatingLine(line); | 1013 floatingObject->setOriginatingLine(line); |
| 1014 setLogicalHeight(logicalTopForChild(**f) - marginBeforeF
orChild(**f) + delta); | 1014 setLogicalHeight(logicalTopForChild(**f) - marginBeforeF
orChild(**f) + delta); |
| 1015 positionNewFloats(); | 1015 positionNewFloats(); |
| 1016 } | 1016 } |
| 1017 } | 1017 } |
| 1018 } | 1018 } |
| 1019 setLogicalHeight(lastRootBox()->lineBottomWithLeading()); | 1019 setLogicalHeight(lastRootBox()->lineBottomWithLeading()); |
| 1020 } else { | 1020 } else { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 } | 1063 } |
| 1064 | 1064 |
| 1065 void RenderBlockFlow::markDirtyFloatsForPaintInvalidation(Vector<FloatWithRect>&
floats) | 1065 void RenderBlockFlow::markDirtyFloatsForPaintInvalidation(Vector<FloatWithRect>&
floats) |
| 1066 { | 1066 { |
| 1067 size_t floatCount = floats.size(); | 1067 size_t floatCount = floats.size(); |
| 1068 // Floats that did not have layout did not paint invalidations when we laid
them out. They would have | 1068 // Floats that did not have layout did not paint invalidations when we laid
them out. They would have |
| 1069 // painted by now if they had moved, but if they stayed at (0, 0), they stil
l need to be | 1069 // painted by now if they had moved, but if they stayed at (0, 0), they stil
l need to be |
| 1070 // painted. | 1070 // painted. |
| 1071 for (size_t i = 0; i < floatCount; ++i) { | 1071 for (size_t i = 0; i < floatCount; ++i) { |
| 1072 if (!floats[i].everHadLayout) { | 1072 if (!floats[i].everHadLayout) { |
| 1073 RenderBox* f = floats[i].object; | 1073 LayoutBox* f = floats[i].object; |
| 1074 if (!f->location().x() && !f->location().y()) | 1074 if (!f->location().x() && !f->location().y()) |
| 1075 f->setShouldDoFullPaintInvalidation(); | 1075 f->setShouldDoFullPaintInvalidation(); |
| 1076 } | 1076 } |
| 1077 } | 1077 } |
| 1078 } | 1078 } |
| 1079 | 1079 |
| 1080 struct InlineMinMaxIterator { | 1080 struct InlineMinMaxIterator { |
| 1081 /* InlineMinMaxIterator is a class that will iterate over all render objects tha
t contribute to | 1081 /* InlineMinMaxIterator is a class that will iterate over all render objects tha
t contribute to |
| 1082 inline min/max width calculations. Note the following about the way it walks
: | 1082 inline min/max width calculations. Note the following about the way it walks
: |
| 1083 (1) Positioned content is skipped (since it does not contribute to min/max wi
dth of a block) | 1083 (1) Positioned content is skipped (since it does not contribute to min/max wi
dth of a block) |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1309 childMax += margins; | 1309 childMax += margins; |
| 1310 } | 1310 } |
| 1311 } | 1311 } |
| 1312 | 1312 |
| 1313 if (!child->isRenderInline() && !child->isText()) { | 1313 if (!child->isRenderInline() && !child->isText()) { |
| 1314 // Case (2). Inline replaced elements and floats. | 1314 // Case (2). Inline replaced elements and floats. |
| 1315 // Go ahead and terminate the current line as far as | 1315 // Go ahead and terminate the current line as far as |
| 1316 // minwidth is concerned. | 1316 // minwidth is concerned. |
| 1317 LayoutUnit childMinPreferredLogicalWidth, childMaxPreferredLogic
alWidth; | 1317 LayoutUnit childMinPreferredLogicalWidth, childMaxPreferredLogic
alWidth; |
| 1318 if (child->isBox() && child->isHorizontalWritingMode() != isHori
zontalWritingMode()) { | 1318 if (child->isBox() && child->isHorizontalWritingMode() != isHori
zontalWritingMode()) { |
| 1319 RenderBox* childBox = toRenderBox(child); | 1319 LayoutBox* childBox = toLayoutBox(child); |
| 1320 LogicalExtentComputedValues computedValues; | 1320 LogicalExtentComputedValues computedValues; |
| 1321 childBox->computeLogicalHeight(childBox->borderAndPaddingLog
icalHeight(), 0, computedValues); | 1321 childBox->computeLogicalHeight(childBox->borderAndPaddingLog
icalHeight(), 0, computedValues); |
| 1322 childMinPreferredLogicalWidth = childMaxPreferredLogicalWidt
h = computedValues.m_extent; | 1322 childMinPreferredLogicalWidth = childMaxPreferredLogicalWidt
h = computedValues.m_extent; |
| 1323 } else { | 1323 } else { |
| 1324 childMinPreferredLogicalWidth = child->minPreferredLogicalWi
dth(); | 1324 childMinPreferredLogicalWidth = child->minPreferredLogicalWi
dth(); |
| 1325 childMaxPreferredLogicalWidth = child->maxPreferredLogicalWi
dth(); | 1325 childMaxPreferredLogicalWidth = child->maxPreferredLogicalWi
dth(); |
| 1326 } | 1326 } |
| 1327 childMin += childMinPreferredLogicalWidth; | 1327 childMin += childMinPreferredLogicalWidth; |
| 1328 childMax += childMaxPreferredLogicalWidth; | 1328 childMax += childMaxPreferredLogicalWidth; |
| 1329 | 1329 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1544 // Walk all the lines and delete our ellipsis line boxes if they exist. | 1544 // Walk all the lines and delete our ellipsis line boxes if they exist. |
| 1545 if (hasTextOverflow) | 1545 if (hasTextOverflow) |
| 1546 deleteEllipsisLineBoxes(); | 1546 deleteEllipsisLineBoxes(); |
| 1547 | 1547 |
| 1548 if (firstChild()) { | 1548 if (firstChild()) { |
| 1549 // In full layout mode, clear the line boxes of children upfront. Otherw
ise, | 1549 // In full layout mode, clear the line boxes of children upfront. Otherw
ise, |
| 1550 // siblings can run into stale root lineboxes during layout. Then layout | 1550 // siblings can run into stale root lineboxes during layout. Then layout |
| 1551 // the replaced elements later. In partial layout mode, line boxes are n
ot | 1551 // the replaced elements later. In partial layout mode, line boxes are n
ot |
| 1552 // deleted and only dirtied. In that case, we can layout the replaced | 1552 // deleted and only dirtied. In that case, we can layout the replaced |
| 1553 // elements at the same time. | 1553 // elements at the same time. |
| 1554 Vector<RenderBox*> replacedChildren; | 1554 Vector<LayoutBox*> replacedChildren; |
| 1555 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { | 1555 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { |
| 1556 LayoutObject* o = walker.current(); | 1556 LayoutObject* o = walker.current(); |
| 1557 | 1557 |
| 1558 if (!layoutState.hasInlineChild() && o->isInline()) | 1558 if (!layoutState.hasInlineChild() && o->isInline()) |
| 1559 layoutState.setHasInlineChild(true); | 1559 layoutState.setHasInlineChild(true); |
| 1560 | 1560 |
| 1561 if (o->isReplaced() || o->isFloating() || o->isOutOfFlowPositioned()
) { | 1561 if (o->isReplaced() || o->isFloating() || o->isOutOfFlowPositioned()
) { |
| 1562 RenderBox* box = toRenderBox(o); | 1562 LayoutBox* box = toLayoutBox(o); |
| 1563 | 1563 |
| 1564 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *box); | 1564 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *box); |
| 1565 | 1565 |
| 1566 if (o->isOutOfFlowPositioned()) | 1566 if (o->isOutOfFlowPositioned()) |
| 1567 o->containingBlock()->insertPositionedObject(box); | 1567 o->containingBlock()->insertPositionedObject(box); |
| 1568 else if (o->isFloating()) | 1568 else if (o->isFloating()) |
| 1569 layoutState.floats().append(FloatWithRect(box)); | 1569 layoutState.floats().append(FloatWithRect(box)); |
| 1570 else if (isFullLayout || o->needsLayout()) { | 1570 else if (isFullLayout || o->needsLayout()) { |
| 1571 // Replaced element. | 1571 // Replaced element. |
| 1572 box->dirtyLineBoxes(isFullLayout); | 1572 box->dirtyLineBoxes(isFullLayout); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1611 if (hasTextOverflow) | 1611 if (hasTextOverflow) |
| 1612 checkLinesForTextOverflow(); | 1612 checkLinesForTextOverflow(); |
| 1613 | 1613 |
| 1614 // Ensure the new line boxes will be painted. | 1614 // Ensure the new line boxes will be painted. |
| 1615 if (isFullLayout && firstLineBox()) | 1615 if (isFullLayout && firstLineBox()) |
| 1616 setShouldDoFullPaintInvalidation(); | 1616 setShouldDoFullPaintInvalidation(); |
| 1617 } | 1617 } |
| 1618 | 1618 |
| 1619 void RenderBlockFlow::checkFloatsInCleanLine(RootInlineBox* line, Vector<FloatWi
thRect>& floats, size_t& floatIndex, bool& encounteredNewFloat, bool& dirtiedByF
loat) | 1619 void RenderBlockFlow::checkFloatsInCleanLine(RootInlineBox* line, Vector<FloatWi
thRect>& floats, size_t& floatIndex, bool& encounteredNewFloat, bool& dirtiedByF
loat) |
| 1620 { | 1620 { |
| 1621 Vector<RenderBox*>* cleanLineFloats = line->floatsPtr(); | 1621 Vector<LayoutBox*>* cleanLineFloats = line->floatsPtr(); |
| 1622 if (!cleanLineFloats) | 1622 if (!cleanLineFloats) |
| 1623 return; | 1623 return; |
| 1624 | 1624 |
| 1625 Vector<RenderBox*>::iterator end = cleanLineFloats->end(); | 1625 Vector<LayoutBox*>::iterator end = cleanLineFloats->end(); |
| 1626 for (Vector<RenderBox*>::iterator it = cleanLineFloats->begin(); it != end;
++it) { | 1626 for (Vector<LayoutBox*>::iterator it = cleanLineFloats->begin(); it != end;
++it) { |
| 1627 RenderBox* floatingBox = *it; | 1627 LayoutBox* floatingBox = *it; |
| 1628 floatingBox->layoutIfNeeded(); | 1628 floatingBox->layoutIfNeeded(); |
| 1629 LayoutSize newSize = floatingBox->size() + | 1629 LayoutSize newSize = floatingBox->size() + |
| 1630 LayoutSize(floatingBox->marginWidth(), floatingBox->marginHeight()); | 1630 LayoutSize(floatingBox->marginWidth(), floatingBox->marginHeight()); |
| 1631 if (floats[floatIndex].object != floatingBox) { | 1631 if (floats[floatIndex].object != floatingBox) { |
| 1632 encounteredNewFloat = true; | 1632 encounteredNewFloat = true; |
| 1633 return; | 1633 return; |
| 1634 } | 1634 } |
| 1635 | 1635 |
| 1636 if (floats[floatIndex].rect.size() != newSize) { | 1636 if (floats[floatIndex].rect.size() != newSize) { |
| 1637 LayoutUnit floatTop = isHorizontalWritingMode() ? floats[floatIndex]
.rect.y() : floats[floatIndex].rect.x(); | 1637 LayoutUnit floatTop = isHorizontalWritingMode() ? floats[floatIndex]
.rect.y() : floats[floatIndex].rect.x(); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1726 // If we have no dirty lines, then last is just the last root box. | 1726 // If we have no dirty lines, then last is just the last root box. |
| 1727 last = curr ? curr->prevRootBox() : lastRootBox(); | 1727 last = curr ? curr->prevRootBox() : lastRootBox(); |
| 1728 } | 1728 } |
| 1729 | 1729 |
| 1730 unsigned numCleanFloats = 0; | 1730 unsigned numCleanFloats = 0; |
| 1731 if (!layoutState.floats().isEmpty()) { | 1731 if (!layoutState.floats().isEmpty()) { |
| 1732 LayoutUnit savedLogicalHeight = logicalHeight(); | 1732 LayoutUnit savedLogicalHeight = logicalHeight(); |
| 1733 // Restore floats from clean lines. | 1733 // Restore floats from clean lines. |
| 1734 RootInlineBox* line = firstRootBox(); | 1734 RootInlineBox* line = firstRootBox(); |
| 1735 while (line != curr) { | 1735 while (line != curr) { |
| 1736 if (Vector<RenderBox*>* cleanLineFloats = line->floatsPtr()) { | 1736 if (Vector<LayoutBox*>* cleanLineFloats = line->floatsPtr()) { |
| 1737 Vector<RenderBox*>::iterator end = cleanLineFloats->end(); | 1737 Vector<LayoutBox*>::iterator end = cleanLineFloats->end(); |
| 1738 for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin();
f != end; ++f) { | 1738 for (Vector<LayoutBox*>::iterator f = cleanLineFloats->begin();
f != end; ++f) { |
| 1739 FloatingObject* floatingObject = insertFloatingObject(**f); | 1739 FloatingObject* floatingObject = insertFloatingObject(**f); |
| 1740 ASSERT(!floatingObject->originatingLine()); | 1740 ASSERT(!floatingObject->originatingLine()); |
| 1741 floatingObject->setOriginatingLine(line); | 1741 floatingObject->setOriginatingLine(line); |
| 1742 setLogicalHeight(logicalTopForChild(**f) - marginBeforeForCh
ild(**f)); | 1742 setLogicalHeight(logicalTopForChild(**f) - marginBeforeForCh
ild(**f)); |
| 1743 positionNewFloats(); | 1743 positionNewFloats(); |
| 1744 ASSERT(layoutState.floats()[numCleanFloats].object == *f); | 1744 ASSERT(layoutState.floats()[numCleanFloats].object == *f); |
| 1745 numCleanFloats++; | 1745 numCleanFloats++; |
| 1746 } | 1746 } |
| 1747 } | 1747 } |
| 1748 line = line->nextRootBox(); | 1748 line = line->nextRootBox(); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2008 FloatingObjectSetIterator it = floatingObjectSet.end(); | 2008 FloatingObjectSetIterator it = floatingObjectSet.end(); |
| 2009 --it; // Last float is newFloat, skip that one. | 2009 --it; // Last float is newFloat, skip that one. |
| 2010 FloatingObjectSetIterator begin = floatingObjectSet.begin(); | 2010 FloatingObjectSetIterator begin = floatingObjectSet.begin(); |
| 2011 while (it != begin) { | 2011 while (it != begin) { |
| 2012 --it; | 2012 --it; |
| 2013 FloatingObject* floatingObject = it->get(); | 2013 FloatingObject* floatingObject = it->get(); |
| 2014 if (floatingObject == lastFloatFromPreviousLine) | 2014 if (floatingObject == lastFloatFromPreviousLine) |
| 2015 break; | 2015 break; |
| 2016 if (logicalTopForFloat(floatingObject) == logicalHeight() + lineInfo.flo
atPaginationStrut()) { | 2016 if (logicalTopForFloat(floatingObject) == logicalHeight() + lineInfo.flo
atPaginationStrut()) { |
| 2017 floatingObject->setPaginationStrut(paginationStrut + floatingObject-
>paginationStrut()); | 2017 floatingObject->setPaginationStrut(paginationStrut + floatingObject-
>paginationStrut()); |
| 2018 RenderBox* floatBox = floatingObject->renderer(); | 2018 LayoutBox* floatBox = floatingObject->renderer(); |
| 2019 setLogicalTopForChild(*floatBox, logicalTopForChild(*floatBox) + mar
ginBeforeForChild(*floatBox) + paginationStrut); | 2019 setLogicalTopForChild(*floatBox, logicalTopForChild(*floatBox) + mar
ginBeforeForChild(*floatBox) + paginationStrut); |
| 2020 if (floatBox->isRenderBlock()) | 2020 if (floatBox->isRenderBlock()) |
| 2021 floatBox->forceChildLayout(); | 2021 floatBox->forceChildLayout(); |
| 2022 else | 2022 else |
| 2023 floatBox->layoutIfNeeded(); | 2023 floatBox->layoutIfNeeded(); |
| 2024 // Save the old logical top before calling removePlacedObject which
will set | 2024 // Save the old logical top before calling removePlacedObject which
will set |
| 2025 // isPlaced to false. Otherwise it will trigger an assert in logical
TopForFloat. | 2025 // isPlaced to false. Otherwise it will trigger an assert in logical
TopForFloat. |
| 2026 LayoutUnit oldLogicalTop = logicalTopForFloat(floatingObject); | 2026 LayoutUnit oldLogicalTop = logicalTopForFloat(floatingObject); |
| 2027 m_floatingObjects->removePlacedObject(floatingObject); | 2027 m_floatingObjects->removePlacedObject(floatingObject); |
| 2028 setLogicalTopForFloat(floatingObject, oldLogicalTop + paginationStru
t); | 2028 setLogicalTopForFloat(floatingObject, oldLogicalTop + paginationStru
t); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2048 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat
(); | 2048 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat
(); |
| 2049 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal
se) - logicalLeft; | 2049 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal
se) - logicalLeft; |
| 2050 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); | 2050 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); |
| 2051 | 2051 |
| 2052 if (!style()->isLeftToRightDirection()) | 2052 if (!style()->isLeftToRightDirection()) |
| 2053 return logicalWidth() - logicalLeft; | 2053 return logicalWidth() - logicalLeft; |
| 2054 return logicalLeft; | 2054 return logicalLeft; |
| 2055 } | 2055 } |
| 2056 | 2056 |
| 2057 } | 2057 } |
| OLD | NEW |