Skip to content

Commit

Permalink
[Cherry Pick] Update tab discard ring to use finalized color
Browse files Browse the repository at this point in the history
The performance round 2 discard ring color was temporarily hard coded
to gray. This CL updates the ring color to use the color id for state
disabled which is approved by UX.

Before this CL: https://screenshot.googleplex.com/C2fikcbDRrfGKi5.png
After this CL: https://screenshot.googleplex.com/6naFQnpJpjDKTcp.png

(cherry picked from commit 7701365)

Fixed: 1456530
Change-Id: I154bfa70ee04e252a961c73eb3be218918bd6753
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4633624
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Steven Luong <stluong@chromium.org>
Reviewed-by: Taylor Bergquist <tbergquist@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1163797}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4657778
Auto-Submit: Steven Luong <stluong@chromium.org>
Commit-Queue: Taylor Bergquist <tbergquist@chromium.org>
Cr-Commit-Position: refs/branch-heads/5845@{#330}
Cr-Branched-From: 5a5dff6-refs/heads/main@{#1160321}
  • Loading branch information
stluong authored and Chromium LUCI CQ committed Jul 5, 2023
1 parent 3c00bec commit 6d4228b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ std::vector<FaviconScreenShotTestConfig> HighEfficiencyTestConfig() {
"FadeFullSizedFaviconOnDiscard", "4492205"},
{performance_manager::features::DiscardTabTreatmentOptions::
kFadeSmallFaviconWithRing,
"FadeSmallFaviconOnDiscard", "4492205"}};
"FadeSmallFaviconOnDiscard", "4633624"}};
}

INSTANTIATE_TEST_SUITE_P(All,
Expand Down
12 changes: 9 additions & 3 deletions chrome/browser/ui/views/tabs/tab_icon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -306,14 +306,20 @@ void TabIcon::PaintDiscardRingAndIcon(gfx::Canvas* canvas,
MaybePaintFavicon(canvas, icon, bounds);

// Painting Discard Ring
const ui::ColorProvider* color_provider = GetColorProvider();
SkColor ring_color = color_provider->GetColor(ui::kColorSysStateDisabled);
float ring_color_opacity =
static_cast<float>(SkColorGetA(ring_color)) / SK_AlphaOPAQUE;
cc::PaintFlags flags;
flags.setColor(SK_ColorGRAY);
flags.setColor(ring_color);
flags.setStrokeCap(cc::PaintFlags::kRound_Cap);
flags.setStrokeWidth(kDiscardRingStrokeWidthDp);
flags.setStyle(cc::PaintFlags::kStroke_Style);
flags.setAntiAlias(true);
flags.setAlphaf((float)gfx::Tween::CalculateValue(
gfx::Tween::EASE_IN, tab_discard_animation_.GetCurrentValue()));
flags.setAlphaf(static_cast<float>(
gfx::Tween::CalculateValue(gfx::Tween::EASE_IN,
tab_discard_animation_.GetCurrentValue()) *
ring_color_opacity));

// Draw the large segment centered on the left side.
const int large_segment_start_angle = 180 - kLargeSegmentSweepAngle / 2;
Expand Down

0 comments on commit 6d4228b

Please sign in to comment.