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 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1614 setShouldDoFullPaintInvalidation(); | 1614 setShouldDoFullPaintInvalidation(); |
1615 } | 1615 } |
1616 | 1616 |
1617 RootInlineBox* LayoutBlockFlow::determineStartPosition(LineLayoutState& layoutSt
ate, InlineBidiResolver& resolver) | 1617 RootInlineBox* LayoutBlockFlow::determineStartPosition(LineLayoutState& layoutSt
ate, InlineBidiResolver& resolver) |
1618 { | 1618 { |
1619 RootInlineBox* curr = nullptr; | 1619 RootInlineBox* curr = nullptr; |
1620 RootInlineBox* last = nullptr; | 1620 RootInlineBox* last = nullptr; |
1621 RootInlineBox* firstLineBoxWithBreakAndClearance = 0; | 1621 RootInlineBox* firstLineBoxWithBreakAndClearance = 0; |
1622 | 1622 |
1623 // 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. |
1624 bool dirtiedByFloat = false; | |
1625 if (!layoutState.isFullLayout()) { | 1624 if (!layoutState.isFullLayout()) { |
1626 // Paginate all of the clean lines. | 1625 // Paginate all of the clean lines. |
1627 bool paginated = view()->layoutState() && view()->layoutState()->isPagin
ated(); | 1626 bool paginated = view()->layoutState() && view()->layoutState()->isPagin
ated(); |
1628 LayoutUnit paginationDelta = 0; | 1627 LayoutUnit paginationDelta = 0; |
1629 for (curr = firstRootBox(); curr && !curr->isDirty(); curr = curr->nextR
ootBox()) { | 1628 for (curr = firstRootBox(); curr && !curr->isDirty(); curr = curr->nextR
ootBox()) { |
1630 if (paginated) { | 1629 if (paginated) { |
1631 paginationDelta -= curr->paginationStrut(); | 1630 paginationDelta -= curr->paginationStrut(); |
1632 adjustLinePositionForPagination(*curr, paginationDelta); | 1631 adjustLinePositionForPagination(*curr, paginationDelta); |
1633 if (paginationDelta) { | 1632 if (paginationDelta) { |
1634 if (containsFloats() || !layoutState.floats().isEmpty()) { | 1633 if (containsFloats() || !layoutState.floats().isEmpty()) { |
1635 // FIXME: Do better eventually. For now if we ever shif
t because of pagination and floats are present just go to a full layout. | 1634 // 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 layoutState.markForFullLayout(); | 1635 layoutState.markForFullLayout(); |
1637 break; | 1636 break; |
1638 } | 1637 } |
1639 | 1638 |
1640 layoutState.updatePaintInvalidationRangeFromBox(curr, pagina
tionDelta); | 1639 layoutState.updatePaintInvalidationRangeFromBox(curr, pagina
tionDelta); |
1641 curr->moveInBlockDirection(paginationDelta); | 1640 curr->moveInBlockDirection(paginationDelta); |
1642 } | 1641 } |
1643 } | 1642 } |
1644 | 1643 |
1645 // If the linebox breaks cleanly and with clearance then dirty from
at least this point onwards so that we can clear the correct floats without diff
iculty. | 1644 // If the linebox breaks cleanly and with clearance then dirty from
at least this point onwards so that we can clear the correct floats without diff
iculty. |
1646 if (!firstLineBoxWithBreakAndClearance && lineBoxHasBRWithClearance(
curr)) | 1645 if (!firstLineBoxWithBreakAndClearance && lineBoxHasBRWithClearance(
curr)) |
1647 firstLineBoxWithBreakAndClearance = curr; | 1646 firstLineBoxWithBreakAndClearance = curr; |
1648 | 1647 |
1649 if (dirtiedByFloat || layoutState.isFullLayout()) | 1648 if (layoutState.isFullLayout()) |
1650 break; | 1649 break; |
1651 } | 1650 } |
1652 } | 1651 } |
1653 | 1652 |
1654 if (layoutState.isFullLayout()) { | 1653 if (layoutState.isFullLayout()) { |
1655 // If we encountered a new float and have inline children, mark ourself
to force us to issue paint invalidations. | 1654 // If we encountered a new float and have inline children, mark ourself
to force us to issue paint invalidations. |
1656 if (layoutState.hasInlineChild() && !selfNeedsLayout()) { | 1655 if (layoutState.hasInlineChild() && !selfNeedsLayout()) { |
1657 setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::Flo
atDescendantChanged, MarkOnlyThis); | 1656 setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::Flo
atDescendantChanged, MarkOnlyThis); |
1658 setShouldDoFullPaintInvalidation(); | 1657 setShouldDoFullPaintInvalidation(); |
1659 } | 1658 } |
1660 | 1659 |
1661 deleteLineBoxTree(); | 1660 deleteLineBoxTree(); |
1662 curr = nullptr; | 1661 curr = nullptr; |
1663 ASSERT(!firstLineBox() && !lastLineBox()); | 1662 ASSERT(!firstLineBox() && !lastLineBox()); |
1664 } else { | 1663 } else { |
1665 if (firstLineBoxWithBreakAndClearance) | 1664 if (firstLineBoxWithBreakAndClearance) |
1666 curr = firstLineBoxWithBreakAndClearance; | 1665 curr = firstLineBoxWithBreakAndClearance; |
1667 if (curr) { | 1666 if (curr) { |
1668 // We have a dirty line. | 1667 // We have a dirty line. |
1669 if (RootInlineBox* prevRootBox = curr->prevRootBox()) { | 1668 if (RootInlineBox* prevRootBox = curr->prevRootBox()) { |
1670 // We have a previous line. | 1669 // We have a previous line. |
1671 if (!dirtiedByFloat && (!prevRootBox->endsWithBreak() || !prevRo
otBox->lineBreakObj() || (prevRootBox->lineBreakObj()->isText() && prevRootBox->
lineBreakPos() >= toLayoutText(prevRootBox->lineBreakObj())->textLength()))) { | 1670 if (!prevRootBox->endsWithBreak() || !prevRootBox->lineBreakObj(
) || (prevRootBox->lineBreakObj()->isText() && prevRootBox->lineBreakPos() >= to
LayoutText(prevRootBox->lineBreakObj())->textLength())) { |
1672 // The previous line didn't break cleanly or broke at a newl
ine | 1671 // The previous line didn't break cleanly or broke at a newl
ine |
1673 // that has been deleted, so treat it as dirty too. | 1672 // that has been deleted, so treat it as dirty too. |
1674 curr = prevRootBox; | 1673 curr = prevRootBox; |
1675 } | 1674 } |
1676 } | 1675 } |
1677 } else { | 1676 } else { |
1678 // No dirty lines were found. | 1677 // No dirty lines were found. |
1679 // If the last line didn't break cleanly, treat it as dirty. | 1678 // If the last line didn't break cleanly, treat it as dirty. |
1680 if (lastRootBox() && !lastRootBox()->endsWithBreak()) | 1679 if (lastRootBox() && !lastRootBox()->endsWithBreak()) |
1681 curr = lastRootBox(); | 1680 curr = lastRootBox(); |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2033 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); | 2032 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); |
2034 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight()
, false) - logicalLeft; | 2033 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight()
, false) - logicalLeft; |
2035 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); | 2034 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); |
2036 | 2035 |
2037 if (!style()->isLeftToRightDirection()) | 2036 if (!style()->isLeftToRightDirection()) |
2038 return logicalWidth() - logicalLeft; | 2037 return logicalWidth() - logicalLeft; |
2039 return logicalLeft; | 2038 return logicalLeft; |
2040 } | 2039 } |
2041 | 2040 |
2042 } | 2041 } |
OLD | NEW |