Commit b5d1cfc4 authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

Adapt app list folder view bounds for scalable app list margins

AppListFolderView should ensure it respects apps container margins when
shown with ScalableAppList feature enabled, in particular it should
ensure its bounds do not overlap with the search box widget.
It was using search_box_fullscreen_top_padding() to determine search box
location, but this does not work correctly for ScalableAppList - when the
feature is enabled, use
AppsContainerView::CalculateMarginsForAvailableBounds to get the
container margins.

BUG=999273

Change-Id: Ie842da042cf6215fe9b1345229a1575d10ca55a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1815581
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698649}
parent 6ae63ae1
...@@ -597,13 +597,24 @@ void AppListFolderView::UpdatePreferredBounds() { ...@@ -597,13 +597,24 @@ void AppListFolderView::UpdatePreferredBounds() {
preferred_bounds_ = gfx::Rect(GetPreferredSize()); preferred_bounds_ = gfx::Rect(GetPreferredSize());
preferred_bounds_ += (icon_bounds_in_container.CenterPoint() - preferred_bounds_ += (icon_bounds_in_container.CenterPoint() -
preferred_bounds_.CenterPoint()); preferred_bounds_.CenterPoint());
gfx::Rect container_bounds = container_view_->GetContentsBounds(); gfx::Rect container_bounds = container_view_->GetContentsBounds();
container_bounds.Inset( // Adjust for apps container margins.
0, if (app_list_features::IsScalableAppListEnabled()) {
GetAppListConfig().search_box_fullscreen_top_padding() + container_bounds.Inset(container_view_->CalculateMarginsForAvailableBounds(
search_box::kSearchBoxPreferredHeight + container_bounds,
SearchBoxView::GetFocusRingSpacing(), contents_view_->GetSearchBoxSize(ash::AppListState::kStateApps),
0, 0); true /*for_full_container_bounds*/));
} else {
container_bounds.Inset(
0, GetAppListConfig().search_box_fullscreen_top_padding(), 0, 0);
}
// Avoid overlap with the search box widget.
container_bounds.Inset(0,
search_box::kSearchBoxPreferredHeight +
SearchBoxView::GetFocusRingSpacing(),
0, 0);
preferred_bounds_.AdjustToFit(container_bounds); preferred_bounds_.AdjustToFit(container_bounds);
// Calculate the folder icon's bounds relative to this view. // Calculate the folder icon's bounds relative to this view.
......
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