Commit 449b8af3 authored by wutao's avatar wutao Committed by Chromium LUCI CQ

ambient: Middle align media text with icon

Bug: b/173754439
Test: manual
Change-Id: I9d825c2d9025b185af3d2382176cf62318848ab8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2566737Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Commit-Queue: Tao Wu <wutao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832643}
parent 688ad7ee
......@@ -30,6 +30,7 @@
#include "ui/gfx/skia_paint_util.h"
#include "ui/gfx/text_constants.h"
#include "ui/gfx/transform.h"
#include "ui/views/border.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h"
......@@ -244,9 +245,18 @@ void MediaStringView::InitLayout() {
ambient::util::GetDefaultFontlist()
.DeriveWithSizeDelta(kMediaStringFontSizeDip - kDefaultFontSizeDip)
.DeriveWithWeight(gfx::Font::Weight::MEDIUM));
media_text_->SetShadows(ambient::util::GetTextShadowValues());
media_text_->SetElideBehavior(gfx::ElideBehavior::NO_ELIDE);
auto shadow_values = ambient::util::GetTextShadowValues();
media_text_->SetShadows(shadow_values);
gfx::Insets shadow_insets = gfx::ShadowValue::GetMargin(shadow_values);
// Compensate the shadow insets to put the text middle align with the icon.
media_text_->SetBorder(views::CreateEmptyBorder(
/*top=*/-shadow_insets.bottom(),
/*left=*/0,
/*bottom=*/-shadow_insets.top(),
/*right=*/0));
BindMediaControllerObserver();
}
......
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