Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: athena/home/athena_start_page_view.cc

Issue 511053003: Shrink the search box if the width is too small. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « athena/home/athena_start_page_view.h ('k') | athena/home/athena_start_page_view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/home/athena_start_page_view.cc
diff --git a/athena/home/athena_start_page_view.cc b/athena/home/athena_start_page_view.cc
index f15e46b4b5b42eb2576eef78e26bf4839b93c2fb..42262820e0927ea4d4199493ffc13fa270f754c8 100644
--- a/athena/home/athena_start_page_view.cc
+++ b/athena/home/athena_start_page_view.cc
@@ -40,7 +40,10 @@ const int kWebViewWidth = 500;
const int kWebViewHeight = 105;
const int kSearchBoxBorderWidth = 1;
const int kSearchBoxCornerRadius = 2;
-const int kSearchBoxWidth = 490;
+
+// The search box spans horizontally over the 6 icons (3 apps icon and 3 control
+// icons) with margins.
oshima 2014/08/29 17:47:18 can you update the comment as discussed offline?
Jun Mukai 2014/08/29 18:36:29 Done.
+const int kSearchBoxWidth = kIconSize * 6 + kIconMargin * 7;
const int kSearchBoxHeight = 40;
class PlaceHolderButton : public views::ImageButton,
@@ -257,7 +260,10 @@ AthenaStartPageView::LayoutData AthenaStartPageView::CreateBottomBounds(
state.controls.set_x(width - kIconMargin - state.controls.width());
state.controls.set_y(kIconMargin);
- state.search_box.set_size(search_box_container_->size());
+ int search_box_max_width =
+ state.controls.x() - state.icons.right() - kIconMargin * 2;
+ state.search_box.set_width(std::min(search_box_max_width, kSearchBoxWidth));
+ state.search_box.set_height(search_box_container_->height());
state.search_box.set_x((width - state.search_box.width()) / 2);
state.search_box.set_y((kHomeCardHeight - state.search_box.height()) / 2);
@@ -270,7 +276,7 @@ AthenaStartPageView::LayoutData AthenaStartPageView::CreateCenteredBounds(
int width) {
LayoutData state;
- state.search_box.set_size(search_box_container_->size());
+ state.search_box.set_size(search_box_container_->GetPreferredSize());
state.search_box.set_x((width - state.search_box.width()) / 2);
state.search_box.set_y(logo_->bounds().bottom() + kInstantContainerSpacing);
« no previous file with comments | « athena/home/athena_start_page_view.h ('k') | athena/home/athena_start_page_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698