Commit 0f7c9348 authored by Jazz Xu's avatar Jazz Xu Committed by Commit Bot

GMC: Center artwork.

This CL center the artwork in Global Media Controls.

Bug: 1031133
Change-Id: Ibfa6b11beeff4720143922d3d4affe75cb3bcbe0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2107600Reviewed-by: default avatarTommy Steimel <steimel@chromium.org>
Commit-Queue: Jazz Xu <jazzhsu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755182}
parent bb869dc4
...@@ -386,11 +386,17 @@ gfx::Rect MediaNotificationBackground::GetArtworkBounds( ...@@ -386,11 +386,17 @@ gfx::Rect MediaNotificationBackground::GetArtworkBounds(
const views::View& owner) const { const views::View& owner) const {
const gfx::Rect& view_bounds = owner.GetContentsBounds(); const gfx::Rect& view_bounds = owner.GetContentsBounds();
int width = GetArtworkWidth(view_bounds.size()); int width = GetArtworkWidth(view_bounds.size());
int visible_width = GetArtworkVisibleWidth(view_bounds.size());
// This offset is for centering artwork if artwork visible width is smaller
// than artwork width.
int horizontal_offset = (width - visible_width) / 2;
// The artwork should be positioned on the far right hand side of the // The artwork should be positioned on the far right hand side of the
// notification and be the same height. // notification and be the same height.
return owner.GetMirroredRect( return owner.GetMirroredRect(
gfx::Rect(view_bounds.right() - width, 0, width, view_bounds.height())); gfx::Rect(view_bounds.right() - width + horizontal_offset, 0, width,
view_bounds.height()));
} }
gfx::Rect MediaNotificationBackground::GetFilledBackgroundBounds( gfx::Rect MediaNotificationBackground::GetFilledBackgroundBounds(
......
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