| Index: third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp b/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
|
| index 663db6159eb12b8070cb9e5a185c6a74548d2779..728b34090a116c5517133de9665b588af7e04bdf 100644
|
| --- a/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
|
| @@ -39,10 +39,11 @@ MultiColumnFragmentainerGroup::BlockOffsetInEnclosingFragmentationContext()
|
|
|
| LayoutUnit MultiColumnFragmentainerGroup::LogicalHeightInFlowThreadAt(
|
| unsigned column_index) const {
|
| - if (!column_height_)
|
| + LayoutUnit column_height = ColumnLogicalHeight();
|
| + if (!column_height)
|
| return LayoutUnit();
|
| LayoutUnit logical_top = LogicalTopInFlowThreadAt(column_index);
|
| - LayoutUnit logical_bottom = logical_top + column_height_;
|
| + LayoutUnit logical_bottom = logical_top + column_height;
|
| if (logical_bottom > LogicalBottomInFlowThread()) {
|
| DCHECK_EQ(column_index + 1, ActualColumnCount());
|
| logical_bottom = LogicalBottomInFlowThread();
|
| @@ -51,7 +52,7 @@ LayoutUnit MultiColumnFragmentainerGroup::LogicalHeightInFlowThreadAt(
|
| }
|
|
|
| void MultiColumnFragmentainerGroup::ResetColumnHeight() {
|
| - max_column_height_ = CalculateMaxColumnHeight();
|
| + max_logical_height_ = CalculateMaxColumnHeight();
|
|
|
| LayoutMultiColumnFlowThread* flow_thread =
|
| column_set_.MultiColumnFlowThread();
|
| @@ -64,7 +65,7 @@ void MultiColumnFragmentainerGroup::ResetColumnHeight() {
|
| // fragmentation context, in order to tell how much content this
|
| // MultiColumnFragmentainerGroup can hold, and when we need to append a
|
| // new one.
|
| - column_height_ = max_column_height_;
|
| + logical_height_ = max_logical_height_;
|
| return;
|
| }
|
| }
|
| @@ -77,15 +78,15 @@ void MultiColumnFragmentainerGroup::ResetColumnHeight() {
|
| if (LayoutUnit logical_height = flow_thread->ColumnHeightAvailable()) {
|
| SetAndConstrainColumnHeight(HeightAdjustedForRowOffset(logical_height));
|
| } else {
|
| - column_height_ = LayoutUnit();
|
| + logical_height_ = LayoutUnit();
|
| }
|
| }
|
|
|
| bool MultiColumnFragmentainerGroup::RecalculateColumnHeight(
|
| LayoutMultiColumnSet& column_set) {
|
| - LayoutUnit old_column_height = column_height_;
|
| + LayoutUnit old_column_height = logical_height_;
|
|
|
| - max_column_height_ = CalculateMaxColumnHeight();
|
| + max_logical_height_ = CalculateMaxColumnHeight();
|
|
|
| // 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
|
| @@ -116,10 +117,10 @@ bool MultiColumnFragmentainerGroup::RecalculateColumnHeight(
|
| } else {
|
| // The position of the column set may have changed, in which case height
|
| // available for columns may have changed as well.
|
| - SetAndConstrainColumnHeight(column_height_);
|
| + SetAndConstrainColumnHeight(logical_height_);
|
| }
|
|
|
| - if (column_height_ == old_column_height)
|
| + if (logical_height_ == old_column_height)
|
| return false; // No change. We're done.
|
|
|
| return true; // Need another pass.
|
| @@ -211,8 +212,8 @@ LayoutPoint MultiColumnFragmentainerGroup::VisualPointToFlowThreadPoint(
|
| : column_rect.Height();
|
| if (local_point.X() < 0)
|
| local_point = LayoutPoint(LayoutUnit(), column_start);
|
| - else if (local_point.X() > LogicalHeight())
|
| - local_point = LayoutPoint(LogicalHeight(), column_start);
|
| + else if (local_point.X() > ColumnLogicalHeight())
|
| + local_point = LayoutPoint(ColumnLogicalHeight(), column_start);
|
| }
|
| return LayoutPoint(local_point.X() + LogicalTopInFlowThreadAt(column_index),
|
| local_point.Y());
|
| @@ -223,8 +224,8 @@ LayoutPoint MultiColumnFragmentainerGroup::VisualPointToFlowThreadPoint(
|
| : column_rect.Width();
|
| if (local_point.Y() < 0)
|
| local_point = LayoutPoint(column_start, LayoutUnit());
|
| - else if (local_point.Y() > LogicalHeight())
|
| - local_point = LayoutPoint(column_start, LogicalHeight());
|
| + else if (local_point.Y() > ColumnLogicalHeight())
|
| + local_point = LayoutPoint(column_start, ColumnLogicalHeight());
|
| }
|
| return LayoutPoint(local_point.X(),
|
| local_point.Y() + LogicalTopInFlowThreadAt(column_index));
|
| @@ -294,7 +295,8 @@ unsigned MultiColumnFragmentainerGroup::ActualColumnCount() const {
|
| // We must always return a value of 1 or greater. Column count = 0 is a
|
| // meaningless situation, and will confuse and cause problems in other parts
|
| // of the code.
|
| - if (!column_height_)
|
| + LayoutUnit column_height = ColumnLogicalHeight();
|
| + if (!column_height)
|
| return 1;
|
|
|
| // Our flow thread portion determines our column count. We have as many
|
| @@ -303,9 +305,9 @@ unsigned MultiColumnFragmentainerGroup::ActualColumnCount() const {
|
| if (!flow_thread_portion_height)
|
| return 1;
|
|
|
| - unsigned count = (flow_thread_portion_height / column_height_).Floor();
|
| + unsigned count = (flow_thread_portion_height / column_height).Floor();
|
| // flowThreadPortionHeight may be saturated, so detect the remainder manually.
|
| - if (count * column_height_ < flow_thread_portion_height)
|
| + if (count * column_height < flow_thread_portion_height)
|
| count++;
|
| DCHECK_GE(count, 1u);
|
| return count;
|
| @@ -342,9 +344,9 @@ LayoutUnit MultiColumnFragmentainerGroup::CalculateMaxColumnHeight() const {
|
|
|
| void MultiColumnFragmentainerGroup::SetAndConstrainColumnHeight(
|
| LayoutUnit new_height) {
|
| - column_height_ = new_height;
|
| - if (column_height_ > max_column_height_)
|
| - column_height_ = max_column_height_;
|
| + logical_height_ = new_height;
|
| + if (logical_height_ > max_logical_height_)
|
| + logical_height_ = max_logical_height_;
|
| }
|
|
|
| LayoutUnit MultiColumnFragmentainerGroup::RebalanceColumnHeightIfNeeded()
|
| @@ -352,15 +354,15 @@ LayoutUnit MultiColumnFragmentainerGroup::RebalanceColumnHeightIfNeeded()
|
| if (ActualColumnCount() <= column_set_.UsedColumnCount()) {
|
| // With the current column height, the content fits without creating
|
| // overflowing columns. We're done.
|
| - return column_height_;
|
| + return logical_height_;
|
| }
|
|
|
| - if (column_height_ >= max_column_height_) {
|
| + if (logical_height_ >= max_logical_height_) {
|
| // We cannot stretch any further. We'll just have to live with the
|
| // overflowing columns. This typically happens if the max column height is
|
| // less than the height of the tallest piece of unbreakable content (e.g.
|
| // lines).
|
| - return column_height_;
|
| + return logical_height_;
|
| }
|
|
|
| MinimumSpaceShortageFinder shortage_finder(
|
| @@ -370,7 +372,7 @@ LayoutUnit MultiColumnFragmentainerGroup::RebalanceColumnHeightIfNeeded()
|
| column_set_.UsedColumnCount()) {
|
| // Too many forced breaks to allow any implicit breaks. Initial balancing
|
| // should already have set a good height. There's nothing more we should do.
|
| - return column_height_;
|
| + return logical_height_;
|
| }
|
|
|
| // If the initial guessed column height wasn't enough, stretch it now. Stretch
|
| @@ -381,9 +383,9 @@ LayoutUnit MultiColumnFragmentainerGroup::RebalanceColumnHeightIfNeeded()
|
| DCHECK_NE(min_space_shortage,
|
| LayoutUnit::Max()); // If this happens, we probably have a bug.
|
| if (min_space_shortage == LayoutUnit::Max())
|
| - return column_height_; // So bail out rather than looping infinitely.
|
| + return logical_height_; // So bail out rather than looping infinitely.
|
|
|
| - return column_height_ + min_space_shortage;
|
| + return logical_height_ + min_space_shortage;
|
| }
|
|
|
| LayoutRect MultiColumnFragmentainerGroup::ColumnRectAt(
|
| @@ -402,7 +404,7 @@ LayoutRect MultiColumnFragmentainerGroup::ColumnRectAt(
|
| column_logical_width -
|
| column_index * (column_logical_width + column_gap);
|
| } else {
|
| - column_logical_top += column_index * (column_height_ + column_gap);
|
| + column_logical_top += column_index * (ColumnLogicalHeight() + column_gap);
|
| }
|
|
|
| LayoutRect column_rect(column_logical_left, column_logical_top,
|
| @@ -498,10 +500,11 @@ unsigned MultiColumnFragmentainerGroup::ColumnIndexAtOffset(
|
| if (offset_in_flow_thread < logical_top_in_flow_thread_)
|
| return 0;
|
|
|
| - if (!column_height_)
|
| + LayoutUnit column_height = ColumnLogicalHeight();
|
| + if (!column_height)
|
| return 0;
|
| unsigned column_index =
|
| - ((offset_in_flow_thread - logical_top_in_flow_thread_) / column_height_)
|
| + ((offset_in_flow_thread - logical_top_in_flow_thread_) / column_height)
|
| .Floor();
|
| if (page_boundary_rule == LayoutBox::kAssociateWithFormerPage &&
|
| column_index > 0 &&
|
| @@ -520,7 +523,7 @@ unsigned MultiColumnFragmentainerGroup::ColumnIndexAtVisualPoint(
|
| bool is_horizontal_writing_mode = column_set_.IsHorizontalWritingMode();
|
| LayoutUnit column_length_in_column_progression_direction =
|
| is_column_progression_inline ? column_set_.PageLogicalWidth()
|
| - : LogicalHeight();
|
| + : ColumnLogicalHeight();
|
| LayoutUnit offset_in_column_progression_direction =
|
| is_horizontal_writing_mode == is_column_progression_inline
|
| ? visual_point.X()
|
|
|