OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/layout/LayoutPagedFlowThread.h" | 5 #include "core/layout/LayoutPagedFlowThread.h" |
6 | 6 |
7 #include "core/layout/LayoutMultiColumnSet.h" | 7 #include "core/layout/LayoutMultiColumnSet.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 void LayoutPagedFlowThread::updateLogicalWidth() { | 32 void LayoutPagedFlowThread::updateLogicalWidth() { |
33 // As long as we inherit from LayoutMultiColumnFlowThread, we need to bypass | 33 // As long as we inherit from LayoutMultiColumnFlowThread, we need to bypass |
34 // its implementation here. We're not split into columns, so the flow thread | 34 // its implementation here. We're not split into columns, so the flow thread |
35 // width will just be whatever is available in the containing block. | 35 // width will just be whatever is available in the containing block. |
36 LayoutFlowThread::updateLogicalWidth(); | 36 LayoutFlowThread::updateLogicalWidth(); |
37 } | 37 } |
38 | 38 |
39 void LayoutPagedFlowThread::layout() { | 39 void LayoutPagedFlowThread::layout() { |
40 // There should either be zero or one of those for paged layout. | 40 // There should either be zero or one of those for paged layout. |
41 DCHECK(firstMultiColumnBox() == lastMultiColumnBox()); | 41 DCHECK_EQ(firstMultiColumnBox(), lastMultiColumnBox()); |
42 setProgressionIsInline(pagedBlockFlow()->style()->hasInlinePaginationAxis()); | 42 setProgressionIsInline(pagedBlockFlow()->style()->hasInlinePaginationAxis()); |
43 LayoutMultiColumnFlowThread::layout(); | 43 LayoutMultiColumnFlowThread::layout(); |
44 | 44 |
45 LayoutMultiColumnSet* columnSet = firstMultiColumnSet(); | 45 LayoutMultiColumnSet* columnSet = firstMultiColumnSet(); |
46 if (!columnSet) | 46 if (!columnSet) |
47 return; | 47 return; |
48 LayoutUnit pageLogicalHeight = | 48 LayoutUnit pageLogicalHeight = |
49 columnSet->pageLogicalHeightForOffset(LayoutUnit()); | 49 columnSet->pageLogicalHeightForOffset(LayoutUnit()); |
50 if (!pageLogicalHeight) | 50 if (!pageLogicalHeight) |
51 return; // Page height not calculated yet. Happens in the first layout pass | 51 return; // Page height not calculated yet. Happens in the first layout pass |
52 // when height is auto. | 52 // when height is auto. |
53 // Ensure uniform page height. We don't want the last page to be shorter than | 53 // Ensure uniform page height. We don't want the last page to be shorter than |
54 // the others, or it'll be impossible to scroll that whole page into view. | 54 // the others, or it'll be impossible to scroll that whole page into view. |
55 LayoutUnit paddedLogicalBottomInFlowThread = pageLogicalHeight * pageCount(); | 55 LayoutUnit paddedLogicalBottomInFlowThread = pageLogicalHeight * pageCount(); |
56 ASSERT(paddedLogicalBottomInFlowThread >= | 56 DCHECK_GE(paddedLogicalBottomInFlowThread, |
57 columnSet->logicalBottomInFlowThread()); | 57 columnSet->logicalBottomInFlowThread()); |
58 columnSet->endFlow(paddedLogicalBottomInFlowThread); | 58 columnSet->endFlow(paddedLogicalBottomInFlowThread); |
59 } | 59 } |
60 | 60 |
61 } // namespace blink | 61 } // namespace blink |
OLD | NEW |