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 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 // the replaced elements later. In partial layout mode, line boxes are n
ot | 1538 // the replaced elements later. In partial layout mode, line boxes are n
ot |
1539 // deleted and only dirtied. In that case, we can layout the replaced | 1539 // deleted and only dirtied. In that case, we can layout the replaced |
1540 // elements at the same time. | 1540 // elements at the same time. |
1541 Vector<LayoutBox*> replacedChildren; | 1541 Vector<LayoutBox*> replacedChildren; |
1542 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { | 1542 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { |
1543 LayoutObject* o = walker.current(); | 1543 LayoutObject* o = walker.current(); |
1544 | 1544 |
1545 if (!layoutState.hasInlineChild() && o->isInline()) | 1545 if (!layoutState.hasInlineChild() && o->isInline()) |
1546 layoutState.setHasInlineChild(true); | 1546 layoutState.setHasInlineChild(true); |
1547 | 1547 |
| 1548 if (o->isBR() && o->style()->clear() != CNONE) |
| 1549 layoutState.setContainsBRWithClear(true); |
| 1550 |
1548 if (o->isReplaced() || o->isFloating() || o->isOutOfFlowPositioned()
) { | 1551 if (o->isReplaced() || o->isFloating() || o->isOutOfFlowPositioned()
) { |
1549 LayoutBox* box = toLayoutBox(o); | 1552 LayoutBox* box = toLayoutBox(o); |
1550 | 1553 |
1551 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *box); | 1554 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *box); |
1552 | 1555 |
1553 if (o->isOutOfFlowPositioned()) { | 1556 if (o->isOutOfFlowPositioned()) { |
1554 o->containingBlock()->insertPositionedObject(box); | 1557 o->containingBlock()->insertPositionedObject(box); |
1555 } else if (o->isFloating()) { | 1558 } else if (o->isFloating()) { |
1556 layoutState.floats().append(FloatWithRect(box)); | 1559 layoutState.floats().append(FloatWithRect(box)); |
1557 } else if (isFullLayout || o->needsLayout()) { | 1560 } else if (isFullLayout || o->needsLayout()) { |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1833 } | 1836 } |
1834 | 1837 |
1835 return true; | 1838 return true; |
1836 } | 1839 } |
1837 | 1840 |
1838 bool LayoutBlockFlow::matchedEndLine(LineLayoutState& layoutState, const InlineB
idiResolver& resolver, const InlineIterator& endLineStart, const BidiStatus& end
LineStatus) | 1841 bool LayoutBlockFlow::matchedEndLine(LineLayoutState& layoutState, const InlineB
idiResolver& resolver, const InlineIterator& endLineStart, const BidiStatus& end
LineStatus) |
1839 { | 1842 { |
1840 if (resolver.position() == endLineStart) { | 1843 if (resolver.position() == endLineStart) { |
1841 if (resolver.status() != endLineStatus) | 1844 if (resolver.status() != endLineStatus) |
1842 return false; | 1845 return false; |
| 1846 |
| 1847 // A trailing BR can be collapsed as it usually doesn't contribute to th
e height, |
| 1848 // but if it has a clear style we need to force it to layout in the cont
ext of floats |
| 1849 // to honor that style. |
| 1850 if (layoutState.containsBRWithClear() && containsFloats()) |
| 1851 return false; |
1843 return checkPaginationAndFloatsAtEndLine(layoutState); | 1852 return checkPaginationAndFloatsAtEndLine(layoutState); |
1844 } | 1853 } |
1845 | 1854 |
1846 // The first clean line doesn't match, but we can check a handful of followi
ng lines to try | 1855 // The first clean line doesn't match, but we can check a handful of followi
ng lines to try |
1847 // to match back up. | 1856 // to match back up. |
1848 static int numLines = 8; // The # of lines we're willing to match against. | 1857 static int numLines = 8; // The # of lines we're willing to match against. |
1849 RootInlineBox* originalEndLine = layoutState.endLine(); | 1858 RootInlineBox* originalEndLine = layoutState.endLine(); |
1850 RootInlineBox* line = originalEndLine; | 1859 RootInlineBox* line = originalEndLine; |
1851 for (int i = 0; i < numLines && line; i++, line = line->nextRootBox()) { | 1860 for (int i = 0; i < numLines && line; i++, line = line->nextRootBox()) { |
1852 if (line->lineBreakObj() == resolver.position().object() && line->lineBr
eakPos() == resolver.position().offset()) { | 1861 if (line->lineBreakObj() == resolver.position().object() && line->lineBr
eakPos() == resolver.position().offset()) { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2033 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat
(); | 2042 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat
(); |
2034 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal
se) - logicalLeft; | 2043 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal
se) - logicalLeft; |
2035 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); | 2044 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); |
2036 | 2045 |
2037 if (!style()->isLeftToRightDirection()) | 2046 if (!style()->isLeftToRightDirection()) |
2038 return logicalWidth() - logicalLeft; | 2047 return logicalWidth() - logicalLeft; |
2039 return logicalLeft; | 2048 return logicalLeft; |
2040 } | 2049 } |
2041 | 2050 |
2042 } | 2051 } |
OLD | NEW |