OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_provider.h" | 5 #include "chrome/browser/ui/views/harmony/harmony_layout_provider.h" |
6 | 6 |
7 gfx::Insets HarmonyLayoutProvider::GetInsetsMetric(int metric) const { | 7 gfx::Insets HarmonyLayoutProvider::GetInsetsMetric(int metric) const { |
8 DCHECK_LT(metric, views::VIEWS_INSETS_MAX); | 8 DCHECK_LT(metric, views::VIEWS_INSETS_MAX); |
9 switch (metric) { | 9 switch (metric) { |
10 case views::INSETS_DIALOG_BUTTON: | 10 case views::INSETS_DIALOG_BUTTON: |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 return kHarmonyLayoutUnit; | 50 return kHarmonyLayoutUnit; |
51 case DISTANCE_DIALOG_BUTTON_TOP: | 51 case DISTANCE_DIALOG_BUTTON_TOP: |
52 return kHarmonyLayoutUnit; | 52 return kHarmonyLayoutUnit; |
53 case views::DISTANCE_DIALOG_BUTTON_MINIMUM_WIDTH: | 53 case views::DISTANCE_DIALOG_BUTTON_MINIMUM_WIDTH: |
54 case DISTANCE_BUTTON_MINIMUM_WIDTH: | 54 case DISTANCE_BUTTON_MINIMUM_WIDTH: |
55 // Minimum label size plus padding. | 55 // Minimum label size plus padding. |
56 return 2 * kHarmonyLayoutUnit + | 56 return 2 * kHarmonyLayoutUnit + |
57 2 * GetDistanceMetric(views::DISTANCE_BUTTON_HORIZONTAL_PADDING); | 57 2 * GetDistanceMetric(views::DISTANCE_BUTTON_HORIZONTAL_PADDING); |
58 case views::DISTANCE_BUTTON_HORIZONTAL_PADDING: | 58 case views::DISTANCE_BUTTON_HORIZONTAL_PADDING: |
59 return kHarmonyLayoutUnit; | 59 return kHarmonyLayoutUnit; |
60 case DISTANCE_BUTTON_MAX_LINKABLE_WIDTH: | 60 case views::DISTANCE_BUTTON_MAX_LINKABLE_WIDTH: |
61 return kHarmonyLayoutUnit * 8; | 61 return kHarmonyLayoutUnit * 7; |
62 case DISTANCE_RELATED_LABEL_HORIZONTAL: | 62 case DISTANCE_RELATED_LABEL_HORIZONTAL: |
63 return kHarmonyLayoutUnit; | 63 return kHarmonyLayoutUnit; |
64 case DISTANCE_SUBSECTION_HORIZONTAL_INDENT: | 64 case DISTANCE_SUBSECTION_HORIZONTAL_INDENT: |
65 return 0; | 65 return 0; |
66 case DISTANCE_PANEL_CONTENT_MARGIN: | 66 case DISTANCE_PANEL_CONTENT_MARGIN: |
67 return kHarmonyLayoutUnit; | 67 return kHarmonyLayoutUnit; |
68 case DISTANCE_UNRELATED_CONTROL_HORIZONTAL: | 68 case DISTANCE_UNRELATED_CONTROL_HORIZONTAL: |
69 return kHarmonyLayoutUnit; | 69 return kHarmonyLayoutUnit; |
70 case DISTANCE_UNRELATED_CONTROL_HORIZONTAL_LARGE: | 70 case DISTANCE_UNRELATED_CONTROL_HORIZONTAL_LARGE: |
71 return kHarmonyLayoutUnit; | 71 return kHarmonyLayoutUnit; |
(...skipping 30 matching lines...) Expand all Loading... |
102 } | 102 } |
103 | 103 |
104 return ((min_width + kHarmonyLayoutUnit - 1) / kHarmonyLayoutUnit) * | 104 return ((min_width + kHarmonyLayoutUnit - 1) / kHarmonyLayoutUnit) * |
105 kHarmonyLayoutUnit; | 105 kHarmonyLayoutUnit; |
106 } | 106 } |
107 | 107 |
108 const views::TypographyProvider& HarmonyLayoutProvider::GetTypographyProvider() | 108 const views::TypographyProvider& HarmonyLayoutProvider::GetTypographyProvider() |
109 const { | 109 const { |
110 return typography_provider_; | 110 return typography_provider_; |
111 } | 111 } |
OLD | NEW |