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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 | 1626 |
1634 // FIXME: This entire float-checking block needs to be broken into a new fun
ction. | 1627 // FIXME: This entire float-checking block needs to be broken into a new fun
ction. |
1635 bool dirtiedByFloat = false; | 1628 bool dirtiedByFloat = false; |
1636 if (!layoutState.isFullLayout()) { | 1629 if (!layoutState.isFullLayout()) { |
1637 // Paginate all of the clean lines. | 1630 // Paginate all of the clean lines. |
1638 bool paginated = view()->layoutState() && view()->layoutState()->isPagin
ated(); | 1631 bool paginated = view()->layoutState() && view()->layoutState()->isPagin
ated(); |
1639 LayoutUnit paginationDelta = 0; | 1632 LayoutUnit paginationDelta = 0; |
1640 size_t floatIndex = 0; | 1633 size_t floatIndex = 0; |
1641 for (curr = firstRootBox(); curr && !curr->isDirty(); curr = curr->nextR
ootBox()) { | 1634 for (curr = firstRootBox(); curr && !curr->isDirty(); curr = curr->nextR
ootBox()) { |
1642 if (paginated) { | 1635 if (paginated) { |
1643 if (lineWidthForPaginatedLineChanged(curr, 0, layoutState.flowTh
read())) { | |
1644 curr->markDirty(); | |
1645 break; | |
1646 } | |
1647 paginationDelta -= curr->paginationStrut(); | 1636 paginationDelta -= curr->paginationStrut(); |
1648 adjustLinePositionForPagination(curr, paginationDelta, layoutSta
te.flowThread()); | 1637 adjustLinePositionForPagination(curr, paginationDelta, layoutSta
te.flowThread()); |
1649 if (paginationDelta) { | 1638 if (paginationDelta) { |
1650 if (containsFloats() || !layoutState.floats().isEmpty()) { | 1639 if (containsFloats() || !layoutState.floats().isEmpty()) { |
1651 // FIXME: Do better eventually. For now if we ever shif
t because of pagination and floats are present just go to a full layout. | 1640 // FIXME: Do better eventually. For now if we ever shif
t because of pagination and floats are present just go to a full layout. |
1652 layoutState.markForFullLayout(); | 1641 layoutState.markForFullLayout(); |
1653 break; | 1642 break; |
1654 } | 1643 } |
1655 | 1644 |
1656 layoutState.updateRepaintRangeFromBox(curr, paginationDelta)
; | 1645 layoutState.updateRepaintRangeFromBox(curr, paginationDelta)
; |
1657 curr->adjustBlockDirectionPosition(paginationDelta); | 1646 curr->adjustBlockDirectionPosition(paginationDelta); |
1658 } | 1647 } |
1659 if (layoutState.flowThread()) | |
1660 updateRegionForLine(curr); | |
1661 } | 1648 } |
1662 | 1649 |
1663 // If a new float has been inserted before this line or before its l
ast known float, just do a full layout. | 1650 // If a new float has been inserted before this line or before its l
ast known float, just do a full layout. |
1664 bool encounteredNewFloat = false; | 1651 bool encounteredNewFloat = false; |
1665 checkFloatsInCleanLine(curr, layoutState.floats(), floatIndex, encou
nteredNewFloat, dirtiedByFloat); | 1652 checkFloatsInCleanLine(curr, layoutState.floats(), floatIndex, encou
nteredNewFloat, dirtiedByFloat); |
1666 if (encounteredNewFloat) | 1653 if (encounteredNewFloat) |
1667 layoutState.markForFullLayout(); | 1654 layoutState.markForFullLayout(); |
1668 | 1655 |
1669 if (dirtiedByFloat || layoutState.isFullLayout()) | 1656 if (dirtiedByFloat || layoutState.isFullLayout()) |
1670 break; | 1657 break; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1803 // in a different available line width. | 1790 // in a different available line width. |
1804 for (RootInlineBox* lineBox = layoutState.endLine(); lineBox; lineBox =
lineBox->nextRootBox()) { | 1791 for (RootInlineBox* lineBox = layoutState.endLine(); lineBox; lineBox =
lineBox->nextRootBox()) { |
1805 if (paginated) { | 1792 if (paginated) { |
1806 // This isn't the real move we're going to do, so don't update t
he line box's pagination | 1793 // This isn't the real move we're going to do, so don't update t
he line box's pagination |
1807 // strut yet. | 1794 // strut yet. |
1808 LayoutUnit oldPaginationStrut = lineBox->paginationStrut(); | 1795 LayoutUnit oldPaginationStrut = lineBox->paginationStrut(); |
1809 lineDelta -= oldPaginationStrut; | 1796 lineDelta -= oldPaginationStrut; |
1810 adjustLinePositionForPagination(lineBox, lineDelta, layoutState.
flowThread()); | 1797 adjustLinePositionForPagination(lineBox, lineDelta, layoutState.
flowThread()); |
1811 lineBox->setPaginationStrut(oldPaginationStrut); | 1798 lineBox->setPaginationStrut(oldPaginationStrut); |
1812 } | 1799 } |
1813 if (lineWidthForPaginatedLineChanged(lineBox, lineDelta, layoutState
.flowThread())) | |
1814 return false; | |
1815 } | 1800 } |
1816 } | 1801 } |
1817 | 1802 |
1818 if (!lineDelta || !m_floatingObjects) | 1803 if (!lineDelta || !m_floatingObjects) |
1819 return true; | 1804 return true; |
1820 | 1805 |
1821 // See if any floats end in the range along which we want to shift the lines
vertically. | 1806 // See if any floats end in the range along which we want to shift the lines
vertically. |
1822 LayoutUnit logicalTop = min(logicalHeight(), layoutState.endLineLogicalTop()
); | 1807 LayoutUnit logicalTop = min(logicalHeight(), layoutState.endLineLogicalTop()
); |
1823 | 1808 |
1824 RootInlineBox* lastLine = layoutState.endLine(); | 1809 RootInlineBox* lastLine = layoutState.endLine(); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2063 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); | 2048 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); |
2064 | 2049 |
2065 setLineGridBox(lineGridBox); | 2050 setLineGridBox(lineGridBox); |
2066 | 2051 |
2067 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying | 2052 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying |
2068 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping | 2053 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping |
2069 // to this grid. | 2054 // to this grid. |
2070 } | 2055 } |
2071 | 2056 |
2072 } | 2057 } |
OLD | NEW |