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

Side by Side Diff: chrome/browser/ui/views/harmony/harmony_layout_delegate.cc

Issue 2783023002: Use an InsetMetric instead of a constant for vector button padding. (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/harmony/harmony_layout_delegate.h" 5 #include "chrome/browser/ui/views/harmony/harmony_layout_delegate.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 9
10 static base::LazyInstance<HarmonyLayoutDelegate>::DestructorAtExit 10 static base::LazyInstance<HarmonyLayoutDelegate>::DestructorAtExit
(...skipping 13 matching lines...) Expand all
24 case Metric::BUTTON_MAX_LINKABLE_WIDTH: 24 case Metric::BUTTON_MAX_LINKABLE_WIDTH:
25 return kHarmonyLayoutUnit * 8; 25 return kHarmonyLayoutUnit * 8;
26 case Metric::BUTTON_MINIMUM_WIDTH: 26 case Metric::BUTTON_MINIMUM_WIDTH:
27 case Metric::DIALOG_BUTTON_MINIMUM_WIDTH: 27 case Metric::DIALOG_BUTTON_MINIMUM_WIDTH:
28 // Minimum label size plus padding. 28 // Minimum label size plus padding.
29 return 2 * kHarmonyLayoutUnit + 29 return 2 * kHarmonyLayoutUnit +
30 2 * GetMetric(Metric::BUTTON_HORIZONTAL_PADDING); 30 2 * GetMetric(Metric::BUTTON_HORIZONTAL_PADDING);
31 case Metric::DIALOG_BUTTON_TOP_SPACING: 31 case Metric::DIALOG_BUTTON_TOP_SPACING:
32 return kHarmonyLayoutUnit; 32 return kHarmonyLayoutUnit;
33 case Metric::DIALOG_CLOSE_BUTTON_MARGIN: 33 case Metric::DIALOG_CLOSE_BUTTON_MARGIN:
34 // TODO(pkasting): The "- 4" here is a hack that matches the extra padding 34 // The amount of padding doesn't affect the button's position, so subtract
35 // in vector_icon_button.cc and should be removed when that padding is. 35 // it out here.
Peter Kasting 2017/03/29 22:39:42 Nit: Maybe clearer: constexpr int kVisibleM
Bret 2017/03/29 23:06:11 Done.
36 return (kHarmonyLayoutUnit / 2) - 4; 36 return (kHarmonyLayoutUnit / 2) -
37 GetMetric(Metric::VECTOR_IMAGE_BUTTON_PADDING);
37 case Metric::PANEL_CONTENT_MARGIN: 38 case Metric::PANEL_CONTENT_MARGIN:
38 return kHarmonyLayoutUnit; 39 return kHarmonyLayoutUnit;
39 case Metric::RELATED_BUTTON_HORIZONTAL_SPACING: 40 case Metric::RELATED_BUTTON_HORIZONTAL_SPACING:
40 return kHarmonyLayoutUnit / 2; 41 return kHarmonyLayoutUnit / 2;
41 case Metric::RELATED_CONTROL_HORIZONTAL_SPACING: 42 case Metric::RELATED_CONTROL_HORIZONTAL_SPACING:
42 return kHarmonyLayoutUnit; 43 return kHarmonyLayoutUnit;
43 case Metric::RELATED_CONTROL_HORIZONTAL_SPACING_SMALL: 44 case Metric::RELATED_CONTROL_HORIZONTAL_SPACING_SMALL:
44 return kHarmonyLayoutUnit; 45 return kHarmonyLayoutUnit;
45 case Metric::RELATED_CONTROL_VERTICAL_SPACING: 46 case Metric::RELATED_CONTROL_VERTICAL_SPACING:
46 return kHarmonyLayoutUnit / 2; 47 return kHarmonyLayoutUnit / 2;
47 case Metric::RELATED_CONTROL_VERTICAL_SPACING_SMALL: 48 case Metric::RELATED_CONTROL_VERTICAL_SPACING_SMALL:
48 return kHarmonyLayoutUnit / 2; 49 return kHarmonyLayoutUnit / 2;
49 case Metric::RELATED_LABEL_HORIZONTAL_SPACING: 50 case Metric::RELATED_LABEL_HORIZONTAL_SPACING:
50 return kHarmonyLayoutUnit; 51 return kHarmonyLayoutUnit;
51 case Metric::SUBSECTION_HORIZONTAL_INDENT: 52 case Metric::SUBSECTION_HORIZONTAL_INDENT:
52 return 0; 53 return 0;
53 case Metric::UNRELATED_CONTROL_HORIZONTAL_SPACING: 54 case Metric::UNRELATED_CONTROL_HORIZONTAL_SPACING:
54 return kHarmonyLayoutUnit; 55 return kHarmonyLayoutUnit;
55 case Metric::UNRELATED_CONTROL_HORIZONTAL_SPACING_LARGE: 56 case Metric::UNRELATED_CONTROL_HORIZONTAL_SPACING_LARGE:
56 return kHarmonyLayoutUnit; 57 return kHarmonyLayoutUnit;
57 case Metric::UNRELATED_CONTROL_VERTICAL_SPACING: 58 case Metric::UNRELATED_CONTROL_VERTICAL_SPACING:
58 return kHarmonyLayoutUnit; 59 return kHarmonyLayoutUnit;
59 case Metric::UNRELATED_CONTROL_VERTICAL_SPACING_LARGE: 60 case Metric::UNRELATED_CONTROL_VERTICAL_SPACING_LARGE:
60 return kHarmonyLayoutUnit; 61 return kHarmonyLayoutUnit;
62 case Metric::VECTOR_IMAGE_BUTTON_PADDING:
63 return 4;
Peter Kasting 2017/03/29 22:39:42 Nit: It seems like if we scaled up the layout unit
Bret 2017/03/29 23:06:11 I went back and forth on this. It's not really a l
61 } 64 }
62 NOTREACHED(); 65 NOTREACHED();
63 return 0; 66 return 0;
64 } 67 }
65 68
66 views::GridLayout::Alignment 69 views::GridLayout::Alignment
67 HarmonyLayoutDelegate::GetControlLabelGridAlignment() const { 70 HarmonyLayoutDelegate::GetControlLabelGridAlignment() const {
68 return views::GridLayout::LEADING; 71 return views::GridLayout::LEADING;
69 } 72 }
70 73
(...skipping 14 matching lines...) Expand all
85 case DialogWidth::SMALL: 88 case DialogWidth::SMALL:
86 return 320; 89 return 320;
87 case DialogWidth::MEDIUM: 90 case DialogWidth::MEDIUM:
88 return 448; 91 return 448;
89 case DialogWidth::LARGE: 92 case DialogWidth::LARGE:
90 return 512; 93 return 512;
91 } 94 }
92 NOTREACHED(); 95 NOTREACHED();
93 return 0; 96 return 0;
94 } 97 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/chrome_views_delegate.cc ('k') | chrome/browser/ui/views/harmony/layout_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698