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 12 matching lines...) Expand all Loading... |
23 return columnSet->actualColumnCount(); | 23 return columnSet->actualColumnCount(); |
24 return 1; | 24 return 1; |
25 } | 25 } |
26 | 26 |
27 bool LayoutPagedFlowThread::needsNewWidth() const { | 27 bool LayoutPagedFlowThread::needsNewWidth() const { |
28 return progressionIsInline() != | 28 return progressionIsInline() != |
29 pagedBlockFlow()->style()->hasInlinePaginationAxis(); | 29 pagedBlockFlow()->style()->hasInlinePaginationAxis(); |
30 } | 30 } |
31 | 31 |
32 void LayoutPagedFlowThread::updateLogicalWidth() { | 32 void LayoutPagedFlowThread::updateLogicalWidth() { |
33 // As long as we inherit from LayoutMultiColumnFlowThread, we need to bypass i
ts implementation | 33 // As long as we inherit from LayoutMultiColumnFlowThread, we need to bypass |
34 // here. We're not split into columns, so the flow thread width will just be w
hatever is | 34 // its implementation here. We're not split into columns, so the flow thread |
35 // 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 ASSERT( | 40 // There should either be zero or one of those for paged layout. |
41 firstMultiColumnBox() == | 41 DCHECK(firstMultiColumnBox() == lastMultiColumnBox()); |
42 lastMultiColumnBox()); // There should either be zero or one of those for
paged layout. | |
43 setProgressionIsInline(pagedBlockFlow()->style()->hasInlinePaginationAxis()); | 42 setProgressionIsInline(pagedBlockFlow()->style()->hasInlinePaginationAxis()); |
44 LayoutMultiColumnFlowThread::layout(); | 43 LayoutMultiColumnFlowThread::layout(); |
45 | 44 |
46 LayoutMultiColumnSet* columnSet = firstMultiColumnSet(); | 45 LayoutMultiColumnSet* columnSet = firstMultiColumnSet(); |
47 if (!columnSet) | 46 if (!columnSet) |
48 return; | 47 return; |
49 LayoutUnit pageLogicalHeight = | 48 LayoutUnit pageLogicalHeight = |
50 columnSet->pageLogicalHeightForOffset(LayoutUnit()); | 49 columnSet->pageLogicalHeightForOffset(LayoutUnit()); |
51 if (!pageLogicalHeight) | 50 if (!pageLogicalHeight) |
52 return; // Page height not calculated yet. Happens in the first layout pass
when height is auto. | 51 return; // Page height not calculated yet. Happens in the first layout pass |
53 // Ensure uniform page height. We don't want the last page to be shorter than
the others, | 52 // when height is auto. |
54 // or it'll be impossible to scroll that whole page into view. | 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. |
55 LayoutUnit paddedLogicalBottomInFlowThread = pageLogicalHeight * pageCount(); | 55 LayoutUnit paddedLogicalBottomInFlowThread = pageLogicalHeight * pageCount(); |
56 ASSERT(paddedLogicalBottomInFlowThread >= | 56 ASSERT(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 |