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

Unified 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: revert the stuff that got mixed in from another patch Created 3 years, 9 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
Index: chrome/browser/ui/views/harmony/harmony_layout_delegate.cc
diff --git a/chrome/browser/ui/views/harmony/harmony_layout_delegate.cc b/chrome/browser/ui/views/harmony/harmony_layout_delegate.cc
index 57f90992c019c21ba18590ebbbad9fd623c760fc..8afd20369d3b97654914b2ba6851b72ac51e2eea 100644
--- a/chrome/browser/ui/views/harmony/harmony_layout_delegate.cc
+++ b/chrome/browser/ui/views/harmony/harmony_layout_delegate.cc
@@ -30,10 +30,12 @@ int HarmonyLayoutDelegate::GetMetric(Metric metric) const {
2 * GetMetric(Metric::BUTTON_HORIZONTAL_PADDING);
case Metric::DIALOG_BUTTON_TOP_SPACING:
return kHarmonyLayoutUnit;
- case Metric::DIALOG_CLOSE_BUTTON_MARGIN:
- // TODO(pkasting): The "- 4" here is a hack that matches the extra padding
- // in vector_icon_button.cc and should be removed when that padding is.
- return (kHarmonyLayoutUnit / 2) - 4;
+ case Metric::DIALOG_CLOSE_BUTTON_MARGIN: {
+ constexpr int kVisibleMargin = kHarmonyLayoutUnit / 2;
+ // The visible margin is based on the unpadded size, so to get the actual
+ // margin we need to subtract out the padding.
+ return kVisibleMargin - GetMetric(Metric::VECTOR_IMAGE_BUTTON_PADDING);
+ }
case Metric::PANEL_CONTENT_MARGIN:
return kHarmonyLayoutUnit;
case Metric::RELATED_BUTTON_HORIZONTAL_SPACING:
@@ -58,6 +60,8 @@ int HarmonyLayoutDelegate::GetMetric(Metric metric) const {
return kHarmonyLayoutUnit;
case Metric::UNRELATED_CONTROL_VERTICAL_SPACING_LARGE:
return kHarmonyLayoutUnit;
+ case Metric::VECTOR_IMAGE_BUTTON_PADDING:
+ return 4;
}
NOTREACHED();
return 0;

Powered by Google App Engine
This is Rietveld 408576698