Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/LayoutGrid.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp |
| index 00436b95c574ea8221b85725c835a36ec99822cc..0747afe4cfe606eac2eed4819e1a9be794b98269 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp |
| @@ -1405,20 +1405,22 @@ void LayoutGrid::PopulateGridPositionsForDirection( |
| size_t number_of_tracks = tracks.size(); |
| size_t number_of_lines = number_of_tracks + 1; |
| size_t last_line = number_of_lines - 1; |
| + auto& grid = track_sizing_algorithm_.GetGrid(); |
|
svillar
2017/04/25 08:03:29
Same comment, I know this was already here, but yo
|
| + bool has_collapsed_tracks = grid.HasAutoRepeatEmptyTracks(direction); |
| + size_t number_of_collapsed_tracks = |
| + has_collapsed_tracks ? grid.AutoRepeatEmptyTracks(direction)->size() : 0; |
| ContentAlignmentData offset = ComputeContentPositionAndDistributionOffset( |
| direction, track_sizing_algorithm_.FreeSpace(direction).value(), |
| - number_of_tracks); |
| + number_of_tracks - number_of_collapsed_tracks); |
| auto& positions = is_row_axis ? column_positions_ : row_positions_; |
| positions.Resize(number_of_lines); |
| auto border_and_padding = |
| is_row_axis ? BorderAndPaddingLogicalLeft() : BorderAndPaddingBefore(); |
| positions[0] = border_and_padding + offset.position_offset; |
| - const Grid& grid = track_sizing_algorithm_.GetGrid(); |
| if (number_of_lines > 1) { |
| // If we have collapsed tracks we just ignore gaps here and add them later |
| // as we might not compute the gap between two consecutive tracks without |
| // examining the surrounding ones. |
| - bool has_collapsed_tracks = grid.HasAutoRepeatEmptyTracks(direction); |
| LayoutUnit gap = !has_collapsed_tracks ? GridGap(direction) : LayoutUnit(); |
| size_t next_to_last_line = number_of_lines - 2; |
| for (size_t i = 0; i < next_to_last_line; ++i) |
| @@ -1432,12 +1434,13 @@ void LayoutGrid::PopulateGridPositionsForDirection( |
| // they become 0. |
| if (has_collapsed_tracks) { |
| gap = GridGap(direction); |
| - size_t remaining_empty_tracks = |
| - grid.AutoRepeatEmptyTracks(direction)->size(); |
| + size_t remaining_empty_tracks = number_of_collapsed_tracks; |
| + size_t last_empty_track = 0; |
| LayoutUnit gap_accumulator; |
| for (size_t i = 1; i < last_line; ++i) { |
| if (grid.IsEmptyAutoRepeatTrack(direction, i - 1)) { |
| --remaining_empty_tracks; |
| + last_empty_track = i - 1; |
| } else { |
| // Add gap between consecutive non empty tracks. Add it also just once |
| // for an arbitrary number of empty tracks between two non empty ones. |
| @@ -1447,7 +1450,8 @@ void LayoutGrid::PopulateGridPositionsForDirection( |
| !grid.IsEmptyAutoRepeatTrack(direction, i)) |
| gap_accumulator += gap; |
| } |
| - positions[i] += gap_accumulator; |
| + positions[i] += |
| + gap_accumulator - last_empty_track * offset.distribution_offset; |
|
svillar
2017/04/25 08:03:29
I think this is wrong. Instead of the last empty t
|
| } |
| positions[last_line] += gap_accumulator; |
| } |