Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: Source/core/layout/LayoutPagedFlowThread.cpp

Issue 1181483005: Avoid stretching the parent of a column spanner. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update unit tests that used to test the container stretching mechanism Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
9
8 namespace blink { 10 namespace blink {
9 11
10 LayoutPagedFlowThread* LayoutPagedFlowThread::createAnonymous(Document& document , const ComputedStyle& parentStyle) 12 LayoutPagedFlowThread* LayoutPagedFlowThread::createAnonymous(Document& document , const ComputedStyle& parentStyle)
11 { 13 {
12 LayoutPagedFlowThread* LayoutObject = new LayoutPagedFlowThread(); 14 LayoutPagedFlowThread* LayoutObject = new LayoutPagedFlowThread();
13 LayoutObject->setDocumentForAnonymous(&document); 15 LayoutObject->setDocumentForAnonymous(&document);
14 LayoutObject->setStyle(ComputedStyle::createAnonymousStyleWithDisplay(parent Style, BLOCK)); 16 LayoutObject->setStyle(ComputedStyle::createAnonymousStyleWithDisplay(parent Style, BLOCK));
15 return LayoutObject; 17 return LayoutObject;
16 } 18 }
17 19
20 int LayoutPagedFlowThread::pageCount()
21 {
22 if (LayoutMultiColumnSet* columnSet = firstMultiColumnSet())
23 return columnSet->actualColumnCount();
24 return 1;
25 }
26
18 bool LayoutPagedFlowThread::needsNewWidth() const 27 bool LayoutPagedFlowThread::needsNewWidth() const
19 { 28 {
20 return progressionIsInline() != pagedBlockFlow()->style()->hasInlinePaginati onAxis(); 29 return progressionIsInline() != pagedBlockFlow()->style()->hasInlinePaginati onAxis();
21 } 30 }
22 31
23 void LayoutPagedFlowThread::updateLogicalWidth() 32 void LayoutPagedFlowThread::updateLogicalWidth()
24 { 33 {
25 // As long as we inherit from LayoutMultiColumnFlowThread, we need to bypass its implementation 34 // As long as we inherit from LayoutMultiColumnFlowThread, we need to bypass its implementation
26 // here. We're not split into columns, so the flow thread width will just be whatever is 35 // here. We're not split into columns, so the flow thread width will just be whatever is
27 // available in the containing block. 36 // available in the containing block.
28 LayoutFlowThread::updateLogicalWidth(); 37 LayoutFlowThread::updateLogicalWidth();
29 } 38 }
30 39
31 void LayoutPagedFlowThread::layout() 40 void LayoutPagedFlowThread::layout()
32 { 41 {
42 ASSERT(firstMultiColumnBox() == lastMultiColumnBox()); // There should eithe r be zero or one of those for paged layout.
33 setProgressionIsInline(pagedBlockFlow()->style()->hasInlinePaginationAxis()) ; 43 setProgressionIsInline(pagedBlockFlow()->style()->hasInlinePaginationAxis()) ;
34 LayoutMultiColumnFlowThread::layout(); 44 LayoutMultiColumnFlowThread::layout();
45
46 LayoutMultiColumnSet* columnSet = firstMultiColumnSet();
47 if (!columnSet)
48 return;
49 LayoutUnit pageLogicalHeight = columnSet->pageLogicalHeight();
50 if (!pageLogicalHeight)
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,
53 // or it'll be impossible to scroll that whole page into view.
54 LayoutUnit paddedLogicalBottomInFlowThread = pageLogicalHeight * pageCount() ;
55 ASSERT(paddedLogicalBottomInFlowThread >= columnSet->logicalBottomInFlowThre ad());
56 columnSet->endFlow(paddedLogicalBottomInFlowThread);
35 } 57 }
36 58
37 } // namespace blink 59 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutPagedFlowThread.h ('k') | Source/core/layout/MultiColumnFragmentainerGroup.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698