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

Side by Side Diff: chrome/browser/ui/layout_constants.cc

Issue 2464063002: Revert of Some more pre-material cleanups (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/layout_constants.h ('k') | chrome/browser/ui/toolbar/toolbar_actions_bar.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/layout_constants.h" 5 #include "chrome/browser/ui/layout_constants.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "ui/base/material_design/material_design_controller.h" 9 #include "ui/base/material_design/material_design_controller.h"
10 10
11 int GetLayoutConstant(LayoutConstant constant) { 11 int GetLayoutConstant(LayoutConstant constant) {
12 const int kFindBarVerticalOffset[] = {6, 6}; 12 const int kFindBarVerticalOffset[] = {1, 6, 6};
13 const int kLocationBarBorderThickness[] = {1, 1}; 13 const int kLocationBarBorderThickness[] = {2, 1, 1};
14 const int kLocationBarBubbleFontVerticalPadding[] = {2, 4}; 14 const int kLocationBarBubbleFontVerticalPadding[] = {1, 2, 4};
15 const int kLocationBarBubbleVerticalPadding[] = {3, 3}; 15 const int kLocationBarBubbleHorizontalPadding[] = {1, 0, 0};
16 const int kLocationBarBubbleAnchorVerticalInset[] = {6, 8}; 16 const int kLocationBarBubbleVerticalPadding[] = {1, 3, 3};
17 const int kLocationBarHeight[] = {28, 32}; 17 const int kLocationBarBubbleAnchorVerticalInset[] = {5, 6, 8};
18 const int kLocationBarHorizontalPadding[] = {6, 6}; 18 const int kLocationBarHeight[] = {27, 28, 32};
19 const int kLocationBarVerticalPadding[] = {1, 1}; 19 const int kLocationBarHorizontalPadding[] = {3, 6, 6};
20 const int kOmniboxFontPixelSize[] = {14, 14}; 20 const int kLocationBarVerticalPadding[] = {0, 1, 1};
21 const int kTabFaviconTitleSpacing[] = {6, 6}; 21 const int kOmniboxFontPixelSize[] = {16, 14, 14};
22 const int kTabHeight[] = {29, 33}; 22 const int kTabFaviconTitleSpacing[] = {4, 6, 6};
23 const int kTabPinnedContentWidth[] = {23, 23}; 23 const int kTabHeight[] = {29, 29, 33};
24 const int kTabstripNewTabButtonOverlap[] = {5, 6}; 24 const int kTabPinnedContentWidth[] = {25, 23, 23};
25 const int kTabstripTabOverlap[] = {16, 16}; 25 #if defined(OS_MACOSX)
26 const int kToolbarStandardSpacing[] = {4, 8}; 26 const int kTabstripNewTabButtonOverlap[] = {8, 5, 6};
27 const int kToolbarElementPadding[] = {0, 8}; 27 const int kTabstripTabOverlap[] = {19, 16, 16};
28 const int kToolbarLocationBarRightPadding[] = {4, 8}; 28 #else
29 const int kTabstripNewTabButtonOverlap[] = {11, 5, 6};
30 const int kTabstripTabOverlap[] = {26, 16, 16};
31 #endif
32 const int kToolbarStandardSpacing[] = {3, 4, 8};
33 const int kToolbarElementPadding[] = {0, 0, 8};
34 const int kToolbarLocationBarRightPadding[] = {0, 4, 8};
29 35
30 const int mode = ui::MaterialDesignController::GetMode(); 36 const int mode = ui::MaterialDesignController::GetMode();
31 switch (constant) { 37 switch (constant) {
32 case FIND_BAR_TOOLBAR_OVERLAP: 38 case FIND_BAR_TOOLBAR_OVERLAP:
33 return kFindBarVerticalOffset[mode]; 39 return kFindBarVerticalOffset[mode];
34 case LOCATION_BAR_BORDER_THICKNESS: 40 case LOCATION_BAR_BORDER_THICKNESS:
35 return kLocationBarBorderThickness[mode]; 41 return kLocationBarBorderThickness[mode];
36 case LOCATION_BAR_BUBBLE_FONT_VERTICAL_PADDING: 42 case LOCATION_BAR_BUBBLE_FONT_VERTICAL_PADDING:
37 return kLocationBarBubbleFontVerticalPadding[mode]; 43 return kLocationBarBubbleFontVerticalPadding[mode];
44 case LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING:
45 return kLocationBarBubbleHorizontalPadding[mode];
38 case LOCATION_BAR_BUBBLE_VERTICAL_PADDING: 46 case LOCATION_BAR_BUBBLE_VERTICAL_PADDING:
39 return kLocationBarBubbleVerticalPadding[mode]; 47 return kLocationBarBubbleVerticalPadding[mode];
40 case LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET: 48 case LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET:
41 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) 49 if (ui::MaterialDesignController::IsSecondaryUiMaterial())
42 return 1; 50 return 1;
43 return kLocationBarBubbleAnchorVerticalInset[mode]; 51 return kLocationBarBubbleAnchorVerticalInset[mode];
44 case LOCATION_BAR_HEIGHT: 52 case LOCATION_BAR_HEIGHT:
45 return kLocationBarHeight[mode]; 53 return kLocationBarHeight[mode];
46 case LOCATION_BAR_HORIZONTAL_PADDING: 54 case LOCATION_BAR_HORIZONTAL_PADDING:
47 return kLocationBarHorizontalPadding[mode]; 55 return kLocationBarHorizontalPadding[mode];
(...skipping 16 matching lines...) Expand all
64 case TOOLBAR_LOCATION_BAR_RIGHT_PADDING: 72 case TOOLBAR_LOCATION_BAR_RIGHT_PADDING:
65 return kToolbarLocationBarRightPadding[mode]; 73 return kToolbarLocationBarRightPadding[mode];
66 case TOOLBAR_STANDARD_SPACING: 74 case TOOLBAR_STANDARD_SPACING:
67 return kToolbarStandardSpacing[mode]; 75 return kToolbarStandardSpacing[mode];
68 } 76 }
69 NOTREACHED(); 77 NOTREACHED();
70 return 0; 78 return 0;
71 } 79 }
72 80
73 gfx::Insets GetLayoutInsets(LayoutInset inset) { 81 gfx::Insets GetLayoutInsets(LayoutInset inset) {
74 const int kAvatarLeftPadding[] = {4, 4}; 82 const int kAvatarLeftPadding[] = {2, 4, 4};
75 const int kAvatarRightPadding[] = {4, 4}; 83 const int kAvatarRightPadding[] = {-6, 4, 4};
76 const int kAvatarBottomPadding[] = {4, 4}; 84 const int kAvatarBottomPadding[] = {2, 4, 4};
77 const int kOmniboxDropdownIconPadding[] = {4, 8}; 85 const int kOmniboxDropdownIconPadding[] = {2, 4, 8};
78 const int kOmniboxDropdownPadding[] = {4, 4}; 86 const int kOmniboxDropdownPadding[] = {3, 4, 4};
79 const int kOmniboxDropdownTextPadding[] = {3, 3}; 87 const int kOmniboxDropdownTextPadding[] = {3, 3, 3};
80 const int kTabBottomPadding[] = {1, 1}; 88 const int kTabBottomPadding[] = {2, 1, 1};
81 const int kTabHorizontalPadding[] = {16, 18}; 89 const int kTabHorizontalPadding[] = {20, 16, 18};
82 const int kTabTopPadding[] = {1, 1}; 90 const int kTabTopPadding[] = {4, 1, 1};
83 const int kToolbarBottomPadding[] = {5, 5}; 91 const int kToolbarBottomPadding[] = {5, 5, 5};
84 const int kToolbarButtonPadding[] = {6, 6}; 92 const int kToolbarButtonPadding[] = {2, 6, 6};
85 const int kToolbarLeftPadding[] = {4, 8}; 93 const int kToolbarLeftPadding[] = {3, 4, 8};
86 const int kToolbarRightPadding[] = {4, 8}; 94 const int kToolbarRightPadding[] = {2, 4, 8};
87 const int kToolbarTopPadding[] = {4, 4}; 95 const int kToolbarTopPadding[] = {5, 4, 4};
88 96
89 const int mode = ui::MaterialDesignController::GetMode(); 97 const int mode = ui::MaterialDesignController::GetMode();
90 switch (inset) { 98 switch (inset) {
91 case AVATAR_ICON: 99 case AVATAR_ICON:
92 return gfx::Insets(0, kAvatarLeftPadding[mode], 100 return gfx::Insets(0, kAvatarLeftPadding[mode],
93 kAvatarBottomPadding[mode], kAvatarRightPadding[mode]); 101 kAvatarBottomPadding[mode], kAvatarRightPadding[mode]);
94 case OMNIBOX_DROPDOWN: 102 case OMNIBOX_DROPDOWN:
95 return gfx::Insets(kOmniboxDropdownPadding[mode], 0); 103 return gfx::Insets(kOmniboxDropdownPadding[mode], 0);
96 case OMNIBOX_DROPDOWN_ICON: 104 case OMNIBOX_DROPDOWN_ICON:
97 return gfx::Insets(kOmniboxDropdownIconPadding[mode], 0); 105 return gfx::Insets(kOmniboxDropdownIconPadding[mode], 0);
98 case OMNIBOX_DROPDOWN_TEXT: 106 case OMNIBOX_DROPDOWN_TEXT:
99 return gfx::Insets(kOmniboxDropdownTextPadding[mode], 0); 107 return gfx::Insets(kOmniboxDropdownTextPadding[mode], 0);
100 case TAB: 108 case TAB:
101 return gfx::Insets(kTabTopPadding[mode], kTabHorizontalPadding[mode], 109 return gfx::Insets(kTabTopPadding[mode], kTabHorizontalPadding[mode],
102 kTabBottomPadding[mode], kTabHorizontalPadding[mode]); 110 kTabBottomPadding[mode], kTabHorizontalPadding[mode]);
103 case TOOLBAR: 111 case TOOLBAR:
104 return gfx::Insets(kToolbarTopPadding[mode], kToolbarLeftPadding[mode], 112 return gfx::Insets(kToolbarTopPadding[mode], kToolbarLeftPadding[mode],
105 kToolbarBottomPadding[mode], 113 kToolbarBottomPadding[mode],
106 kToolbarRightPadding[mode]); 114 kToolbarRightPadding[mode]);
107 case TOOLBAR_BUTTON: 115 case TOOLBAR_BUTTON:
108 return gfx::Insets(kToolbarButtonPadding[mode]); 116 return gfx::Insets(kToolbarButtonPadding[mode]);
109 } 117 }
110 NOTREACHED(); 118 NOTREACHED();
111 return gfx::Insets(); 119 return gfx::Insets();
112 } 120 }
113 121
114 gfx::Size GetLayoutSize(LayoutSize size) { 122 gfx::Size GetLayoutSize(LayoutSize size) {
115 const int kNewTabButtonWidth[] = {36, 39}; 123 const int kNewTabButtonWidth[] = {34, 36, 39};
116 const int kNewTabButtonHeight[] = {18, 21}; 124 const int kNewTabButtonHeight[] = {18, 18, 21};
117 125
118 const int mode = ui::MaterialDesignController::GetMode(); 126 const int mode = ui::MaterialDesignController::GetMode();
119 switch (size) { 127 switch (size) {
120 case NEW_TAB_BUTTON: 128 case NEW_TAB_BUTTON:
121 return gfx::Size(kNewTabButtonWidth[mode], kNewTabButtonHeight[mode]); 129 return gfx::Size(kNewTabButtonWidth[mode], kNewTabButtonHeight[mode]);
122 } 130 }
123 NOTREACHED(); 131 NOTREACHED();
124 return gfx::Size(); 132 return gfx::Size();
125 } 133 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/layout_constants.h ('k') | chrome/browser/ui/toolbar/toolbar_actions_bar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698