Commit e2fbae6a authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Display tab throbber under favicon

Decoupling the two helps when displaying a blue favicon (such as
Facebook) under the loading-progress indicator. Similar concerns apply
in incognito over grey favicons. There are possibly similar concerns
when using themes.

This change also decouples favicon placeholder roundrect radius from
throbber since they are no longer overlapping eachother.

Bug: chromium:906605
Change-Id: Ie1959d0d447851f3cac3430e3d31b3b989bed263
Reviewed-on: https://chromium-review.googlesource.com/c/1341527Reviewed-by: default avatarEdward Jung <edwardjung@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609289}
parent 58e04035
......@@ -48,15 +48,13 @@ bool ShouldThemifyFaviconForUrl(const GURL& url) {
url.host_piece() != chrome::kChromeUIAppLauncherPageHost;
}
// Fraction of the icon height used for the throbber.
constexpr float kThrobberBoundsFraction = 1 / 8.0f;
// Returns a rect that covers the bottom quarter of |bounds|.
// Returns a rect in which the throbber should be painted.
gfx::RectF GetThrobberBounds(const gfx::Rect& bounds) {
gfx::RectF throbber_bounds(bounds);
const float height = bounds.height() * kThrobberBoundsFraction;
throbber_bounds.set_y(bounds.bottom() - height);
throbber_bounds.set_height(height);
constexpr float kThrobberHeightDp = 2;
// The throbber starts 1dp below the tab icon.
throbber_bounds.set_y(bounds.bottom() + 1);
throbber_bounds.set_height(kThrobberHeightDp);
return throbber_bounds;
}
......@@ -337,8 +335,8 @@ void TabIcon::PaintFaviconPlaceholder(gfx::Canvas* canvas,
flags.setStyle(cc::PaintFlags::kFill_Style);
flags.setAntiAlias(true);
canvas->DrawRoundRect(bounds, bounds.height() * kThrobberBoundsFraction,
flags);
constexpr float kFaviconPlaceholderRadiusDp = 4;
canvas->DrawRoundRect(bounds, kFaviconPlaceholderRadiusDp, flags);
}
bool TabIcon::MaybePaintFavicon(gfx::Canvas* canvas,
......
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