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 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 bidiRuns.deleteRuns(); | 852 bidiRuns.deleteRuns(); |
853 resolver.markCurrentRunEmpty(); // FIXME: This can probably be repla
ced by an ASSERT (or just removed). | 853 resolver.markCurrentRunEmpty(); // FIXME: This can probably be repla
ced by an ASSERT (or just removed). |
854 | 854 |
855 if (lineBox) { | 855 if (lineBox) { |
856 lineBox->setLineBreakInfo(endOfLine.object(), endOfLine.offset()
, resolver.status()); | 856 lineBox->setLineBreakInfo(endOfLine.object(), endOfLine.offset()
, resolver.status()); |
857 if (layoutState.usesPaintInvalidationBounds()) | 857 if (layoutState.usesPaintInvalidationBounds()) |
858 layoutState.updatePaintInvalidationRangeFromBox(lineBox); | 858 layoutState.updatePaintInvalidationRangeFromBox(lineBox); |
859 | 859 |
860 if (paginated) { | 860 if (paginated) { |
861 LayoutUnit adjustment = 0; | 861 LayoutUnit adjustment = 0; |
862 adjustLinePositionForPagination(*lineBox, adjustment, layout
State.flowThread()); | 862 adjustLinePositionForPagination(*lineBox, adjustment); |
863 if (adjustment) { | 863 if (adjustment) { |
864 LayoutUnit oldLineWidth = availableLogicalWidthForLine(o
ldLogicalHeight, layoutState.lineInfo().isFirstLine()); | 864 LayoutUnit oldLineWidth = availableLogicalWidthForLine(o
ldLogicalHeight, layoutState.lineInfo().isFirstLine()); |
865 lineBox->moveInBlockDirection(adjustment.toFloat()); | 865 lineBox->moveInBlockDirection(adjustment.toFloat()); |
866 if (layoutState.usesPaintInvalidationBounds()) | 866 if (layoutState.usesPaintInvalidationBounds()) |
867 layoutState.updatePaintInvalidationRangeFromBox(line
Box); | 867 layoutState.updatePaintInvalidationRangeFromBox(line
Box); |
868 | 868 |
869 if (availableLogicalWidthForLine(oldLogicalHeight + adju
stment, layoutState.lineInfo().isFirstLine()) != oldLineWidth) { | 869 if (availableLogicalWidthForLine(oldLogicalHeight + adju
stment, layoutState.lineInfo().isFirstLine()) != oldLineWidth) { |
870 // We have to delete this line, remove all floats th
at got added, and let line layout re-run. | 870 // We have to delete this line, remove all floats th
at got added, and let line layout re-run. |
871 lineBox->deleteLine(); | 871 lineBox->deleteLine(); |
872 endOfLine = restartLayoutRunsAndFloatsInRange(oldLog
icalHeight, oldLogicalHeight + adjustment, lastFloatFromPreviousLine, resolver,
previousEndofLine); | 872 endOfLine = restartLayoutRunsAndFloatsInRange(oldLog
icalHeight, oldLogicalHeight + adjustment, lastFloatFromPreviousLine, resolver,
previousEndofLine); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 { | 981 { |
982 if (layoutState.endLine()) { | 982 if (layoutState.endLine()) { |
983 if (layoutState.endLineMatched()) { | 983 if (layoutState.endLineMatched()) { |
984 bool paginated = view()->layoutState() && view()->layoutState()->isP
aginated(); | 984 bool paginated = view()->layoutState() && view()->layoutState()->isP
aginated(); |
985 // Attach all the remaining lines, and then adjust their y-positions
as needed. | 985 // Attach all the remaining lines, and then adjust their y-positions
as needed. |
986 LayoutUnit delta = logicalHeight() - layoutState.endLineLogicalTop()
; | 986 LayoutUnit delta = logicalHeight() - layoutState.endLineLogicalTop()
; |
987 for (RootInlineBox* line = layoutState.endLine(); line; line = line-
>nextRootBox()) { | 987 for (RootInlineBox* line = layoutState.endLine(); line; line = line-
>nextRootBox()) { |
988 line->attachLine(); | 988 line->attachLine(); |
989 if (paginated) { | 989 if (paginated) { |
990 delta -= line->paginationStrut(); | 990 delta -= line->paginationStrut(); |
991 adjustLinePositionForPagination(*line, delta, layoutState.fl
owThread()); | 991 adjustLinePositionForPagination(*line, delta); |
992 } | 992 } |
993 if (delta) { | 993 if (delta) { |
994 layoutState.updatePaintInvalidationRangeFromBox(line, delta)
; | 994 layoutState.updatePaintInvalidationRangeFromBox(line, delta)
; |
995 line->moveInBlockDirection(delta.toFloat()); | 995 line->moveInBlockDirection(delta.toFloat()); |
996 } | 996 } |
997 if (Vector<LayoutBox*>* cleanLineFloats = line->floatsPtr()) { | 997 if (Vector<LayoutBox*>* cleanLineFloats = line->floatsPtr()) { |
998 for (auto* box : *cleanLineFloats) { | 998 for (auto* box : *cleanLineFloats) { |
999 FloatingObject* floatingObject = insertFloatingObject(*b
ox); | 999 FloatingObject* floatingObject = insertFloatingObject(*b
ox); |
1000 ASSERT(!floatingObject->originatingLine()); | 1000 ASSERT(!floatingObject->originatingLine()); |
1001 floatingObject->setOriginatingLine(line); | 1001 floatingObject->setOriginatingLine(line); |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1642 // FIXME: This entire float-checking block needs to be broken into a new fun
ction. | 1642 // FIXME: This entire float-checking block needs to be broken into a new fun
ction. |
1643 bool dirtiedByFloat = false; | 1643 bool dirtiedByFloat = false; |
1644 if (!layoutState.isFullLayout()) { | 1644 if (!layoutState.isFullLayout()) { |
1645 // Paginate all of the clean lines. | 1645 // Paginate all of the clean lines. |
1646 bool paginated = view()->layoutState() && view()->layoutState()->isPagin
ated(); | 1646 bool paginated = view()->layoutState() && view()->layoutState()->isPagin
ated(); |
1647 LayoutUnit paginationDelta = 0; | 1647 LayoutUnit paginationDelta = 0; |
1648 size_t floatIndex = 0; | 1648 size_t floatIndex = 0; |
1649 for (curr = firstRootBox(); curr && !curr->isDirty(); curr = curr->nextR
ootBox()) { | 1649 for (curr = firstRootBox(); curr && !curr->isDirty(); curr = curr->nextR
ootBox()) { |
1650 if (paginated) { | 1650 if (paginated) { |
1651 paginationDelta -= curr->paginationStrut(); | 1651 paginationDelta -= curr->paginationStrut(); |
1652 adjustLinePositionForPagination(*curr, paginationDelta, layoutSt
ate.flowThread()); | 1652 adjustLinePositionForPagination(*curr, paginationDelta); |
1653 if (paginationDelta) { | 1653 if (paginationDelta) { |
1654 if (containsFloats() || !layoutState.floats().isEmpty()) { | 1654 if (containsFloats() || !layoutState.floats().isEmpty()) { |
1655 // FIXME: Do better eventually. For now if we ever shif
t because of pagination and floats are present just go to a full layout. | 1655 // FIXME: Do better eventually. For now if we ever shif
t because of pagination and floats are present just go to a full layout. |
1656 layoutState.markForFullLayout(); | 1656 layoutState.markForFullLayout(); |
1657 break; | 1657 break; |
1658 } | 1658 } |
1659 | 1659 |
1660 layoutState.updatePaintInvalidationRangeFromBox(curr, pagina
tionDelta); | 1660 layoutState.updatePaintInvalidationRangeFromBox(curr, pagina
tionDelta); |
1661 curr->moveInBlockDirection(paginationDelta.toFloat()); | 1661 curr->moveInBlockDirection(paginationDelta.toFloat()); |
1662 } | 1662 } |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1812 bool paginated = view()->layoutState() && view()->layoutState()->isPaginated
(); | 1812 bool paginated = view()->layoutState() && view()->layoutState()->isPaginated
(); |
1813 if (paginated && layoutState.flowThread()) { | 1813 if (paginated && layoutState.flowThread()) { |
1814 // Check all lines from here to the end, and see if the hypothetical new
position for the lines will result | 1814 // Check all lines from here to the end, and see if the hypothetical new
position for the lines will result |
1815 // in a different available line width. | 1815 // in a different available line width. |
1816 for (RootInlineBox* lineBox = layoutState.endLine(); lineBox; lineBox =
lineBox->nextRootBox()) { | 1816 for (RootInlineBox* lineBox = layoutState.endLine(); lineBox; lineBox =
lineBox->nextRootBox()) { |
1817 if (paginated) { | 1817 if (paginated) { |
1818 // This isn't the real move we're going to do, so don't update t
he line box's pagination | 1818 // This isn't the real move we're going to do, so don't update t
he line box's pagination |
1819 // strut yet. | 1819 // strut yet. |
1820 LayoutUnit oldPaginationStrut = lineBox->paginationStrut(); | 1820 LayoutUnit oldPaginationStrut = lineBox->paginationStrut(); |
1821 lineDelta -= oldPaginationStrut; | 1821 lineDelta -= oldPaginationStrut; |
1822 adjustLinePositionForPagination(*lineBox, lineDelta, layoutState
.flowThread()); | 1822 adjustLinePositionForPagination(*lineBox, lineDelta); |
1823 lineBox->setPaginationStrut(oldPaginationStrut); | 1823 lineBox->setPaginationStrut(oldPaginationStrut); |
1824 } | 1824 } |
1825 } | 1825 } |
1826 } | 1826 } |
1827 | 1827 |
1828 if (!lineDelta || !m_floatingObjects) | 1828 if (!lineDelta || !m_floatingObjects) |
1829 return true; | 1829 return true; |
1830 | 1830 |
1831 // See if any floats end in the range along which we want to shift the lines
vertically. | 1831 // See if any floats end in the range along which we want to shift the lines
vertically. |
1832 LayoutUnit logicalTop = std::min(logicalHeight(), layoutState.endLineLogical
Top()); | 1832 LayoutUnit logicalTop = std::min(logicalHeight(), layoutState.endLineLogical
Top()); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2069 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); | 2069 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); |
2070 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight()
, false) - logicalLeft; | 2070 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight()
, false) - logicalLeft; |
2071 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); | 2071 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); |
2072 | 2072 |
2073 if (!style()->isLeftToRightDirection()) | 2073 if (!style()->isLeftToRightDirection()) |
2074 return logicalWidth() - logicalLeft; | 2074 return logicalWidth() - logicalLeft; |
2075 return logicalLeft; | 2075 return logicalLeft; |
2076 } | 2076 } |
2077 | 2077 |
2078 } | 2078 } |
OLD | NEW |