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