Commit 3be7ac85 authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

Update tile padding before GetTileGridSize during AppsGridView layout

Result of GetTileGridSize() depends on the cached tile padding value,
which is set in UpdateTilePadding(). Currently, AppsGridView::Layout
calculates grid size before the padding is set, which means that the
resulting grid size might not match the current apps grid state if
layout is done just after the screen bounds change. The grid size is
used to calculate item container bounds, which means the item container
bounds get calculated incorrectly after screen bounds change.

To fix the issue, call UpdateTilePadding() before GetTileGridSize()

BUG=1003756

Change-Id: Ie390d6e3b48bc8fd00f88e9ecc17d759a4d82cc9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1807578Reviewed-by: default avatarJun Mukai <mukai@chromium.org>
Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697256}
parent 6f4bcd45
...@@ -963,6 +963,13 @@ void AppsGridView::Layout() { ...@@ -963,6 +963,13 @@ void AppsGridView::Layout() {
if (bounds_animator_->IsAnimating()) if (bounds_animator_->IsAnimating())
bounds_animator_->Cancel(); bounds_animator_->Cancel();
if (GetContentsBounds().IsEmpty())
return;
// Update cached tile padding first, as grid size calculations depend on the
// cached padding value.
UpdateTilePadding();
// Prepare |page_size| * number-of-pages for |items_container_|, and sets the // Prepare |page_size| * number-of-pages for |items_container_|, and sets the
// origin properly to show the correct page. // origin properly to show the correct page.
const gfx::Size page_size = GetTileGridSize(); const gfx::Size page_size = GetTileGridSize();
...@@ -983,13 +990,9 @@ void AppsGridView::Layout() { ...@@ -983,13 +990,9 @@ void AppsGridView::Layout() {
page_height * pages)); page_height * pages));
} }
if (GetContentsBounds().IsEmpty())
return;
if (fadeout_layer_delegate_) if (fadeout_layer_delegate_)
fadeout_layer_delegate_->layer()->SetBounds(layer()->bounds()); fadeout_layer_delegate_->layer()->SetBounds(layer()->bounds());
UpdateTilePadding();
CalculateIdealBoundsForFolder(); CalculateIdealBoundsForFolder();
for (int i = 0; i < view_model_.view_size(); ++i) { for (int i = 0; i < view_model_.view_size(); ++i) {
AppListItemView* view = GetItemViewAt(i); AppListItemView* view = GetItemViewAt(i);
......
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