Commit 066563c7 authored by Tommy C. Li's avatar Tommy C. Li Committed by Commit Bot

Omnibox Refresh UI: Move security chip label left by 2dp for alignment

This moves the security chip label left by 2dp so it aligns with the
label-less separator, as well as URLs.

This improves the alignment of text with or without jog enabled. See
bug for screenshot.

Bug: 865546
Change-Id: I46918bc1dfe7ff43a8851206c92f2875fc1680f2
Reviewed-on: https://chromium-review.googlesource.com/1159686
Commit-Queue: Tommy Li <tommycli@chromium.org>
Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580363}
parent 8574fc3b
......@@ -434,13 +434,23 @@ int IconLabelBubbleView::GetInternalSpacing() const {
if (image_->GetPreferredSize().IsEmpty())
return 0;
// In touch, the icon-to-label spacing is a custom value.
constexpr int kIconLabelSpacingTouch = 4;
const int default_spacing =
ui::MaterialDesignController::IsTouchOptimizedUiEnabled()
? kIconLabelSpacingTouch
: GetLayoutConstant(LOCATION_BAR_ELEMENT_PADDING) +
GetLayoutInsets(LOCATION_BAR_ICON_INTERIOR_PADDING).left();
// Touch Optimized, Refresh, and Touch Refresh all have custom spacing values.
int default_spacing = 0;
switch (ui::MaterialDesignController::GetMode()) {
case ui::MaterialDesignController::MATERIAL_TOUCH_OPTIMIZED:
default_spacing = 4;
break;
case ui::MaterialDesignController::MATERIAL_REFRESH:
default_spacing = 8;
break;
case ui::MaterialDesignController::MATERIAL_TOUCH_REFRESH:
default_spacing = 10;
break;
default:
default_spacing =
GetLayoutConstant(LOCATION_BAR_ELEMENT_PADDING) +
GetLayoutInsets(LOCATION_BAR_ICON_INTERIOR_PADDING).left();
}
return default_spacing +
(ShouldShowExtraInternalSpace() ? GetPrefixedSeparatorWidth() : 0);
......
......@@ -166,8 +166,9 @@ class IconLabelBubbleView : public views::InkDropObserver,
// Spacing between the image and the label.
int GetInternalSpacing() const;
// Retrieves the width taken the separator including padding before the
// separator stroke, taking into account whether it is shown or not.
// Returns the width taken by the separator stroke and the before-padding.
// If the separator is not shown, and ShouldShowExtraEndSpace() is false,
// this returns 0.
int GetPrefixedSeparatorWidth() const;
// Padding after the separator.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment