Commit d2c3a964 authored by calamity's avatar calamity Committed by Commit bot

Adjust experimental app list padding.

This CL changes the padding values in the experimental app list to
precisely match the padding spec.

BUG=411775

Review URL: https://codereview.chromium.org/570233002

Cr-Commit-Position: refs/heads/master@{#295252}
parent d9168de8
...@@ -87,10 +87,7 @@ void AppListBackground::Paint(gfx::Canvas* canvas, ...@@ -87,10 +87,7 @@ void AppListBackground::Paint(gfx::Canvas* canvas,
const gfx::Rect contents_view_view_bounds = const gfx::Rect contents_view_view_bounds =
contents_view->ConvertRectToWidget(contents_view->GetLocalBounds()); contents_view->ConvertRectToWidget(contents_view->GetLocalBounds());
gfx::Rect separator_rect(contents_rect); gfx::Rect separator_rect(contents_rect);
// Extra kContentsSwitcherSeparatorHeight pixels so the launcher page separator_rect.set_y(contents_view_view_bounds.bottom());
// indicator overlays the separator rect.
separator_rect.set_y(contents_view_view_bounds.bottom() +
kContentsSwitcherSeparatorHeight);
separator_rect.set_height(kBottomSeparatorSize); separator_rect.set_height(kBottomSeparatorSize);
canvas->FillRect(separator_rect, kBottomSeparatorColor); canvas->FillRect(separator_rect, kBottomSeparatorColor);
int contents_switcher_top = separator_rect.bottom(); int contents_switcher_top = separator_rect.bottom();
......
...@@ -36,15 +36,14 @@ namespace app_list { ...@@ -36,15 +36,14 @@ namespace app_list {
namespace { namespace {
// Inner padding space in pixels of bubble contents. // Border padding space around the bubble contents.
const int kInnerPadding = 1; const int kPadding = 1;
// The maximum allowed time to wait for icon loading in milliseconds. // The maximum allowed time to wait for icon loading in milliseconds.
const int kMaxIconLoadingWaitTimeInMs = 50; const int kMaxIconLoadingWaitTimeInMs = 50;
// The padding around the search box in the experimental app list. // The padding around the search box in the experimental app list.
const int kSearchBoxViewPadding = 24; const int kSearchBoxViewPadding = 23;
const int kSearchBoxViewPaddingBottom = 12;
// A view that holds another view and takes its preferred size. This is used for // A view that holds another view and takes its preferred size. This is used for
// wrapping the search box view so it still gets laid out while hidden. This is // wrapping the search box view so it still gets laid out while hidden. This is
...@@ -119,10 +118,8 @@ AppListMainView::AppListMainView(AppListViewDelegate* delegate, ...@@ -119,10 +118,8 @@ AppListMainView::AppListMainView(AppListViewDelegate* delegate,
contents_view_(NULL), contents_view_(NULL),
contents_switcher_view_(NULL), contents_switcher_view_(NULL),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, SetLayoutManager(
kInnerPadding, new views::BoxLayout(views::BoxLayout::kVertical, kPadding, kPadding, 0));
kInnerPadding,
kInnerPadding));
search_box_view_ = new SearchBoxView(this, delegate); search_box_view_ = new SearchBoxView(this, delegate);
views::View* container = new SearchBoxContainerView(this, search_box_view_); views::View* container = new SearchBoxContainerView(this, search_box_view_);
...@@ -130,7 +127,7 @@ AppListMainView::AppListMainView(AppListViewDelegate* delegate, ...@@ -130,7 +127,7 @@ AppListMainView::AppListMainView(AppListViewDelegate* delegate,
container->SetBorder( container->SetBorder(
views::Border::CreateEmptyBorder(kSearchBoxViewPadding, views::Border::CreateEmptyBorder(kSearchBoxViewPadding,
kSearchBoxViewPadding, kSearchBoxViewPadding,
kSearchBoxViewPaddingBottom, 0,
kSearchBoxViewPadding)); kSearchBoxViewPadding));
} }
AddChildView(container); AddChildView(container);
......
...@@ -60,9 +60,8 @@ namespace { ...@@ -60,9 +60,8 @@ namespace {
const int kDragBufferPx = 20; const int kDragBufferPx = 20;
// Padding space in pixels for fixed layout. // Padding space in pixels for fixed layout.
const int kLeftRightPadding = 20; const int kLeftRightPadding = 23;
const int kTopPadding = 1; const int kTopPadding = 1;
const int kBottomPadding = 24;
// Padding space in pixels between pages. // Padding space in pixels between pages.
const int kPagePadding = 40; const int kPagePadding = 40;
...@@ -426,7 +425,10 @@ void AppsGridView::SetLayout(int cols, int rows_per_page) { ...@@ -426,7 +425,10 @@ void AppsGridView::SetLayout(int cols, int rows_per_page) {
rows_per_page_ = rows_per_page; rows_per_page_ = rows_per_page;
SetBorder(views::Border::CreateEmptyBorder( SetBorder(views::Border::CreateEmptyBorder(
kTopPadding, kLeftRightPadding, 0, kLeftRightPadding)); switches::IsExperimentalAppListEnabled() ? 0 : kTopPadding,
kLeftRightPadding,
0,
kLeftRightPadding));
} }
void AppsGridView::ResetForShowApps() { void AppsGridView::ResetForShowApps() {
...@@ -894,7 +896,7 @@ bool AppsGridView::IsAnimatingView(views::View* view) { ...@@ -894,7 +896,7 @@ bool AppsGridView::IsAnimatingView(views::View* view) {
gfx::Size AppsGridView::GetPreferredSize() const { gfx::Size AppsGridView::GetPreferredSize() const {
const gfx::Insets insets(GetInsets()); const gfx::Insets insets(GetInsets());
int page_switcher_height = kBottomPadding; int page_switcher_height = 0;
if (page_switcher_view_) if (page_switcher_view_)
page_switcher_height = page_switcher_view_->GetPreferredSize().height(); page_switcher_height = page_switcher_view_->GetPreferredSize().height();
gfx::Size size = GetTileGridSize(); gfx::Size size = GetTileGridSize();
......
...@@ -18,6 +18,7 @@ namespace { ...@@ -18,6 +18,7 @@ namespace {
const int kButtonImageSize = 32; const int kButtonImageSize = 32;
const int kButtonSpacing = 4; const int kButtonSpacing = 4;
const int kMinimumHeight = 39;
class ContentsPageIndicatorView : public views::View { class ContentsPageIndicatorView : public views::View {
public: public:
...@@ -40,6 +41,7 @@ ContentsSwitcherView::ContentsSwitcherView(ContentsView* contents_view) ...@@ -40,6 +41,7 @@ ContentsSwitcherView::ContentsSwitcherView(ContentsView* contents_view)
views::BoxLayout* layout = new views::BoxLayout( views::BoxLayout* layout = new views::BoxLayout(
views::BoxLayout::kHorizontal, 0, 0, kButtonSpacing); views::BoxLayout::kHorizontal, 0, 0, kButtonSpacing);
layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER);
layout->set_minimum_cross_axis_size(kMinimumHeight);
SetLayoutManager(layout); SetLayoutManager(layout);
} }
......
...@@ -38,9 +38,6 @@ const SkColor kHintTextColor = SkColorSetRGB(0xA0, 0xA0, 0xA0); ...@@ -38,9 +38,6 @@ const SkColor kHintTextColor = SkColorSetRGB(0xA0, 0xA0, 0xA0);
const int kMenuYOffsetFromButton = -4; const int kMenuYOffsetFromButton = -4;
const int kMenuXOffsetFromButton = -7; const int kMenuXOffsetFromButton = -7;
// Experimental app list constants.
const int kExperimentalSearchBoxHeight = 37;
const int kBackgroundBorderWidth = 1; const int kBackgroundBorderWidth = 1;
const int kBackgroundBorderBottomWidth = 1; const int kBackgroundBorderBottomWidth = 1;
const int kBackgroundBorderCornerRadius = 2; const int kBackgroundBorderCornerRadius = 2;
...@@ -102,9 +99,7 @@ SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate, ...@@ -102,9 +99,7 @@ SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate,
SetLayoutManager(layout); SetLayoutManager(layout);
layout->set_cross_axis_alignment( layout->set_cross_axis_alignment(
views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER);
layout->set_minimum_cross_axis_size(switches::IsExperimentalAppListEnabled() layout->set_minimum_cross_axis_size(kPreferredHeight);
? kExperimentalSearchBoxHeight
: kPreferredHeight);
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
...@@ -166,10 +161,7 @@ void SearchBoxView::InvalidateMenu() { ...@@ -166,10 +161,7 @@ void SearchBoxView::InvalidateMenu() {
} }
gfx::Size SearchBoxView::GetPreferredSize() const { gfx::Size SearchBoxView::GetPreferredSize() const {
return gfx::Size(kPreferredWidth, return gfx::Size(kPreferredWidth, kPreferredHeight);
switches::IsExperimentalAppListEnabled()
? kExperimentalSearchBoxHeight
: kPreferredHeight);
} }
bool SearchBoxView::OnMouseWheel(const ui::MouseWheelEvent& event) { bool SearchBoxView::OnMouseWheel(const ui::MouseWheelEvent& event) {
......
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