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

Unified Diff: ui/app_list/views/apps_grid_view.cc

Issue 898253002: Update apps grid view layout to match latest mocks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@search_box_animate_shadow
Patch Set: rebase Created 5 years, 10 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 | « ui/app_list/views/app_list_view_unittest.cc ('k') | ui/app_list/views/contents_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/apps_grid_view.cc
diff --git a/ui/app_list/views/apps_grid_view.cc b/ui/app_list/views/apps_grid_view.cc
index 6a6d8a96adf8d9acf9a4af8fcfd880f042e3dce8..0b0dd62ef9ba10db29525d1f14369a0e3ddf6b03 100644
--- a/ui/app_list/views/apps_grid_view.cc
+++ b/ui/app_list/views/apps_grid_view.cc
@@ -60,7 +60,7 @@ namespace {
const int kDragBufferPx = 20;
// Padding space in pixels for fixed layout.
-const int kBottomPadding = 3;
+const int kBottomPadding = 2;
const int kLeftRightPadding = 24;
// Padding space in pixels between pages.
@@ -70,12 +70,13 @@ const int kPagePadding = 40;
const int kPreferredTileWidth = 88;
const int kPreferredTileHeight = 98;
-const int kExperimentalPreferredTileWidth = 90;
-const int kExperimentalPreferredTileHeight = 90;
+const int kExperimentalPreferredTileWidth = 100;
+const int kExperimentalPreferredTileHeight = 100;
// Padding on each side of a tile.
-const int kExperimentalTileLeftRightPadding = 15;
-const int kExperimentalTileTopBottomPadding = 11;
+const int kExperimentalTileLeftRightPadding = 10;
+const int kExperimentalTileBottomPadding = 12;
+const int kExperimentalTileTopPadding = 6;
// Width in pixels of the area on the sides that triggers a page flip.
const int kPageFlipZoneSize = 40;
@@ -111,6 +112,16 @@ gfx::Size GetTileViewSize() {
: gfx::Size(kPreferredTileWidth, kPreferredTileHeight);
}
+// Returns the padding around a tile view.
+gfx::Insets GetTilePadding() {
+ if (!switches::IsExperimentalAppListEnabled())
+ return gfx::Insets();
+
+ return gfx::Insets(
+ -kExperimentalTileLeftRightPadding, -kExperimentalTileTopPadding,
+ -kExperimentalTileLeftRightPadding, -kExperimentalTileBottomPadding);
+}
+
// RowMoveAnimationDelegate is used when moving an item into a different row.
// Before running the animation, the item's layer is re-created and kept in
// the original position, then the item is moved to just before its target
@@ -407,7 +418,7 @@ void AppsGridView::SetLayout(int cols, int rows_per_page) {
if (switches::IsExperimentalAppListEnabled()) {
SetBorder(views::Border::CreateEmptyBorder(
- 0, kExperimentalWindowPadding, 0, kExperimentalWindowPadding));
+ 0, kExperimentalAppsGridPadding, 0, kExperimentalAppsGridPadding));
} else {
SetBorder(views::Border::CreateEmptyBorder(
0, kLeftRightPadding, kBottomPadding, kLeftRightPadding));
@@ -419,7 +430,7 @@ gfx::Size AppsGridView::GetTotalTileSize() {
gfx::Size size = GetTileViewSize();
if (switches::IsExperimentalAppListEnabled()) {
size.Enlarge(2 * kExperimentalTileLeftRightPadding,
- 2 * kExperimentalTileTopBottomPadding);
+ kExperimentalTileBottomPadding);
}
return size;
}
@@ -2120,9 +2131,7 @@ AppsGridView::Index AppsGridView::GetNearestTileIndexForPoint(
gfx::Size AppsGridView::GetTileGridSize() const {
gfx::Rect bounds = GetExpectedTileBounds(0, 0);
bounds.Union(GetExpectedTileBounds(rows_per_page_ - 1, cols_ - 1));
- if (switches::IsExperimentalAppListEnabled())
- bounds.Inset(-kExperimentalTileLeftRightPadding,
- -kExperimentalTileTopBottomPadding);
+ bounds.Inset(GetTilePadding());
return bounds.size();
}
@@ -2136,7 +2145,7 @@ gfx::Rect AppsGridView::GetExpectedTileBounds(int row, int col) const {
gfx::Rect tile_bounds(gfx::Point(bounds.x() + col * total_tile_size.width(),
bounds.y() + row * total_tile_size.height()),
total_tile_size);
- tile_bounds.ClampToCenteredSize(GetTileViewSize());
+ tile_bounds.Inset(-GetTilePadding());
return tile_bounds;
}
« no previous file with comments | « ui/app_list/views/app_list_view_unittest.cc ('k') | ui/app_list/views/contents_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698