Make MultiColumnFragmentainerGroup::m_columnSet const.
Ideally, I'd like to get rid of the member altogether, but that would require a
lot of refactoring.
This is a preparatory patch for a fix for bug 604609.
BUG=604609
Review URL: https://codereview.chromium.org/1898293003
Cr-Commit-Position: refs/heads/master@{#388326}
diff --git a/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp b/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp
index 1ad819f..9c40e3d 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp
@@ -313,7 +313,7 @@
bool changed = false;
for (auto& group : m_fragmentainerGroups)
- changed = group.recalculateColumnHeight() || changed;
+ changed = group.recalculateColumnHeight(*this) || changed;
m_initialHeightCalculated = true;
return changed;
}
diff --git a/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp b/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
index e2fae00..855466f5 100644
--- a/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
+++ b/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
@@ -10,7 +10,7 @@
namespace blink {
-MultiColumnFragmentainerGroup::MultiColumnFragmentainerGroup(LayoutMultiColumnSet& columnSet)
+MultiColumnFragmentainerGroup::MultiColumnFragmentainerGroup(const LayoutMultiColumnSet& columnSet)
: m_columnSet(columnSet)
{
}
@@ -57,7 +57,7 @@
}
}
-bool MultiColumnFragmentainerGroup::recalculateColumnHeight()
+bool MultiColumnFragmentainerGroup::recalculateColumnHeight(LayoutMultiColumnSet& columnSet)
{
LayoutUnit oldColumnHeight = m_columnHeight;
@@ -66,18 +66,18 @@
// Only the last row may have auto height, and thus be balanced. There are no good reasons to
// balance the preceding rows, and that could potentially lead to an insane number of layout
// passes as well.
- if (isLastGroup() && m_columnSet.heightIsAuto()) {
+ if (isLastGroup() && columnSet.heightIsAuto()) {
LayoutUnit newColumnHeight;
- if (!m_columnSet.isInitialHeightCalculated()) {
+ if (!columnSet.isInitialHeightCalculated()) {
// Initial balancing: Start with the lowest imaginable column height. Also calculate the
// height of the tallest piece of unbreakable content. Columns should never get any
// shorter than that (unless constrained by max-height). Propagate this to our
// containing column set, in case there is an outer multicol container that also needs
// to balance. After having calculated the initial column height, the multicol container
// needs another layout pass with the column height that we just calculated.
- InitialColumnHeightFinder initialHeightFinder(columnSet(), logicalTopInFlowThread(), logicalBottomInFlowThread());
+ InitialColumnHeightFinder initialHeightFinder(columnSet, logicalTopInFlowThread(), logicalBottomInFlowThread());
LayoutUnit tallestUnbreakableLogicalHeight = initialHeightFinder.tallestUnbreakableLogicalHeight();
- m_columnSet.propagateTallestUnbreakableLogicalHeight(tallestUnbreakableLogicalHeight);
+ columnSet.propagateTallestUnbreakableLogicalHeight(tallestUnbreakableLogicalHeight);
newColumnHeight = std::max(initialHeightFinder.initialMinimalBalancedHeight(), tallestUnbreakableLogicalHeight);
} else {
// Rebalancing: After having laid out again, we'll need to rebalance if the height
diff --git a/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.h b/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.h
index e1ca9abfb..4f7df29 100644
--- a/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.h
+++ b/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.h
@@ -29,7 +29,7 @@
class MultiColumnFragmentainerGroup {
DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
public:
- MultiColumnFragmentainerGroup(LayoutMultiColumnSet&);
+ MultiColumnFragmentainerGroup(const LayoutMultiColumnSet&);
const LayoutMultiColumnSet& columnSet() const { return m_columnSet; }
@@ -60,7 +60,7 @@
LayoutUnit logicalHeightInFlowThread() const { return m_logicalBottomInFlowThread - m_logicalTopInFlowThread; }
void resetColumnHeight();
- bool recalculateColumnHeight();
+ bool recalculateColumnHeight(LayoutMultiColumnSet&);
LayoutSize flowThreadTranslationAtOffset(LayoutUnit offsetInFlowThread) const;
LayoutUnit columnLogicalTopForOffset(LayoutUnit offsetInFlowThread) const;
@@ -103,7 +103,7 @@
// Get the first and the last column intersecting the specified visual rectangle.
void columnIntervalForVisualRect(const LayoutRect&, unsigned& firstColumn, unsigned& lastColumn) const;
- LayoutMultiColumnSet& m_columnSet;
+ const LayoutMultiColumnSet& m_columnSet;
LayoutUnit m_logicalTop;
LayoutUnit m_logicalTopInFlowThread;