Commit eeddc1fc authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Browser Themes: always paint an opaque BG color behind toolbar images

for both the active tab and the toolbar. This matches the bookmarks
bar, i.e. PaintBackgroundAttachedMode.

Bug: 866974
Change-Id: I3a86d2330bf09903f74359e433a4165e3e4d3e8e
Reviewed-on: https://chromium-review.googlesource.com/1171216
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582350}
parent d9cad56f
...@@ -1379,17 +1379,23 @@ void Tab::PaintTabBackgroundFill(gfx::Canvas* canvas, ...@@ -1379,17 +1379,23 @@ void Tab::PaintTabBackgroundFill(gfx::Canvas* canvas,
const float scale = canvas->UndoDeviceScaleFactor(); const float scale = canvas->UndoDeviceScaleFactor();
canvas->ClipPath(fill_path, true); canvas->ClipPath(fill_path, true);
// In the active case, always fill the tab with its bg color first in case the
// image is transparent. In the inactive case, the image is guaranteed to be
// opaque, so it's only necessary to fill the color when there's no image.
if (active || !fill_id) {
cc::PaintFlags flags;
flags.setAntiAlias(true);
flags.setColor(active ? active_color : inactive_color);
canvas->DrawRect(gfx::ScaleToEnclosingRect(GetLocalBounds(), scale), flags);
}
if (fill_id) { if (fill_id) {
gfx::ScopedCanvas scale_scoper(canvas); gfx::ScopedCanvas scale_scoper(canvas);
canvas->sk_canvas()->scale(scale, scale); canvas->sk_canvas()->scale(scale, scale);
canvas->TileImageInt(*GetThemeProvider()->GetImageSkiaNamed(fill_id), canvas->TileImageInt(*GetThemeProvider()->GetImageSkiaNamed(fill_id),
GetMirroredX() + background_offset_, 0, 0, y_inset, GetMirroredX() + background_offset_, 0, 0, y_inset,
width(), height()); width(), height());
} else {
cc::PaintFlags flags;
flags.setAntiAlias(true);
flags.setColor(active ? active_color : inactive_color);
canvas->DrawRect(gfx::ScaleToEnclosingRect(GetLocalBounds(), scale), flags);
} }
if (paint_hover_effect) { if (paint_hover_effect) {
......
...@@ -601,6 +601,11 @@ void ToolbarView::OnPaintBackground(gfx::Canvas* canvas) { ...@@ -601,6 +601,11 @@ void ToolbarView::OnPaintBackground(gfx::Canvas* canvas) {
const ui::ThemeProvider* tp = GetThemeProvider(); const ui::ThemeProvider* tp = GetThemeProvider();
// Always fill the toolbar with its bg color first in case the image is
// transparent.
canvas->FillRect(GetLocalBounds(),
tp->GetColor(ThemeProperties::COLOR_TOOLBAR));
if (tp->HasCustomImage(IDR_THEME_TOOLBAR)) { if (tp->HasCustomImage(IDR_THEME_TOOLBAR)) {
const int x_offset = const int x_offset =
GetMirroredX() + browser_view_->GetMirroredX() + GetMirroredX() + browser_view_->GetMirroredX() +
...@@ -610,9 +615,6 @@ void ToolbarView::OnPaintBackground(gfx::Canvas* canvas) { ...@@ -610,9 +615,6 @@ void ToolbarView::OnPaintBackground(gfx::Canvas* canvas) {
GetLayoutConstant(TABSTRIP_TOOLBAR_OVERLAP); GetLayoutConstant(TABSTRIP_TOOLBAR_OVERLAP);
canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR), x_offset, canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR), x_offset,
y_offset, 0, 0, width(), height()); y_offset, 0, 0, width(), height());
} else {
canvas->FillRect(GetLocalBounds(),
tp->GetColor(ThemeProperties::COLOR_TOOLBAR));
} }
// Toolbar/content separator. // Toolbar/content 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