Commit 5e4bfa28 authored by Findit's avatar Findit Committed by Alexei Filippov

Revert "Adjust the bounds in opened search box"

This reverts commit 7ae6f9f5.

Reason for revert:

Findit (https://goo.gl/kROfz5) identified CL at revision 487250 as the
culprit for failures in the build cycles as shown on:
https://findit-for-me.appspot.com/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyRAsSDVdmU3VzcGVjdGVkQ0wiMWNocm9taXVtLzdhZTZmOWY1MGYyM2VlOGY1MDA3YTg1MGNkY2NiNmYwODNlYzY0MTgM

Sample Build: https://luci-milo.appspot.com/buildbot/chromium.chromiumos/Linux%20ChromiumOS%20Builder%20%28dbg%29/89626

Original change's description:
> Adjust the bounds in opened search box
> 
> Changes:
> 1. Adjust the height of SearchResultTileItemView based on spec:
> https://screenshot.googleplex.com/AFQ5HnrMYch
> 2. Adjust the height of SearchBoxView based on spec:
> https://screenshot.googleplex.com/bGiXTCBUhdX
> 3. Adjust the width and height of SearchResultPageView based on spec:
> https://screenshot.googleplex.com/ykfwoEeMPTr
> 
> Screenshot: https://screenshot.googleplex.com/8AQ0XofWAhZ
> 
> BUG=742699
> 
> Change-Id: Iad10d029241f82ccf98b3bac7e8a50c597da1aa1
> Reviewed-on: https://chromium-review.googlesource.com/572365
> Commit-Queue: Weidong Guo <weidongg@chromium.org>
> Reviewed-by: Yury Khmel <khmel@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#487250}
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
BUG=742699

Change-Id: Id9ba9992566802461da8d3c055b6f052d0f69056
Reviewed-on: https://chromium-review.googlesource.com/575358Reviewed-by: default avatarAlexei Filippov <alph@chromium.org>
Commit-Queue: Alexei Filippov <alph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487286}
parent 4b0a0252
......@@ -127,6 +127,9 @@ const int kSearchBoxPadding = 16;
const int kSearchBoxTopPadding = 24;
const int kSearchBoxBottomPadding = 21;
// The preferred height of the search box.
const int kSearchBoxPreferredHeight = 48;
// The background border corner radius of the search box in fullscreen mode.
const int kSearchBoxBorderCornerRadiusFullscreen = 24;
......@@ -161,7 +164,7 @@ const char kSearchResultDistanceFromOrigin[] =
"Apps.AppListSearchResultDistanceFromOrigin";
// The height of tiles in search result.
const int kSearchTileHeight = 90;
const int kSearchTileHeight = 92;
// The size of the search icon in the search box.
const int kSearchIconSize = 24;
......
......@@ -96,6 +96,7 @@ APP_LIST_EXPORT extern const int kAppsGridPadding;
APP_LIST_EXPORT extern const int kSearchBoxPadding;
APP_LIST_EXPORT extern const int kSearchBoxTopPadding;
APP_LIST_EXPORT extern const int kSearchBoxBottomPadding;
APP_LIST_EXPORT extern const int kSearchBoxPreferredHeight;
APP_LIST_EXPORT extern const int kSearchBoxBorderCornerRadiusFullscreen;
APP_LIST_EXPORT extern size_t kMaxFolderItems;
......
......@@ -846,12 +846,9 @@ void AppListView::Layout() {
// Make sure to layout |app_list_main_view_| and |speech_view_| at the
// center of the widget.
gfx::Rect centered_bounds = contents_bounds;
ContentsView* contents_view = app_list_main_view_->contents_view();
centered_bounds.ClampToCenteredSize(
gfx::Size(is_fullscreen_app_list_enabled_
? contents_view->GetMaximumContentsSize().width()
: contents_view->GetDefaultContentsBounds().width(),
contents_bounds.height()));
centered_bounds.ClampToCenteredSize(gfx::Size(
app_list_main_view_->contents_view()->GetDefaultContentsBounds().width(),
contents_bounds.height()));
app_list_main_view_->SetBoundsRect(centered_bounds);
......@@ -866,7 +863,7 @@ void AppListView::Layout() {
}
if (is_fullscreen_app_list_enabled_) {
contents_view->Layout();
app_list_main_view_->contents_view()->Layout();
app_list_background_shield_->SetBoundsRect(contents_bounds);
}
}
......
......@@ -372,8 +372,8 @@ gfx::Rect ContentsView::GetDefaultSearchBoxBounds() const {
gfx::Rect search_box_bounds;
if (is_fullscreen_app_list_enabled_) {
search_box_bounds.set_size(GetSearchBoxView()->GetPreferredSize());
search_box_bounds.Offset((bounds().width() - search_box_bounds.width()) / 2,
0);
search_box_bounds.Offset(
(GetDefaultContentsSize().width() - search_box_bounds.width()) / 2, 0);
search_box_bounds.set_y(kSearchBoxTopPadding);
} else {
search_box_bounds =
......@@ -392,24 +392,12 @@ gfx::Rect ContentsView::GetSearchBoxBoundsForState(
}
gfx::Rect ContentsView::GetDefaultContentsBounds() const {
gfx::Size contents_size(GetDefaultContentsSize());
gfx::Point origin(0, GetDefaultSearchBoxBounds().bottom());
if (is_fullscreen_app_list_enabled_) {
origin.Offset((bounds().width() - contents_size.width()) / 2,
kSearchBoxBottomPadding);
}
return gfx::Rect(origin, contents_size);
}
gfx::Size ContentsView::GetMaximumContentsSize() const {
int max_width = 0;
int max_height = 0;
for (AppListPage* page : app_list_pages_) {
gfx::Size size(page->GetPreferredSize());
max_width = std::max(size.width(), max_width);
max_height = std::max(size.height(), max_height);
}
return gfx::Size(max_width, max_height);
gfx::Rect bounds(gfx::Point(0, GetDefaultSearchBoxBounds().bottom() +
(is_fullscreen_app_list_enabled_
? kSearchBoxBottomPadding
: 0)),
GetDefaultContentsSize());
return bounds;
}
bool ContentsView::Back() {
......
......@@ -119,9 +119,6 @@ class APP_LIST_EXPORT ContentsView : public views::View,
// specify their own custom layout.
gfx::Rect GetDefaultContentsBounds() const;
// Returns the maximum preferred size of the all pages.
gfx::Size GetMaximumContentsSize() const;
// Performs the 'back' action for the active page. Returns whether the action
// was handled.
bool Back();
......
......@@ -52,7 +52,6 @@ constexpr int kPadding = 12;
constexpr int kInnerPadding = 24;
constexpr int kPreferredWidth = 360;
constexpr int kPreferredWidthFullscreen = 544;
constexpr int kSearchBoxPreferredHeight = 48;
constexpr SkColor kHintTextColor = SkColorSetARGBMacro(0xFF, 0xA0, 0xA0, 0xA0);
......
......@@ -11,7 +11,6 @@
#include "base/message_loop/message_loop.h"
#include "base/time/time.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/app_list/app_list_features.h"
#include "ui/app_list/app_list_switches.h"
#include "ui/app_list/app_list_view_delegate.h"
#include "ui/app_list/search_result.h"
......@@ -25,11 +24,10 @@
namespace {
constexpr int kMaxResults = 6;
constexpr int kMaxResultsFullscreen = 5;
constexpr int kTimeoutIndicatorHeight = 2;
constexpr int kTimeoutFramerate = 60;
constexpr SkColor kTimeoutIndicatorColor = SkColorSetRGB(30, 144, 255);
const int kMaxResults = 6;
const int kTimeoutIndicatorHeight = 2;
const int kTimeoutFramerate = 60;
const SkColor kTimeoutIndicatorColor = SkColorSetRGB(30, 144, 255);
} // namespace
......@@ -45,10 +43,7 @@ SearchResultListView::SearchResultListView(
results_container_->SetLayoutManager(
new views::BoxLayout(views::BoxLayout::kVertical));
int max_results = features::IsFullscreenAppListEnabled()
? kMaxResultsFullscreen
: kMaxResults;
for (int i = 0; i < max_results; ++i)
for (int i = 0; i < kMaxResults; ++i)
results_container_->AddChildView(new SearchResultView(this));
AddChildView(results_container_);
......
......@@ -34,7 +34,6 @@ namespace {
constexpr int kGroupSpacing = 6;
constexpr int kTopPadding = 8;
constexpr int kFullscreenHeight = 440;
constexpr int kFullscreenWidth = 640;
// The z-height of the search box and cards in this view.
constexpr int kSearchResultZHeight = 1;
......@@ -43,9 +42,6 @@ constexpr int kSearchResultZHeight = 1;
constexpr int kSeparatorPadding = 12;
constexpr int kSeparatorThickness = 1;
// The height of the search box in this page.
constexpr int kSearchBoxHeight = 56;
constexpr SkColor kSeparatorColor = SkColorSetARGBMacro(0x1F, 0x00, 0x00, 0x00);
// A container view that ensures the card background and the shadow are painted
......@@ -96,7 +92,7 @@ class SearchResultPageBackground : public views::Background {
canvas->DrawRoundRect(bounds, corner_radius_, flags);
// Draws a separator between SearchBoxView and SearchResultPageView.
bounds.set_y(kSearchBoxHeight);
bounds.set_y(kSearchBoxPreferredHeight);
bounds.set_height(kSeparatorThickness);
canvas->FillRect(bounds, kSeparatorColor);
}
......@@ -168,7 +164,7 @@ SearchResultPageView::SearchResultPageView()
if (is_fullscreen_app_list_enabled_) {
// Leaves a placeholder area for the search box and the separator below it.
scroller->SetBorder(views::CreateEmptyBorder(
gfx::Insets(kSearchBoxHeight + kSeparatorThickness, 0, 0, 0)));
gfx::Insets(kSearchBoxPreferredHeight + kSeparatorThickness, 0, 0, 0)));
}
scroller->SetContents(contents_view_);
// Setting clip height is necessary to make ScrollView take into account its
......@@ -249,12 +245,6 @@ const char* SearchResultPageView::GetClassName() const {
return "SearchResultPageView";
}
gfx::Size SearchResultPageView::CalculatePreferredSize() const {
if (!is_fullscreen_app_list_enabled_)
return GetDefaultContentsBounds().size();
return gfx::Size(kFullscreenWidth, kFullscreenHeight);
}
void SearchResultPageView::ClearSelectedIndex() {
if (HasSelection())
result_container_views_[selected_index_]->ClearSelectedIndex();
......@@ -369,9 +359,9 @@ gfx::Rect SearchResultPageView::GetPageBoundsForState(
return AppListPage::GetSearchBoxBounds();
}
gfx::Rect onscreen_bounds(AppListPage::GetSearchBoxBounds());
onscreen_bounds.Offset((onscreen_bounds.width() - kFullscreenWidth) / 2, 0);
onscreen_bounds.set_size(GetPreferredSize());
gfx::Rect onscreen_bounds(GetDefaultContentsBounds());
onscreen_bounds.set_y(AppListPage::GetSearchBoxBounds().y());
onscreen_bounds.set_height(kFullscreenHeight);
return onscreen_bounds;
}
......@@ -419,8 +409,9 @@ void SearchResultPageView::OnHidden() {
gfx::Rect SearchResultPageView::GetSearchBoxBounds() const {
gfx::Rect rect(AppListPage::GetSearchBoxBounds());
if (is_fullscreen_app_list_enabled_) {
rect.Offset((rect.width() - kFullscreenWidth) / 2, 0);
rect.set_size(gfx::Size(kFullscreenWidth, kSearchBoxHeight));
gfx::Rect contents_bounds(GetDefaultContentsBounds());
rect.set_x(contents_bounds.x());
rect.set_width(contents_bounds.width());
}
return rect;
}
......
......@@ -39,7 +39,6 @@ class APP_LIST_EXPORT SearchResultPageView
// Overridden from views::View:
bool OnKeyPressed(const ui::KeyEvent& event) override;
const char* GetClassName() const override;
gfx::Size CalculatePreferredSize() const override;
// AppListPage overrides:
gfx::Rect GetPageBoundsForState(AppListModel::State state) const override;
......
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