| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 if (!m_needsColumnHeightsRecalculation) | 269 if (!m_needsColumnHeightsRecalculation) |
| 270 return false; | 270 return false; |
| 271 | 271 |
| 272 // Column heights may change here because of balancing. We may have to do mu
ltiple layout | 272 // Column heights may change here because of balancing. We may have to do mu
ltiple layout |
| 273 // passes, depending on how the contents is fitted to the changed column hei
ghts. In most | 273 // passes, depending on how the contents is fitted to the changed column hei
ghts. In most |
| 274 // cases, laying out again twice or even just once will suffice. Sometimes w
e need more | 274 // cases, laying out again twice or even just once will suffice. Sometimes w
e need more |
| 275 // passes than that, though, but the number of retries should not exceed the
number of | 275 // passes than that, though, but the number of retries should not exceed the
number of |
| 276 // columns, unless we have a bug. | 276 // columns, unless we have a bug. |
| 277 bool needsRelayout = false; | 277 bool needsRelayout = false; |
| 278 for (RenderMultiColumnSet* multicolSet = firstMultiColumnSet(); multicolSet;
multicolSet = multicolSet->nextSiblingMultiColumnSet()) { | 278 for (RenderMultiColumnSet* multicolSet = firstMultiColumnSet(); multicolSet;
multicolSet = multicolSet->nextSiblingMultiColumnSet()) { |
| 279 needsRelayout |= multicolSet->recalculateColumnHeight(m_inBalancingPass
? RenderMultiColumnSet::StretchBySpaceShortage : RenderMultiColumnSet::GuessFrom
FlowThreadPortion); | 279 needsRelayout |= multicolSet->recalculateColumnHeight(m_inBalancingPass
? StretchBySpaceShortage : GuessFromFlowThreadPortion); |
| 280 if (needsRelayout) { | 280 if (needsRelayout) { |
| 281 // Once a column set gets a new column height, that column set and a
ll successive column | 281 // Once a column set gets a new column height, that column set and a
ll successive column |
| 282 // sets need to be laid out over again, since their logical top will
be affected by | 282 // sets need to be laid out over again, since their logical top will
be affected by |
| 283 // this, and therefore their column heights may change as well, at l
east if the multicol | 283 // this, and therefore their column heights may change as well, at l
east if the multicol |
| 284 // height is constrained. | 284 // height is constrained. |
| 285 multicolSet->setChildNeedsLayout(MarkOnlyThis); | 285 multicolSet->setChildNeedsLayout(MarkOnlyThis); |
| 286 } | 286 } |
| 287 } | 287 } |
| 288 | 288 |
| 289 if (needsRelayout) | 289 if (needsRelayout) |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 void RenderMultiColumnFlowThread::setPageBreak(LayoutUnit offset, LayoutUnit spa
ceShortage) | 640 void RenderMultiColumnFlowThread::setPageBreak(LayoutUnit offset, LayoutUnit spa
ceShortage) |
| 641 { | 641 { |
| 642 // Only positive values are interesting (and allowed) here. Zero space short
age may be reported | 642 // Only positive values are interesting (and allowed) here. Zero space short
age may be reported |
| 643 // when we're at the top of a column and the element has zero height. Ignore
this, and also | 643 // when we're at the top of a column and the element has zero height. Ignore
this, and also |
| 644 // ignore any negative values, which may occur when we set an early break in
order to honor | 644 // ignore any negative values, which may occur when we set an early break in
order to honor |
| 645 // widows in the next column. | 645 // widows in the next column. |
| 646 if (spaceShortage <= 0) | 646 if (spaceShortage <= 0) |
| 647 return; | 647 return; |
| 648 | 648 |
| 649 if (RenderMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) | 649 if (RenderMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) |
| 650 multicolSet->recordSpaceShortage(spaceShortage); | 650 multicolSet->recordSpaceShortage(offset, spaceShortage); |
| 651 } | 651 } |
| 652 | 652 |
| 653 void RenderMultiColumnFlowThread::updateMinimumPageHeight(LayoutUnit offset, Lay
outUnit minHeight) | 653 void RenderMultiColumnFlowThread::updateMinimumPageHeight(LayoutUnit offset, Lay
outUnit minHeight) |
| 654 { | 654 { |
| 655 if (RenderMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) | 655 if (RenderMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) |
| 656 multicolSet->updateMinimumColumnHeight(minHeight); | 656 multicolSet->updateMinimumColumnHeight(offset, minHeight); |
| 657 } | 657 } |
| 658 | 658 |
| 659 bool RenderMultiColumnFlowThread::addForcedRegionBreak(LayoutUnit offset, Layout
Object* /*breakChild*/, bool /*isBefore*/, LayoutUnit* offsetBreakAdjustment) | 659 bool RenderMultiColumnFlowThread::addForcedRegionBreak(LayoutUnit offset, Layout
Object* /*breakChild*/, bool /*isBefore*/, LayoutUnit* offsetBreakAdjustment) |
| 660 { | 660 { |
| 661 if (RenderMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) { | 661 if (RenderMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) { |
| 662 multicolSet->addContentRun(offset); | 662 multicolSet->addContentRun(offset); |
| 663 if (offsetBreakAdjustment) | 663 if (offsetBreakAdjustment) |
| 664 *offsetBreakAdjustment = pageLogicalHeightForOffset(offset) ? pageRe
mainingLogicalHeightForOffset(offset, IncludePageBoundary) : LayoutUnit(); | 664 *offsetBreakAdjustment = pageLogicalHeightForOffset(offset) ? pageRe
mainingLogicalHeightForOffset(offset, IncludePageBoundary) : LayoutUnit(); |
| 665 return true; | 665 return true; |
| 666 } | 666 } |
| 667 return false; | 667 return false; |
| 668 } | 668 } |
| 669 | 669 |
| 670 bool RenderMultiColumnFlowThread::isPageLogicalHeightKnown() const | 670 bool RenderMultiColumnFlowThread::isPageLogicalHeightKnown() const |
| 671 { | 671 { |
| 672 if (RenderMultiColumnSet* columnSet = lastMultiColumnSet()) | 672 if (RenderMultiColumnSet* columnSet = lastMultiColumnSet()) |
| 673 return columnSet->pageLogicalHeight(); | 673 return columnSet->pageLogicalHeight(); |
| 674 return false; | 674 return false; |
| 675 } | 675 } |
| 676 | 676 |
| 677 } | 677 } |
| OLD | NEW |