Commit b97b2044 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

overview: Fix height of second row elements not correctly placed.

Regression from crrev.com/c/2335794. Which simplify placement logics
but forgot to add margin between rows.

Test: manual
Change-Id: Iebeec0c7c729fb171f2e980a6d5a2f70f206b682
Fixed: 1115917
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2354921Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797913}
parent 9e1301f0
......@@ -1842,6 +1842,7 @@ bool OverviewGrid::FitWindowRectsInBounds(
int width = CalculateWidthAndMaybeSetUnclippedBounds(window_list_[i].get(),
height) +
2 * kWindowMargin;
int height_with_margin = height + 2 * kWindowMargin;
if (left + width > bounds.right()) {
// Move to the next row if possible.
......@@ -1849,11 +1850,11 @@ bool OverviewGrid::FitWindowRectsInBounds(
*out_min_right = left;
if (*out_max_right < left)
*out_max_right = left;
top += height;
top += height_with_margin;
// Check if the new row reaches the bottom or if the first item in the new
// row does not fit within the available width.
if (top + height > bounds.bottom() ||
if (top + height_with_margin > bounds.bottom() ||
bounds.x() + width > bounds.right()) {
return false;
}
......@@ -1861,12 +1862,12 @@ bool OverviewGrid::FitWindowRectsInBounds(
}
// Position the current rect.
(*out_rects)[i] = gfx::RectF(left, top, width, height + 2 * kWindowMargin);
(*out_rects)[i] = gfx::RectF(left, top, width, height_with_margin);
// Increment horizontal position using sanitized positive |width|.
left += width;
*out_max_bottom = top + height;
*out_max_bottom = top + height_with_margin;
}
// Update the narrowest and widest row width for the last row.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment