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 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 | 1289 |
1290 if (availableLogicalWidthForLine(oldLogicalHeight + adju
stment, layoutState.lineInfo().isFirstLine()) != oldLineWidth) { | 1290 if (availableLogicalWidthForLine(oldLogicalHeight + adju
stment, layoutState.lineInfo().isFirstLine()) != oldLineWidth) { |
1291 // We have to delete this line, remove all floats th
at got added, and let line layout re-run. | 1291 // We have to delete this line, remove all floats th
at got added, and let line layout re-run. |
1292 lineBox->deleteLine(); | 1292 lineBox->deleteLine(); |
1293 endOfLine = restartLayoutRunsAndFloatsInRange(oldLog
icalHeight, oldLogicalHeight + adjustment, lastFloatFromPreviousLine, resolver,
previousEndofLine); | 1293 endOfLine = restartLayoutRunsAndFloatsInRange(oldLog
icalHeight, oldLogicalHeight + adjustment, lastFloatFromPreviousLine, resolver,
previousEndofLine); |
1294 continue; | 1294 continue; |
1295 } | 1295 } |
1296 | 1296 |
1297 setLogicalHeight(lineBox->lineBottomWithLeading()); | 1297 setLogicalHeight(lineBox->lineBottomWithLeading()); |
1298 } | 1298 } |
1299 | |
1300 if (layoutState.flowThread()) | |
1301 updateRegionForLine(lineBox); | |
1302 } | 1299 } |
1303 } | 1300 } |
1304 } | 1301 } |
1305 | 1302 |
1306 for (size_t i = 0; i < lineBreaker.positionedObjects().size(); ++i) | 1303 for (size_t i = 0; i < lineBreaker.positionedObjects().size(); ++i) |
1307 setStaticPositions(this, lineBreaker.positionedObjects()[i]); | 1304 setStaticPositions(this, lineBreaker.positionedObjects()[i]); |
1308 | 1305 |
1309 if (!layoutState.lineInfo().isEmpty()) { | 1306 if (!layoutState.lineInfo().isEmpty()) { |
1310 layoutState.lineInfo().setFirstLine(false); | 1307 layoutState.lineInfo().setFirstLine(false); |
1311 clearFloats(lineBreaker.clear()); | 1308 clearFloats(lineBreaker.clear()); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1410 for (RootInlineBox* line = layoutState.endLine(); line; line = line-
>nextRootBox()) { | 1407 for (RootInlineBox* line = layoutState.endLine(); line; line = line-
>nextRootBox()) { |
1411 line->attachLine(); | 1408 line->attachLine(); |
1412 if (paginated) { | 1409 if (paginated) { |
1413 delta -= line->paginationStrut(); | 1410 delta -= line->paginationStrut(); |
1414 adjustLinePositionForPagination(line, delta, layoutState.flo
wThread()); | 1411 adjustLinePositionForPagination(line, delta, layoutState.flo
wThread()); |
1415 } | 1412 } |
1416 if (delta) { | 1413 if (delta) { |
1417 layoutState.updateRepaintRangeFromBox(line, delta); | 1414 layoutState.updateRepaintRangeFromBox(line, delta); |
1418 line->adjustBlockDirectionPosition(delta); | 1415 line->adjustBlockDirectionPosition(delta); |
1419 } | 1416 } |
1420 if (layoutState.flowThread()) | |
1421 updateRegionForLine(line); | |
1422 if (Vector<RenderBox*>* cleanLineFloats = line->floatsPtr()) { | 1417 if (Vector<RenderBox*>* cleanLineFloats = line->floatsPtr()) { |
1423 Vector<RenderBox*>::iterator end = cleanLineFloats->end(); | 1418 Vector<RenderBox*>::iterator end = cleanLineFloats->end(); |
1424 for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin
(); f != end; ++f) { | 1419 for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin
(); f != end; ++f) { |
1425 FloatingObject* floatingObject = insertFloatingObject(*f
); | 1420 FloatingObject* floatingObject = insertFloatingObject(*f
); |
1426 ASSERT(!floatingObject->originatingLine()); | 1421 ASSERT(!floatingObject->originatingLine()); |
1427 floatingObject->setOriginatingLine(line); | 1422 floatingObject->setOriginatingLine(line); |
1428 setLogicalHeight(logicalTopForChild(*f) - marginBeforeFo
rChild(*f) + delta); | 1423 setLogicalHeight(logicalTopForChild(*f) - marginBeforeFo
rChild(*f) + delta); |
1429 positionNewFloats(); | 1424 positionNewFloats(); |
1430 } | 1425 } |
1431 } | 1426 } |
(...skipping 13 matching lines...) Expand all Loading... |
1445 LayoutUnit bottomVisualOverflow = lastRootBox()->logicalBottomVisual
Overflow(); | 1440 LayoutUnit bottomVisualOverflow = lastRootBox()->logicalBottomVisual
Overflow(); |
1446 LayoutUnit bottomLayoutOverflow = lastRootBox()->logicalBottomLayout
Overflow(); | 1441 LayoutUnit bottomLayoutOverflow = lastRootBox()->logicalBottomLayout
Overflow(); |
1447 TrailingFloatsRootInlineBox* trailingFloatsLineBox = new TrailingFlo
atsRootInlineBox(this); | 1442 TrailingFloatsRootInlineBox* trailingFloatsLineBox = new TrailingFlo
atsRootInlineBox(this); |
1448 m_lineBoxes.appendLineBox(trailingFloatsLineBox); | 1443 m_lineBoxes.appendLineBox(trailingFloatsLineBox); |
1449 trailingFloatsLineBox->setConstructed(); | 1444 trailingFloatsLineBox->setConstructed(); |
1450 GlyphOverflowAndFallbackFontsMap textBoxDataMap; | 1445 GlyphOverflowAndFallbackFontsMap textBoxDataMap; |
1451 VerticalPositionCache verticalPositionCache; | 1446 VerticalPositionCache verticalPositionCache; |
1452 LayoutUnit blockLogicalHeight = logicalHeight(); | 1447 LayoutUnit blockLogicalHeight = logicalHeight(); |
1453 trailingFloatsLineBox->alignBoxesInBlockDirection(blockLogicalHeight
, textBoxDataMap, verticalPositionCache); | 1448 trailingFloatsLineBox->alignBoxesInBlockDirection(blockLogicalHeight
, textBoxDataMap, verticalPositionCache); |
1454 trailingFloatsLineBox->setLineTopBottomPositions(blockLogicalHeight,
blockLogicalHeight, blockLogicalHeight, blockLogicalHeight); | 1449 trailingFloatsLineBox->setLineTopBottomPositions(blockLogicalHeight,
blockLogicalHeight, blockLogicalHeight, blockLogicalHeight); |
1455 trailingFloatsLineBox->setPaginatedLineWidth(availableLogicalWidthFo
rContent(blockLogicalHeight)); | 1450 trailingFloatsLineBox->setPaginatedLineWidth(availableLogicalWidthFo
rContent()); |
1456 LayoutRect logicalLayoutOverflow(0, blockLogicalHeight, 1, bottomLay
outOverflow - blockLogicalHeight); | 1451 LayoutRect logicalLayoutOverflow(0, blockLogicalHeight, 1, bottomLay
outOverflow - blockLogicalHeight); |
1457 LayoutRect logicalVisualOverflow(0, blockLogicalHeight, 1, bottomVis
ualOverflow - blockLogicalHeight); | 1452 LayoutRect logicalVisualOverflow(0, blockLogicalHeight, 1, bottomVis
ualOverflow - blockLogicalHeight); |
1458 trailingFloatsLineBox->setOverflowFromLogicalRects(logicalLayoutOver
flow, logicalVisualOverflow, trailingFloatsLineBox->lineTop(), trailingFloatsLin
eBox->lineBottom()); | 1453 trailingFloatsLineBox->setOverflowFromLogicalRects(logicalLayoutOver
flow, logicalVisualOverflow, trailingFloatsLineBox->lineTop(), trailingFloatsLin
eBox->lineBottom()); |
1459 if (layoutState.flowThread()) | |
1460 updateRegionForLine(trailingFloatsLineBox); | |
1461 } | 1454 } |
1462 | 1455 |
1463 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 1456 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
1464 FloatingObjectSetIterator it = floatingObjectSet.begin(); | 1457 FloatingObjectSetIterator it = floatingObjectSet.begin(); |
1465 FloatingObjectSetIterator end = floatingObjectSet.end(); | 1458 FloatingObjectSetIterator end = floatingObjectSet.end(); |
1466 if (layoutState.lastFloat()) { | 1459 if (layoutState.lastFloat()) { |
1467 FloatingObjectSetIterator lastFloatIterator = floatingObjectSet.find
(layoutState.lastFloat()); | 1460 FloatingObjectSetIterator lastFloatIterator = floatingObjectSet.find
(layoutState.lastFloat()); |
1468 ASSERT(lastFloatIterator != end); | 1461 ASSERT(lastFloatIterator != end); |
1469 ++lastFloatIterator; | 1462 ++lastFloatIterator; |
1470 it = lastFloatIterator; | 1463 it = lastFloatIterator; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 | 1622 |
1630 // FIXME: This entire float-checking block needs to be broken into a new fun
ction. | 1623 // FIXME: This entire float-checking block needs to be broken into a new fun
ction. |
1631 bool dirtiedByFloat = false; | 1624 bool dirtiedByFloat = false; |
1632 if (!layoutState.isFullLayout()) { | 1625 if (!layoutState.isFullLayout()) { |
1633 // Paginate all of the clean lines. | 1626 // Paginate all of the clean lines. |
1634 bool paginated = view()->layoutState() && view()->layoutState()->isPagin
ated(); | 1627 bool paginated = view()->layoutState() && view()->layoutState()->isPagin
ated(); |
1635 LayoutUnit paginationDelta = 0; | 1628 LayoutUnit paginationDelta = 0; |
1636 size_t floatIndex = 0; | 1629 size_t floatIndex = 0; |
1637 for (curr = firstRootBox(); curr && !curr->isDirty(); curr = curr->nextR
ootBox()) { | 1630 for (curr = firstRootBox(); curr && !curr->isDirty(); curr = curr->nextR
ootBox()) { |
1638 if (paginated) { | 1631 if (paginated) { |
1639 if (lineWidthForPaginatedLineChanged(curr, 0, layoutState.flowTh
read())) { | |
1640 curr->markDirty(); | |
1641 break; | |
1642 } | |
1643 paginationDelta -= curr->paginationStrut(); | 1632 paginationDelta -= curr->paginationStrut(); |
1644 adjustLinePositionForPagination(curr, paginationDelta, layoutSta
te.flowThread()); | 1633 adjustLinePositionForPagination(curr, paginationDelta, layoutSta
te.flowThread()); |
1645 if (paginationDelta) { | 1634 if (paginationDelta) { |
1646 if (containsFloats() || !layoutState.floats().isEmpty()) { | 1635 if (containsFloats() || !layoutState.floats().isEmpty()) { |
1647 // FIXME: Do better eventually. For now if we ever shif
t because of pagination and floats are present just go to a full layout. | 1636 // FIXME: Do better eventually. For now if we ever shif
t because of pagination and floats are present just go to a full layout. |
1648 layoutState.markForFullLayout(); | 1637 layoutState.markForFullLayout(); |
1649 break; | 1638 break; |
1650 } | 1639 } |
1651 | 1640 |
1652 layoutState.updateRepaintRangeFromBox(curr, paginationDelta)
; | 1641 layoutState.updateRepaintRangeFromBox(curr, paginationDelta)
; |
1653 curr->adjustBlockDirectionPosition(paginationDelta); | 1642 curr->adjustBlockDirectionPosition(paginationDelta); |
1654 } | 1643 } |
1655 if (layoutState.flowThread()) | |
1656 updateRegionForLine(curr); | |
1657 } | 1644 } |
1658 | 1645 |
1659 // If a new float has been inserted before this line or before its l
ast known float, just do a full layout. | 1646 // If a new float has been inserted before this line or before its l
ast known float, just do a full layout. |
1660 bool encounteredNewFloat = false; | 1647 bool encounteredNewFloat = false; |
1661 checkFloatsInCleanLine(curr, layoutState.floats(), floatIndex, encou
nteredNewFloat, dirtiedByFloat); | 1648 checkFloatsInCleanLine(curr, layoutState.floats(), floatIndex, encou
nteredNewFloat, dirtiedByFloat); |
1662 if (encounteredNewFloat) | 1649 if (encounteredNewFloat) |
1663 layoutState.markForFullLayout(); | 1650 layoutState.markForFullLayout(); |
1664 | 1651 |
1665 if (dirtiedByFloat || layoutState.isFullLayout()) | 1652 if (dirtiedByFloat || layoutState.isFullLayout()) |
1666 break; | 1653 break; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1799 // in a different available line width. | 1786 // in a different available line width. |
1800 for (RootInlineBox* lineBox = layoutState.endLine(); lineBox; lineBox =
lineBox->nextRootBox()) { | 1787 for (RootInlineBox* lineBox = layoutState.endLine(); lineBox; lineBox =
lineBox->nextRootBox()) { |
1801 if (paginated) { | 1788 if (paginated) { |
1802 // This isn't the real move we're going to do, so don't update t
he line box's pagination | 1789 // This isn't the real move we're going to do, so don't update t
he line box's pagination |
1803 // strut yet. | 1790 // strut yet. |
1804 LayoutUnit oldPaginationStrut = lineBox->paginationStrut(); | 1791 LayoutUnit oldPaginationStrut = lineBox->paginationStrut(); |
1805 lineDelta -= oldPaginationStrut; | 1792 lineDelta -= oldPaginationStrut; |
1806 adjustLinePositionForPagination(lineBox, lineDelta, layoutState.
flowThread()); | 1793 adjustLinePositionForPagination(lineBox, lineDelta, layoutState.
flowThread()); |
1807 lineBox->setPaginationStrut(oldPaginationStrut); | 1794 lineBox->setPaginationStrut(oldPaginationStrut); |
1808 } | 1795 } |
1809 if (lineWidthForPaginatedLineChanged(lineBox, lineDelta, layoutState
.flowThread())) | |
1810 return false; | |
1811 } | 1796 } |
1812 } | 1797 } |
1813 | 1798 |
1814 if (!lineDelta || !m_floatingObjects) | 1799 if (!lineDelta || !m_floatingObjects) |
1815 return true; | 1800 return true; |
1816 | 1801 |
1817 // See if any floats end in the range along which we want to shift the lines
vertically. | 1802 // See if any floats end in the range along which we want to shift the lines
vertically. |
1818 LayoutUnit logicalTop = min(logicalHeight(), layoutState.endLineLogicalTop()
); | 1803 LayoutUnit logicalTop = min(logicalHeight(), layoutState.endLineLogicalTop()
); |
1819 | 1804 |
1820 RootInlineBox* lastLine = layoutState.endLine(); | 1805 RootInlineBox* lastLine = layoutState.endLine(); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2037 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); | 2022 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); |
2038 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal
se) - logicalLeft; | 2023 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal
se) - logicalLeft; |
2039 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); | 2024 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); |
2040 | 2025 |
2041 if (!style()->isLeftToRightDirection()) | 2026 if (!style()->isLeftToRightDirection()) |
2042 return logicalWidth() - logicalLeft; | 2027 return logicalWidth() - logicalLeft; |
2043 return logicalLeft; | 2028 return logicalLeft; |
2044 } | 2029 } |
2045 | 2030 |
2046 } | 2031 } |
OLD | NEW |