| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/layout/LayoutPagedFlowThread.h" | 6 #include "core/layout/LayoutPagedFlowThread.h" |
| 7 | 7 |
| 8 #include "core/layout/LayoutMultiColumnSet.h" | 8 #include "core/layout/LayoutMultiColumnSet.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 LayoutPagedFlowThread* LayoutPagedFlowThread::createAnonymous(Document& document
, const ComputedStyle& parentStyle) | 12 LayoutPagedFlowThread* LayoutPagedFlowThread::createAnonymous(Document& document
, const ComputedStyle& parentStyle) |
| 13 { | 13 { |
| 14 LayoutPagedFlowThread* LayoutObject = new LayoutPagedFlowThread(); | 14 LayoutPagedFlowThread* pagedFlowThread = new LayoutPagedFlowThread(); |
| 15 LayoutObject->setDocumentForAnonymous(&document); | 15 pagedFlowThread->setDocumentForAnonymous(&document); |
| 16 LayoutObject->setStyle(ComputedStyle::createAnonymousStyleWithDisplay(parent
Style, BLOCK)); | 16 pagedFlowThread->setStyle(ComputedStyle::createAnonymousStyleWithDisplay(par
entStyle, BLOCK)); |
| 17 return LayoutObject; | 17 return pagedFlowThread; |
| 18 } | 18 } |
| 19 | 19 |
| 20 int LayoutPagedFlowThread::pageCount() | 20 int LayoutPagedFlowThread::pageCount() |
| 21 { | 21 { |
| 22 if (LayoutMultiColumnSet* columnSet = firstMultiColumnSet()) | 22 if (LayoutMultiColumnSet* columnSet = firstMultiColumnSet()) |
| 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 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 50 if (!pageLogicalHeight) | 50 if (!pageLogicalHeight) |
| 51 return; // Page height not calculated yet. Happens in the first layout p
ass when height is auto. | 51 return; // Page height not calculated yet. Happens in the first layout p
ass when height is auto. |
| 52 // Ensure uniform page height. We don't want the last page to be shorter tha
n the others, | 52 // Ensure uniform page height. We don't want the last page to be shorter tha
n the others, |
| 53 // or it'll be impossible to scroll that whole page into view. | 53 // or it'll be impossible to scroll that whole page into view. |
| 54 LayoutUnit paddedLogicalBottomInFlowThread = pageLogicalHeight * pageCount()
; | 54 LayoutUnit paddedLogicalBottomInFlowThread = pageLogicalHeight * pageCount()
; |
| 55 ASSERT(paddedLogicalBottomInFlowThread >= columnSet->logicalBottomInFlowThre
ad()); | 55 ASSERT(paddedLogicalBottomInFlowThread >= columnSet->logicalBottomInFlowThre
ad()); |
| 56 columnSet->endFlow(paddedLogicalBottomInFlowThread); | 56 columnSet->endFlow(paddedLogicalBottomInFlowThread); |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace blink | 59 } // namespace blink |
| OLD | NEW |