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 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 // Count from the end of the block backwards, to see how many hanging | 1663 // Count from the end of the block backwards, to see how many hanging |
1664 // lines we have. | 1664 // lines we have. |
1665 RootInlineBox* firstLineInBlock = firstRootBox(); | 1665 RootInlineBox* firstLineInBlock = firstRootBox(); |
1666 int numLinesHanging = 1; | 1666 int numLinesHanging = 1; |
1667 while (lineBox && lineBox != firstLineInBlock && !lineBox->isFirstAfterP
ageBreak()) { | 1667 while (lineBox && lineBox != firstLineInBlock && !lineBox->isFirstAfterP
ageBreak()) { |
1668 ++numLinesHanging; | 1668 ++numLinesHanging; |
1669 lineBox = lineBox->prevRootBox(); | 1669 lineBox = lineBox->prevRootBox(); |
1670 } | 1670 } |
1671 | 1671 |
1672 // If there were no breaks in the block, we didn't create any widows. | 1672 // If there were no breaks in the block, we didn't create any widows. |
1673 if (!lineBox->isFirstAfterPageBreak() || lineBox == firstLineInBlock) | 1673 if (!lineBox || !lineBox->isFirstAfterPageBreak() || lineBox == firstLin
eInBlock) |
1674 return; | 1674 return; |
1675 | 1675 |
1676 if (numLinesHanging < style()->widows()) { | 1676 if (numLinesHanging < style()->widows()) { |
1677 // We have detected a widow. Now we need to work out how many | 1677 // We have detected a widow. Now we need to work out how many |
1678 // lines there are on the previous page, and how many we need | 1678 // lines there are on the previous page, and how many we need |
1679 // to steal. | 1679 // to steal. |
1680 int numLinesNeeded = style()->widows() - numLinesHanging; | 1680 int numLinesNeeded = style()->widows() - numLinesHanging; |
1681 RootInlineBox* currentFirstLineOfNewPage = lineBox; | 1681 RootInlineBox* currentFirstLineOfNewPage = lineBox; |
1682 | 1682 |
1683 // Count the number of lines in the previous page. | 1683 // Count the number of lines in the previous page. |
(...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3308 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); | 3308 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); |
3309 | 3309 |
3310 setLineGridBox(lineGridBox); | 3310 setLineGridBox(lineGridBox); |
3311 | 3311 |
3312 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying | 3312 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying |
3313 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping | 3313 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping |
3314 // to this grid. | 3314 // to this grid. |
3315 } | 3315 } |
3316 | 3316 |
3317 } | 3317 } |
OLD | NEW |