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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 int startOverhang; | 357 int startOverhang; |
358 int endOverhang; | 358 int endOverhang; |
359 RenderObject* nextObject = 0; | 359 RenderObject* nextObject = 0; |
360 for (BidiRun* runWithNextObject = run->next(); runWithNextObject; runWithNex
tObject = runWithNextObject->next()) { | 360 for (BidiRun* runWithNextObject = run->next(); runWithNextObject; runWithNex
tObject = runWithNextObject->next()) { |
361 if (!runWithNextObject->m_object->isOutOfFlowPositioned() && !runWithNex
tObject->m_box->isLineBreak()) { | 361 if (!runWithNextObject->m_object->isOutOfFlowPositioned() && !runWithNex
tObject->m_box->isLineBreak()) { |
362 nextObject = runWithNextObject->m_object; | 362 nextObject = runWithNextObject->m_object; |
363 break; | 363 break; |
364 } | 364 } |
365 } | 365 } |
366 renderer->getOverhang(lineInfo.isFirstLine(), renderer->style()->isLeftToRig
htDirection() ? previousObject : nextObject, renderer->style()->isLeftToRightDir
ection() ? nextObject : previousObject, startOverhang, endOverhang); | 366 renderer->getOverhang(lineInfo.isFirstLine(), renderer->style()->isLeftToRig
htDirection() ? previousObject : nextObject, renderer->style()->isLeftToRightDir
ection() ? nextObject : previousObject, startOverhang, endOverhang); |
367 setMarginStartForChild(renderer, -startOverhang); | 367 setMarginStartForChild(*renderer, -startOverhang); |
368 setMarginEndForChild(renderer, -endOverhang); | 368 setMarginEndForChild(*renderer, -endOverhang); |
369 } | 369 } |
370 | 370 |
371 static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* ru
n, RenderText* renderer, float xPos, const LineInfo& lineInfo, | 371 static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* ru
n, RenderText* renderer, float xPos, const LineInfo& lineInfo, |
372 GlyphOverflowAndFallbackFontsMap& t
extBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMeasurements& w
ordMeasurements) | 372 GlyphOverflowAndFallbackFontsMap& t
extBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMeasurements& w
ordMeasurements) |
373 { | 373 { |
374 HashSet<const SimpleFontData*> fallbackFonts; | 374 HashSet<const SimpleFontData*> fallbackFonts; |
375 GlyphOverflow glyphOverflow; | 375 GlyphOverflow glyphOverflow; |
376 | 376 |
377 const Font& font = renderer->style(lineInfo.isFirstLine())->font(); | 377 const Font& font = renderer->style(lineInfo.isFirstLine())->font(); |
378 // Always compute glyph overflow if the block's line-box-contain value is "g
lyphs". | 378 // Always compute glyph overflow if the block's line-box-contain value is "g
lyphs". |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 needsWordSpacing = !isSpaceOrNewline(rt->characterAt(r->m_stop -
1)); | 615 needsWordSpacing = !isSpaceOrNewline(rt->characterAt(r->m_stop -
1)); |
616 } | 616 } |
617 | 617 |
618 setLogicalWidthForTextRun(lineBox, r, rt, totalLogicalWidth, lineInf
o, textBoxDataMap, verticalPositionCache, wordMeasurements); | 618 setLogicalWidthForTextRun(lineBox, r, rt, totalLogicalWidth, lineInf
o, textBoxDataMap, verticalPositionCache, wordMeasurements); |
619 } else { | 619 } else { |
620 isAfterExpansion = false; | 620 isAfterExpansion = false; |
621 if (!r->m_object->isRenderInline()) { | 621 if (!r->m_object->isRenderInline()) { |
622 RenderBox* renderBox = toRenderBox(r->m_object); | 622 RenderBox* renderBox = toRenderBox(r->m_object); |
623 if (renderBox->isRubyRun()) | 623 if (renderBox->isRubyRun()) |
624 setMarginsForRubyRun(r, toRenderRubyRun(renderBox), previous
Object, lineInfo); | 624 setMarginsForRubyRun(r, toRenderRubyRun(renderBox), previous
Object, lineInfo); |
625 r->m_box->setLogicalWidth(logicalWidthForChild(renderBox).toFloa
t()); | 625 r->m_box->setLogicalWidth(logicalWidthForChild(*renderBox).toFlo
at()); |
626 totalLogicalWidth += marginStartForChild(renderBox) + marginEndF
orChild(renderBox); | 626 totalLogicalWidth += marginStartForChild(*renderBox) + marginEnd
ForChild(*renderBox); |
627 needsWordSpacing = true; | 627 needsWordSpacing = true; |
628 } | 628 } |
629 } | 629 } |
630 | 630 |
631 totalLogicalWidth += r->m_box->logicalWidth(); | 631 totalLogicalWidth += r->m_box->logicalWidth(); |
632 previousObject = r->m_object; | 632 previousObject = r->m_object; |
633 } | 633 } |
634 | 634 |
635 if (isAfterExpansion && !expansionOpportunities.isEmpty()) { | 635 if (isAfterExpansion && !expansionOpportunities.isEmpty()) { |
636 expansionOpportunities.last()--; | 636 expansionOpportunities.last()--; |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 if (delta) { | 1007 if (delta) { |
1008 layoutState.updatePaintInvalidationRangeFromBox(line, delta)
; | 1008 layoutState.updatePaintInvalidationRangeFromBox(line, delta)
; |
1009 line->adjustBlockDirectionPosition(delta.toFloat()); | 1009 line->adjustBlockDirectionPosition(delta.toFloat()); |
1010 } | 1010 } |
1011 if (Vector<RenderBox*>* cleanLineFloats = line->floatsPtr()) { | 1011 if (Vector<RenderBox*>* cleanLineFloats = line->floatsPtr()) { |
1012 Vector<RenderBox*>::iterator end = cleanLineFloats->end(); | 1012 Vector<RenderBox*>::iterator end = cleanLineFloats->end(); |
1013 for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin
(); f != end; ++f) { | 1013 for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin
(); f != end; ++f) { |
1014 FloatingObject* floatingObject = insertFloatingObject(*f
); | 1014 FloatingObject* floatingObject = insertFloatingObject(*f
); |
1015 ASSERT(!floatingObject->originatingLine()); | 1015 ASSERT(!floatingObject->originatingLine()); |
1016 floatingObject->setOriginatingLine(line); | 1016 floatingObject->setOriginatingLine(line); |
1017 setLogicalHeight(logicalTopForChild(*f) - marginBeforeFo
rChild(*f) + delta); | 1017 setLogicalHeight(logicalTopForChild(**f) - marginBeforeF
orChild(**f) + delta); |
1018 positionNewFloats(); | 1018 positionNewFloats(); |
1019 } | 1019 } |
1020 } | 1020 } |
1021 } | 1021 } |
1022 setLogicalHeight(lastRootBox()->lineBottomWithLeading()); | 1022 setLogicalHeight(lastRootBox()->lineBottomWithLeading()); |
1023 } else { | 1023 } else { |
1024 // Delete all the remaining lines. | 1024 // Delete all the remaining lines. |
1025 deleteLineRange(layoutState, layoutState.endLine()); | 1025 deleteLineRange(layoutState, layoutState.endLine()); |
1026 } | 1026 } |
1027 } | 1027 } |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1554 Vector<RenderBox*> replacedChildren; | 1554 Vector<RenderBox*> replacedChildren; |
1555 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { | 1555 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { |
1556 RenderObject* o = walker.current(); | 1556 RenderObject* 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 RenderBox* box = toRenderBox(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); |
1573 if (isFullLayout) | 1573 if (isFullLayout) |
1574 replacedChildren.append(box); | 1574 replacedChildren.append(box); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 LayoutUnit savedLogicalHeight = logicalHeight(); | 1731 LayoutUnit savedLogicalHeight = logicalHeight(); |
1732 // Restore floats from clean lines. | 1732 // Restore floats from clean lines. |
1733 RootInlineBox* line = firstRootBox(); | 1733 RootInlineBox* line = firstRootBox(); |
1734 while (line != curr) { | 1734 while (line != curr) { |
1735 if (Vector<RenderBox*>* cleanLineFloats = line->floatsPtr()) { | 1735 if (Vector<RenderBox*>* cleanLineFloats = line->floatsPtr()) { |
1736 Vector<RenderBox*>::iterator end = cleanLineFloats->end(); | 1736 Vector<RenderBox*>::iterator end = cleanLineFloats->end(); |
1737 for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin();
f != end; ++f) { | 1737 for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin();
f != end; ++f) { |
1738 FloatingObject* floatingObject = insertFloatingObject(*f); | 1738 FloatingObject* floatingObject = insertFloatingObject(*f); |
1739 ASSERT(!floatingObject->originatingLine()); | 1739 ASSERT(!floatingObject->originatingLine()); |
1740 floatingObject->setOriginatingLine(line); | 1740 floatingObject->setOriginatingLine(line); |
1741 setLogicalHeight(logicalTopForChild(*f) - marginBeforeForChi
ld(*f)); | 1741 setLogicalHeight(logicalTopForChild(**f) - marginBeforeForCh
ild(**f)); |
1742 positionNewFloats(); | 1742 positionNewFloats(); |
1743 ASSERT(layoutState.floats()[numCleanFloats].object == *f); | 1743 ASSERT(layoutState.floats()[numCleanFloats].object == *f); |
1744 numCleanFloats++; | 1744 numCleanFloats++; |
1745 } | 1745 } |
1746 } | 1746 } |
1747 line = line->nextRootBox(); | 1747 line = line->nextRootBox(); |
1748 } | 1748 } |
1749 setLogicalHeight(savedLogicalHeight); | 1749 setLogicalHeight(savedLogicalHeight); |
1750 } | 1750 } |
1751 layoutState.setFloatIndex(numCleanFloats); | 1751 layoutState.setFloatIndex(numCleanFloats); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2010 --it; // Last float is newFloat, skip that one. | 2010 --it; // Last float is newFloat, skip that one. |
2011 FloatingObjectSetIterator begin = floatingObjectSet.begin(); | 2011 FloatingObjectSetIterator begin = floatingObjectSet.begin(); |
2012 while (it != begin) { | 2012 while (it != begin) { |
2013 --it; | 2013 --it; |
2014 FloatingObject* floatingObject = it->get(); | 2014 FloatingObject* floatingObject = it->get(); |
2015 if (floatingObject == lastFloatFromPreviousLine) | 2015 if (floatingObject == lastFloatFromPreviousLine) |
2016 break; | 2016 break; |
2017 if (logicalTopForFloat(floatingObject) == logicalHeight() + lineInfo.flo
atPaginationStrut()) { | 2017 if (logicalTopForFloat(floatingObject) == logicalHeight() + lineInfo.flo
atPaginationStrut()) { |
2018 floatingObject->setPaginationStrut(paginationStrut + floatingObject-
>paginationStrut()); | 2018 floatingObject->setPaginationStrut(paginationStrut + floatingObject-
>paginationStrut()); |
2019 RenderBox* floatBox = floatingObject->renderer(); | 2019 RenderBox* floatBox = floatingObject->renderer(); |
2020 setLogicalTopForChild(floatBox, logicalTopForChild(floatBox) + margi
nBeforeForChild(floatBox) + paginationStrut); | 2020 setLogicalTopForChild(floatBox, logicalTopForChild(*floatBox) + marg
inBeforeForChild(*floatBox) + paginationStrut); |
2021 if (floatBox->isRenderBlock()) | 2021 if (floatBox->isRenderBlock()) |
2022 floatBox->forceChildLayout(); | 2022 floatBox->forceChildLayout(); |
2023 else | 2023 else |
2024 floatBox->layoutIfNeeded(); | 2024 floatBox->layoutIfNeeded(); |
2025 // Save the old logical top before calling removePlacedObject which
will set | 2025 // Save the old logical top before calling removePlacedObject which
will set |
2026 // isPlaced to false. Otherwise it will trigger an assert in logical
TopForFloat. | 2026 // isPlaced to false. Otherwise it will trigger an assert in logical
TopForFloat. |
2027 LayoutUnit oldLogicalTop = logicalTopForFloat(floatingObject); | 2027 LayoutUnit oldLogicalTop = logicalTopForFloat(floatingObject); |
2028 m_floatingObjects->removePlacedObject(floatingObject); | 2028 m_floatingObjects->removePlacedObject(floatingObject); |
2029 setLogicalTopForFloat(floatingObject, oldLogicalTop + paginationStru
t); | 2029 setLogicalTopForFloat(floatingObject, oldLogicalTop + paginationStru
t); |
2030 m_floatingObjects->addPlacedObject(floatingObject); | 2030 m_floatingObjects->addPlacedObject(floatingObject); |
(...skipping 18 matching lines...) Expand all Loading... |
2049 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat
(); | 2049 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat
(); |
2050 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal
se) - logicalLeft; | 2050 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal
se) - logicalLeft; |
2051 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); | 2051 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); |
2052 | 2052 |
2053 if (!style()->isLeftToRightDirection()) | 2053 if (!style()->isLeftToRightDirection()) |
2054 return logicalWidth() - logicalLeft; | 2054 return logicalWidth() - logicalLeft; |
2055 return logicalLeft; | 2055 return logicalLeft; |
2056 } | 2056 } |
2057 | 2057 |
2058 } | 2058 } |
OLD | NEW |