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

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

Issue 2509813004: Improve strut handling in initial column balancing pass. (Closed)
Patch Set: Rebaseline for column-rules-fixed-height. This test no longer triggers deep layout. Created 4 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/ColumnBalancer.cpp ('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 "core/layout/MultiColumnFragmentainerGroup.h" 5 #include "core/layout/MultiColumnFragmentainerGroup.h"
6 6
7 #include "core/layout/ColumnBalancer.h" 7 #include "core/layout/ColumnBalancer.h"
8 #include "core/layout/FragmentationContext.h" 8 #include "core/layout/FragmentationContext.h"
9 #include "core/layout/LayoutMultiColumnSet.h" 9 #include "core/layout/LayoutMultiColumnSet.h"
10 10
(...skipping 28 matching lines...) Expand all
39 39
40 void MultiColumnFragmentainerGroup::resetColumnHeight() { 40 void MultiColumnFragmentainerGroup::resetColumnHeight() {
41 m_maxColumnHeight = calculateMaxColumnHeight(); 41 m_maxColumnHeight = calculateMaxColumnHeight();
42 42
43 LayoutMultiColumnFlowThread* flowThread = m_columnSet.multiColumnFlowThread(); 43 LayoutMultiColumnFlowThread* flowThread = m_columnSet.multiColumnFlowThread();
44 if (m_columnSet.heightIsAuto()) { 44 if (m_columnSet.heightIsAuto()) {
45 FragmentationContext* enclosingFragmentationContext = 45 FragmentationContext* enclosingFragmentationContext =
46 flowThread->enclosingFragmentationContext(); 46 flowThread->enclosingFragmentationContext();
47 if (enclosingFragmentationContext && 47 if (enclosingFragmentationContext &&
48 enclosingFragmentationContext->isFragmentainerLogicalHeightKnown()) { 48 enclosingFragmentationContext->isFragmentainerLogicalHeightKnown()) {
49 // Even if height is auto, we set an initial height, in order to tell how 49 // Set an initial height, based on the fragmentainer height in the outer
50 // much content this MultiColumnFragmentainerGroup can hold, and when we 50 // fragmentation context, in order to tell how much content this
51 // need to append a new one. 51 // MultiColumnFragmentainerGroup can hold, and when we need to append a
52 // new one.
52 m_columnHeight = m_maxColumnHeight; 53 m_columnHeight = m_maxColumnHeight;
53 } else { 54 return;
54 m_columnHeight = LayoutUnit();
55 } 55 }
56 }
57 // If the multicol container has a definite height, use it as the column
58 // height. This even applies when we are to balance the columns. We'll still
59 // use the definite height as an initial height, and lay out once at that
60 // column height. If it turns out that the content needs less than this
61 // height, we have to balance and shrink the height and lay out the columns
62 // over again.
63 if (LayoutUnit logicalHeight = flowThread->columnHeightAvailable()) {
64 setAndConstrainColumnHeight(heightAdjustedForRowOffset(logicalHeight));
56 } else { 65 } else {
57 setAndConstrainColumnHeight( 66 m_columnHeight = LayoutUnit();
58 heightAdjustedForRowOffset(flowThread->columnHeightAvailable()));
59 } 67 }
60 } 68 }
61 69
62 bool MultiColumnFragmentainerGroup::recalculateColumnHeight( 70 bool MultiColumnFragmentainerGroup::recalculateColumnHeight(
63 LayoutMultiColumnSet& columnSet) { 71 LayoutMultiColumnSet& columnSet) {
64 LayoutUnit oldColumnHeight = m_columnHeight; 72 LayoutUnit oldColumnHeight = m_columnHeight;
65 73
66 m_maxColumnHeight = calculateMaxColumnHeight(); 74 m_maxColumnHeight = calculateMaxColumnHeight();
67 75
68 // Only the last row may have auto height, and thus be balanced. There are no 76 // Only the last row may have auto height, and thus be balanced. There are no
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 MultiColumnFragmentainerGroupList::addExtraGroup() { 594 MultiColumnFragmentainerGroupList::addExtraGroup() {
587 append(MultiColumnFragmentainerGroup(m_columnSet)); 595 append(MultiColumnFragmentainerGroup(m_columnSet));
588 return last(); 596 return last();
589 } 597 }
590 598
591 void MultiColumnFragmentainerGroupList::deleteExtraGroups() { 599 void MultiColumnFragmentainerGroupList::deleteExtraGroups() {
592 shrink(1); 600 shrink(1);
593 } 601 }
594 602
595 } // namespace blink 603 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/ColumnBalancer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698