Chromium Code Reviews| OLD | NEW |
|---|---|
| 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[] = {1, 6, 6}; | 12 const int kFindBarVerticalOffset[] = {6, 6}; |
| 13 const int kLocationBarBorderThickness[] = {2, 1, 1}; | 13 const int kLocationBarBorderThickness[] = {1, 1}; |
| 14 const int kLocationBarBubbleFontVerticalPadding[] = {1, 2, 4}; | 14 const int kLocationBarBubbleFontVerticalPadding[] = {2, 4}; |
|
Evan Stade
2016/10/24 19:09:40
what do we think should happen to the layout const
Peter Kasting
2016/10/24 23:49:56
Things that are only used in one place, whether th
Evan Stade
2016/10/25 16:22:57
this plan soudns fine, but for now (for the purpos
Peter Kasting
2016/10/27 22:16:37
I'm cool with that. You've been cleaning all the
| |
| 15 const int kLocationBarBubbleHorizontalPadding[] = {1, 0, 0}; | 15 const int kLocationBarBubbleHorizontalPadding[] = {0, 0}; |
|
Evan Stade
2016/10/24 19:09:41
this one definitely seems like it should just die
Peter Kasting
2016/10/24 23:49:56
Yep.
Evan Stade
2016/10/25 16:22:56
Done.
| |
| 16 const int kLocationBarBubbleVerticalPadding[] = {1, 3, 3}; | 16 const int kLocationBarBubbleVerticalPadding[] = {3, 3}; |
| 17 const int kLocationBarBubbleAnchorVerticalInset[] = {5, 6, 8}; | 17 const int kLocationBarBubbleAnchorVerticalInset[] = {6, 8}; |
| 18 const int kLocationBarHeight[] = {27, 28, 32}; | 18 const int kLocationBarHeight[] = {28, 32}; |
| 19 const int kLocationBarHorizontalPadding[] = {3, 6, 6}; | 19 const int kLocationBarHorizontalPadding[] = {6, 6}; |
| 20 const int kLocationBarVerticalPadding[] = {0, 1, 1}; | 20 const int kLocationBarVerticalPadding[] = {1, 1}; |
| 21 const int kOmniboxFontPixelSize[] = {16, 14, 14}; | 21 const int kOmniboxFontPixelSize[] = {14, 14}; |
| 22 const int kTabFaviconTitleSpacing[] = {4, 6, 6}; | 22 const int kTabFaviconTitleSpacing[] = {6, 6}; |
| 23 const int kTabHeight[] = {29, 29, 33}; | 23 const int kTabHeight[] = {29, 33}; |
| 24 const int kTabPinnedContentWidth[] = {25, 23, 23}; | 24 const int kTabPinnedContentWidth[] = {23, 23}; |
| 25 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
|
Evan Stade
2016/10/24 19:09:40
the mac/non mac distinction is no longer important
Peter Kasting
2016/10/24 23:49:56
Yup, rip out
Evan Stade
2016/10/25 16:22:57
Done.
| |
| 26 const int kTabstripNewTabButtonOverlap[] = {8, 5, 6}; | 26 const int kTabstripNewTabButtonOverlap[] = {5, 6}; |
| 27 const int kTabstripTabOverlap[] = {19, 16, 16}; | 27 const int kTabstripTabOverlap[] = {16, 16}; |
| 28 #else | 28 #else |
| 29 const int kTabstripNewTabButtonOverlap[] = {11, 5, 6}; | 29 const int kTabstripNewTabButtonOverlap[] = {5, 6}; |
| 30 const int kTabstripTabOverlap[] = {26, 16, 16}; | 30 const int kTabstripTabOverlap[] = {16, 16}; |
| 31 #endif | 31 #endif |
| 32 const int kToolbarStandardSpacing[] = {3, 4, 8}; | 32 const int kToolbarStandardSpacing[] = {4, 8}; |
| 33 const int kToolbarElementPadding[] = {0, 0, 8}; | 33 const int kToolbarElementPadding[] = {0, 8}; |
| 34 const int kToolbarLocationBarRightPadding[] = {0, 4, 8}; | 34 const int kToolbarLocationBarRightPadding[] = {4, 8}; |
|
Evan Stade
2016/10/24 19:09:40
perhaps this can/should be combined with ToolbarSt
Peter Kasting
2016/10/24 23:49:56
Probably. In general I'd try to combine constants
Peter Kasting
2016/10/27 22:16:37
Do later?
| |
| 35 | 35 |
| 36 const int mode = ui::MaterialDesignController::GetMode(); | 36 const int mode = ui::MaterialDesignController::GetMode(); |
| 37 switch (constant) { | 37 switch (constant) { |
| 38 case FIND_BAR_TOOLBAR_OVERLAP: | 38 case FIND_BAR_TOOLBAR_OVERLAP: |
| 39 return kFindBarVerticalOffset[mode]; | 39 return kFindBarVerticalOffset[mode]; |
| 40 case LOCATION_BAR_BORDER_THICKNESS: | 40 case LOCATION_BAR_BORDER_THICKNESS: |
| 41 return kLocationBarBorderThickness[mode]; | 41 return kLocationBarBorderThickness[mode]; |
| 42 case LOCATION_BAR_BUBBLE_FONT_VERTICAL_PADDING: | 42 case LOCATION_BAR_BUBBLE_FONT_VERTICAL_PADDING: |
| 43 return kLocationBarBubbleFontVerticalPadding[mode]; | 43 return kLocationBarBubbleFontVerticalPadding[mode]; |
| 44 case LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING: | 44 case LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING: |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 72 case TOOLBAR_LOCATION_BAR_RIGHT_PADDING: | 72 case TOOLBAR_LOCATION_BAR_RIGHT_PADDING: |
| 73 return kToolbarLocationBarRightPadding[mode]; | 73 return kToolbarLocationBarRightPadding[mode]; |
| 74 case TOOLBAR_STANDARD_SPACING: | 74 case TOOLBAR_STANDARD_SPACING: |
| 75 return kToolbarStandardSpacing[mode]; | 75 return kToolbarStandardSpacing[mode]; |
| 76 } | 76 } |
| 77 NOTREACHED(); | 77 NOTREACHED(); |
| 78 return 0; | 78 return 0; |
| 79 } | 79 } |
| 80 | 80 |
| 81 gfx::Insets GetLayoutInsets(LayoutInset inset) { | 81 gfx::Insets GetLayoutInsets(LayoutInset inset) { |
| 82 const int kAvatarLeftPadding[] = {2, 4, 4}; | 82 const int kAvatarLeftPadding[] = {4, 4}; |
| 83 const int kAvatarRightPadding[] = {-6, 4, 4}; | 83 const int kAvatarRightPadding[] = {4, 4}; |
| 84 const int kAvatarBottomPadding[] = {2, 4, 4}; | 84 const int kAvatarBottomPadding[] = {4, 4}; |
| 85 const int kOmniboxDropdownIconPadding[] = {2, 4, 8}; | 85 const int kOmniboxDropdownIconPadding[] = {4, 8}; |
| 86 const int kOmniboxDropdownPadding[] = {3, 4, 4}; | 86 const int kOmniboxDropdownPadding[] = {4, 4}; |
| 87 const int kOmniboxDropdownTextPadding[] = {3, 3, 3}; | 87 const int kOmniboxDropdownTextPadding[] = {3, 3}; |
| 88 const int kTabBottomPadding[] = {2, 1, 1}; | 88 const int kTabBottomPadding[] = {1, 1}; |
| 89 const int kTabHorizontalPadding[] = {20, 16, 18}; | 89 const int kTabHorizontalPadding[] = {16, 18}; |
| 90 const int kTabTopPadding[] = {4, 1, 1}; | 90 const int kTabTopPadding[] = {1, 1}; |
| 91 const int kToolbarBottomPadding[] = {5, 5, 5}; | 91 const int kToolbarBottomPadding[] = {5, 5}; |
| 92 const int kToolbarButtonPadding[] = {2, 6, 6}; | 92 const int kToolbarButtonPadding[] = {6, 6}; |
| 93 const int kToolbarLeftPadding[] = {3, 4, 8}; | 93 const int kToolbarLeftPadding[] = {4, 8}; |
| 94 const int kToolbarRightPadding[] = {2, 4, 8}; | 94 const int kToolbarRightPadding[] = {4, 8}; |
| 95 const int kToolbarTopPadding[] = {5, 4, 4}; | 95 const int kToolbarTopPadding[] = {4, 4}; |
| 96 | 96 |
| 97 const int mode = ui::MaterialDesignController::GetMode(); | 97 const int mode = ui::MaterialDesignController::GetMode(); |
| 98 switch (inset) { | 98 switch (inset) { |
| 99 case AVATAR_ICON: | 99 case AVATAR_ICON: |
| 100 return gfx::Insets(0, kAvatarLeftPadding[mode], | 100 return gfx::Insets(0, kAvatarLeftPadding[mode], |
| 101 kAvatarBottomPadding[mode], kAvatarRightPadding[mode]); | 101 kAvatarBottomPadding[mode], kAvatarRightPadding[mode]); |
| 102 case OMNIBOX_DROPDOWN: | 102 case OMNIBOX_DROPDOWN: |
| 103 return gfx::Insets(kOmniboxDropdownPadding[mode], 0); | 103 return gfx::Insets(kOmniboxDropdownPadding[mode], 0); |
| 104 case OMNIBOX_DROPDOWN_ICON: | 104 case OMNIBOX_DROPDOWN_ICON: |
| 105 return gfx::Insets(kOmniboxDropdownIconPadding[mode], 0); | 105 return gfx::Insets(kOmniboxDropdownIconPadding[mode], 0); |
| 106 case OMNIBOX_DROPDOWN_TEXT: | 106 case OMNIBOX_DROPDOWN_TEXT: |
| 107 return gfx::Insets(kOmniboxDropdownTextPadding[mode], 0); | 107 return gfx::Insets(kOmniboxDropdownTextPadding[mode], 0); |
| 108 case TAB: | 108 case TAB: |
| 109 return gfx::Insets(kTabTopPadding[mode], kTabHorizontalPadding[mode], | 109 return gfx::Insets(kTabTopPadding[mode], kTabHorizontalPadding[mode], |
| 110 kTabBottomPadding[mode], kTabHorizontalPadding[mode]); | 110 kTabBottomPadding[mode], kTabHorizontalPadding[mode]); |
| 111 case TOOLBAR: | 111 case TOOLBAR: |
| 112 return gfx::Insets(kToolbarTopPadding[mode], kToolbarLeftPadding[mode], | 112 return gfx::Insets(kToolbarTopPadding[mode], kToolbarLeftPadding[mode], |
| 113 kToolbarBottomPadding[mode], | 113 kToolbarBottomPadding[mode], |
| 114 kToolbarRightPadding[mode]); | 114 kToolbarRightPadding[mode]); |
| 115 case TOOLBAR_BUTTON: | 115 case TOOLBAR_BUTTON: |
| 116 return gfx::Insets(kToolbarButtonPadding[mode]); | 116 return gfx::Insets(kToolbarButtonPadding[mode]); |
| 117 } | 117 } |
| 118 NOTREACHED(); | 118 NOTREACHED(); |
| 119 return gfx::Insets(); | 119 return gfx::Insets(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 gfx::Size GetLayoutSize(LayoutSize size) { | 122 gfx::Size GetLayoutSize(LayoutSize size) { |
| 123 const int kNewTabButtonWidth[] = {34, 36, 39}; | 123 const int kNewTabButtonWidth[] = {36, 39}; |
| 124 const int kNewTabButtonHeight[] = {18, 18, 21}; | 124 const int kNewTabButtonHeight[] = {18, 21}; |
| 125 | 125 |
| 126 const int mode = ui::MaterialDesignController::GetMode(); | 126 const int mode = ui::MaterialDesignController::GetMode(); |
| 127 switch (size) { | 127 switch (size) { |
| 128 case NEW_TAB_BUTTON: | 128 case NEW_TAB_BUTTON: |
| 129 return gfx::Size(kNewTabButtonWidth[mode], kNewTabButtonHeight[mode]); | 129 return gfx::Size(kNewTabButtonWidth[mode], kNewTabButtonHeight[mode]); |
| 130 } | 130 } |
| 131 NOTREACHED(); | 131 NOTREACHED(); |
| 132 return gfx::Size(); | 132 return gfx::Size(); |
| 133 } | 133 } |
| OLD | NEW |