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

Side by Side Diff: third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp

Issue 1406973008: Calculate minimum column height after layout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: code review Created 5 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 6
7 #include "core/layout/MultiColumnFragmentainerGroup.h" 7 #include "core/layout/MultiColumnFragmentainerGroup.h"
8 8
9 #include "core/layout/ColumnBalancer.h" 9 #include "core/layout/ColumnBalancer.h"
10 #include "core/layout/LayoutMultiColumnSet.h" 10 #include "core/layout/LayoutMultiColumnSet.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 bool MultiColumnFragmentainerGroup::heightIsAuto() const 42 bool MultiColumnFragmentainerGroup::heightIsAuto() const
43 { 43 {
44 // Only the last row may have auto height, and thus be balanced. There are n o good reasons to 44 // Only the last row may have auto height, and thus be balanced. There are n o good reasons to
45 // balance the preceding rows, and that could potentially lead to an insane number of layout 45 // balance the preceding rows, and that could potentially lead to an insane number of layout
46 // passes as well. 46 // passes as well.
47 return isLastGroup() && m_columnSet.heightIsAuto(); 47 return isLastGroup() && m_columnSet.heightIsAuto();
48 } 48 }
49 49
50 void MultiColumnFragmentainerGroup::resetColumnHeight() 50 void MultiColumnFragmentainerGroup::resetColumnHeight()
51 { 51 {
52 // Nuke previously stored minimum column height. Contents may have changed f or all we know.
53 m_minimumColumnHeight = 0;
54
55 m_maxColumnHeight = calculateMaxColumnHeight(); 52 m_maxColumnHeight = calculateMaxColumnHeight();
56 53
57 LayoutMultiColumnFlowThread* flowThread = m_columnSet.multiColumnFlowThread( ); 54 LayoutMultiColumnFlowThread* flowThread = m_columnSet.multiColumnFlowThread( );
58 if (heightIsAuto()) { 55 if (heightIsAuto()) {
59 LayoutMultiColumnFlowThread* enclosingFlowThread = flowThread->enclosing FlowThread(); 56 LayoutMultiColumnFlowThread* enclosingFlowThread = flowThread->enclosing FlowThread();
60 if (enclosingFlowThread && enclosingFlowThread->isPageLogicalHeightKnown ()) { 57 if (enclosingFlowThread && enclosingFlowThread->isPageLogicalHeightKnown ()) {
61 // Even if height is auto, we set an initial height, in order to tel l how much content 58 // Even if height is auto, we set an initial height, in order to tel l how much content
62 // this MultiColumnFragmentainerGroup can hold, and when we need to append a new one. 59 // this MultiColumnFragmentainerGroup can hold, and when we need to append a new one.
63 m_columnHeight = m_maxColumnHeight; 60 m_columnHeight = m_maxColumnHeight;
64 } else { 61 } else {
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 m_columnHeight = m_maxColumnHeight; 336 m_columnHeight = m_maxColumnHeight;
340 } 337 }
341 338
342 LayoutUnit MultiColumnFragmentainerGroup::calculateColumnHeight(BalancedColumnHe ightCalculation calculationMode) const 339 LayoutUnit MultiColumnFragmentainerGroup::calculateColumnHeight(BalancedColumnHe ightCalculation calculationMode) const
343 { 340 {
344 if (calculationMode == GuessFromFlowThreadPortion) { 341 if (calculationMode == GuessFromFlowThreadPortion) {
345 // Initial balancing. Start with the lowest imaginable column height. We use the tallest 342 // Initial balancing. Start with the lowest imaginable column height. We use the tallest
346 // content run (after having "inserted" implicit breaks), and find its s tart offset (by 343 // content run (after having "inserted" implicit breaks), and find its s tart offset (by
347 // looking at the previous run's end offset, or, if there's no previous run, the set's start 344 // looking at the previous run's end offset, or, if there's no previous run, the set's start
348 // offset in the flow thread). 345 // offset in the flow thread).
349 return std::max(InitialColumnHeightFinder::initialMinimalBalancedHeight( *this), m_minimumColumnHeight); 346 return InitialColumnHeightFinder::initialMinimalBalancedHeight(*this);
350 } 347 }
351 348
352 if (actualColumnCount() <= m_columnSet.usedColumnCount()) { 349 if (actualColumnCount() <= m_columnSet.usedColumnCount()) {
353 // With the current column height, the content fits without creating ove rflowing columns. We're done. 350 // With the current column height, the content fits without creating ove rflowing columns. We're done.
354 return m_columnHeight; 351 return m_columnHeight;
355 } 352 }
356 353
357 if (m_columnHeight >= m_maxColumnHeight) { 354 if (m_columnHeight >= m_maxColumnHeight) {
358 // We cannot stretch any further. We'll just have to live with the overf lowing columns. This 355 // We cannot stretch any further. We'll just have to live with the overf lowing columns. This
359 // typically happens if the max column height is less than the height of the tallest piece 356 // typically happens if the max column height is less than the height of the tallest piece
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 append(MultiColumnFragmentainerGroup(m_columnSet)); 554 append(MultiColumnFragmentainerGroup(m_columnSet));
558 return last(); 555 return last();
559 } 556 }
560 557
561 void MultiColumnFragmentainerGroupList::deleteExtraGroups() 558 void MultiColumnFragmentainerGroupList::deleteExtraGroups()
562 { 559 {
563 shrink(1); 560 shrink(1);
564 } 561 }
565 562
566 } // namespace blink 563 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698