fix: WCO transparent background (#38693)
* fix: WCO transparency * doc: wco color transparency * fix: transparent buttons when calling setTitleBarOverlay
This commit is contained in:
parent
d95ae19edf
commit
e8fd5fd3a8
4 changed files with 17 additions and 10 deletions
|
@ -13,6 +13,7 @@
|
|||
#include "shell/browser/ui/views/win_caption_button.h"
|
||||
#include "shell/browser/ui/views/win_frame_view.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/compositor/layer.h"
|
||||
#include "ui/strings/grit/ui_strings.h"
|
||||
#include "ui/views/background.h"
|
||||
#include "ui/views/layout/flex_layout.h"
|
||||
|
@ -129,9 +130,7 @@ void WinCaptionButtonContainer::AddedToWidget() {
|
|||
UpdateButtons();
|
||||
|
||||
if (frame_view_->window()->IsWindowControlsOverlayEnabled()) {
|
||||
SetBackground(views::CreateSolidBackground(
|
||||
frame_view_->window()->overlay_button_color()));
|
||||
SetPaintToLayer();
|
||||
UpdateBackground();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,6 +145,16 @@ void WinCaptionButtonContainer::OnWidgetBoundsChanged(
|
|||
UpdateButtons();
|
||||
}
|
||||
|
||||
void WinCaptionButtonContainer::UpdateBackground() {
|
||||
const SkColor bg_color = frame_view_->window()->overlay_button_color();
|
||||
const SkAlpha theme_alpha = SkColorGetA(bg_color);
|
||||
SetBackground(views::CreateSolidBackground(bg_color));
|
||||
SetPaintToLayer();
|
||||
|
||||
if (theme_alpha < SK_AlphaOPAQUE)
|
||||
layer()->SetFillsBoundsOpaquely(false);
|
||||
}
|
||||
|
||||
void WinCaptionButtonContainer::UpdateButtons() {
|
||||
const bool is_maximized = frame_view_->frame()->IsMaximized();
|
||||
restore_button_->SetVisible(is_maximized);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue