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

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

Issue 1898293003: Make MultiColumnFragmentainerGroup::m_columnSet const. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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
11 namespace blink { 11 namespace blink {
12 12
13 MultiColumnFragmentainerGroup::MultiColumnFragmentainerGroup(LayoutMultiColumnSe t& columnSet) 13 MultiColumnFragmentainerGroup::MultiColumnFragmentainerGroup(const LayoutMultiCo lumnSet& columnSet)
14 : m_columnSet(columnSet) 14 : m_columnSet(columnSet)
15 { 15 {
16 } 16 }
17 17
18 bool MultiColumnFragmentainerGroup::isFirstGroup() const 18 bool MultiColumnFragmentainerGroup::isFirstGroup() const
19 { 19 {
20 return &m_columnSet.firstFragmentainerGroup() == this; 20 return &m_columnSet.firstFragmentainerGroup() == this;
21 } 21 }
22 22
23 bool MultiColumnFragmentainerGroup::isLastGroup() const 23 bool MultiColumnFragmentainerGroup::isLastGroup() const
(...skipping 26 matching lines...) Expand all
50 // this MultiColumnFragmentainerGroup can hold, and when we need to append a new one. 50 // this MultiColumnFragmentainerGroup can hold, and when we need to append a new one.
51 m_columnHeight = m_maxColumnHeight; 51 m_columnHeight = m_maxColumnHeight;
52 } else { 52 } else {
53 m_columnHeight = LayoutUnit(); 53 m_columnHeight = LayoutUnit();
54 } 54 }
55 } else { 55 } else {
56 setAndConstrainColumnHeight(heightAdjustedForRowOffset(flowThread->colum nHeightAvailable())); 56 setAndConstrainColumnHeight(heightAdjustedForRowOffset(flowThread->colum nHeightAvailable()));
57 } 57 }
58 } 58 }
59 59
60 bool MultiColumnFragmentainerGroup::recalculateColumnHeight() 60 bool MultiColumnFragmentainerGroup::recalculateColumnHeight(LayoutMultiColumnSet & columnSet)
61 { 61 {
62 LayoutUnit oldColumnHeight = m_columnHeight; 62 LayoutUnit oldColumnHeight = m_columnHeight;
63 63
64 m_maxColumnHeight = calculateMaxColumnHeight(); 64 m_maxColumnHeight = calculateMaxColumnHeight();
65 65
66 // Only the last row may have auto height, and thus be balanced. There are n o good reasons to 66 // Only the last row may have auto height, and thus be balanced. There are n o good reasons to
67 // balance the preceding rows, and that could potentially lead to an insane number of layout 67 // balance the preceding rows, and that could potentially lead to an insane number of layout
68 // passes as well. 68 // passes as well.
69 if (isLastGroup() && m_columnSet.heightIsAuto()) { 69 if (isLastGroup() && columnSet.heightIsAuto()) {
70 LayoutUnit newColumnHeight; 70 LayoutUnit newColumnHeight;
71 if (!m_columnSet.isInitialHeightCalculated()) { 71 if (!columnSet.isInitialHeightCalculated()) {
72 // Initial balancing: Start with the lowest imaginable column height . Also calculate the 72 // Initial balancing: Start with the lowest imaginable column height . Also calculate the
73 // height of the tallest piece of unbreakable content. Columns shoul d never get any 73 // height of the tallest piece of unbreakable content. Columns shoul d never get any
74 // shorter than that (unless constrained by max-height). Propagate t his to our 74 // shorter than that (unless constrained by max-height). Propagate t his to our
75 // containing column set, in case there is an outer multicol contain er that also needs 75 // containing column set, in case there is an outer multicol contain er that also needs
76 // to balance. After having calculated the initial column height, th e multicol container 76 // to balance. After having calculated the initial column height, th e multicol container
77 // needs another layout pass with the column height that we just cal culated. 77 // needs another layout pass with the column height that we just cal culated.
78 InitialColumnHeightFinder initialHeightFinder(columnSet(), logicalTo pInFlowThread(), logicalBottomInFlowThread()); 78 InitialColumnHeightFinder initialHeightFinder(columnSet, logicalTopI nFlowThread(), logicalBottomInFlowThread());
79 LayoutUnit tallestUnbreakableLogicalHeight = initialHeightFinder.tal lestUnbreakableLogicalHeight(); 79 LayoutUnit tallestUnbreakableLogicalHeight = initialHeightFinder.tal lestUnbreakableLogicalHeight();
80 m_columnSet.propagateTallestUnbreakableLogicalHeight(tallestUnbreaka bleLogicalHeight); 80 columnSet.propagateTallestUnbreakableLogicalHeight(tallestUnbreakabl eLogicalHeight);
81 newColumnHeight = std::max(initialHeightFinder.initialMinimalBalance dHeight(), tallestUnbreakableLogicalHeight); 81 newColumnHeight = std::max(initialHeightFinder.initialMinimalBalance dHeight(), tallestUnbreakableLogicalHeight);
82 } else { 82 } else {
83 // Rebalancing: After having laid out again, we'll need to rebalance if the height 83 // Rebalancing: After having laid out again, we'll need to rebalance if the height
84 // wasn't enough and we're allowed to stretch it, and then re-lay ou t. There are further 84 // wasn't enough and we're allowed to stretch it, and then re-lay ou t. There are further
85 // details on the column balancing machinery in ColumnBalancer and i ts derivates. 85 // details on the column balancing machinery in ColumnBalancer and i ts derivates.
86 newColumnHeight = rebalanceColumnHeightIfNeeded(); 86 newColumnHeight = rebalanceColumnHeightIfNeeded();
87 } 87 }
88 setAndConstrainColumnHeight(newColumnHeight); 88 setAndConstrainColumnHeight(newColumnHeight);
89 } else { 89 } else {
90 // The position of the column set may have changed, in which case height available for 90 // The position of the column set may have changed, in which case height available for
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 append(MultiColumnFragmentainerGroup(m_columnSet)); 532 append(MultiColumnFragmentainerGroup(m_columnSet));
533 return last(); 533 return last();
534 } 534 }
535 535
536 void MultiColumnFragmentainerGroupList::deleteExtraGroups() 536 void MultiColumnFragmentainerGroupList::deleteExtraGroups()
537 { 537 {
538 shrink(1); 538 shrink(1);
539 } 539 }
540 540
541 } // namespace blink 541 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698