-
-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathvibrancy.patch
More file actions
95 lines (89 loc) · 4.42 KB
/
vibrancy.patch
File metadata and controls
95 lines (89 loc) · 4.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
diff --git a/chrome/browser/ui/views/frame/browser_frame_view_mac.mm b/chrome/browser/ui/views/frame/browser_frame_view_mac.mm
index 380a3c51c2ae0..7845dc78b4bb7 100644
--- a/chrome/browser/ui/views/frame/browser_frame_view_mac.mm
+++ b/chrome/browser/ui/views/frame/browser_frame_view_mac.mm
@@ -429,8 +429,19 @@ void BrowserFrameViewMac::OnPaint(gfx::Canvas* canvas) {
return;
}
+ canvas->DrawColor(SK_ColorTRANSPARENT);
+
SkColor frame_color = GetFrameColor(BrowserFrameActiveState::kUseCurrent);
- canvas->DrawColor(frame_color);
+ SkColor transparent_tint = SkColorSetA(frame_color, 38);
+
+ gfx::Rect contents_bounds = GetBrowserView()->contents_container()->bounds();
+ contents_bounds =
+ views::View::ConvertRectToTarget(GetBrowserView(), this, contents_bounds);
+
+ canvas->Save();
+ canvas->ClipRect(contents_bounds, SkClipOp::kDifference);
+ canvas->DrawColor(transparent_tint);
+ canvas->Restore();
auto* theme_service = ThemeServiceFactory::GetForProfile(
GetBrowserView()->browser()->profile());
diff --git a/chrome/browser/ui/views/frame/browser_widget.cc b/chrome/browser/ui/views/frame/browser_widget.cc
index d825bc7cb5828..064f9dbf8dda3 100644
--- a/chrome/browser/ui/views/frame/browser_widget.cc
+++ b/chrome/browser/ui/views/frame/browser_widget.cc
@@ -157,6 +157,7 @@ void BrowserWidget::InitBrowserWidget() {
views::Widget::InitParams::CLIENT_OWNS_WIDGET);
params.name = "BrowserWidget";
params.delegate = browser_view_;
+ params.opacity = views::Widget::InitParams::WindowOpacity::kTranslucent;
Browser* browser = browser_view_->browser();
if (browser->is_type_picture_in_picture()) {
diff --git a/chrome/browser/ui/views/frame/themed_background.cc b/chrome/browser/ui/views/frame/themed_background.cc
index f5f3d4e6c1cfa..ed893b91af2aa 100644
--- a/chrome/browser/ui/views/frame/themed_background.cc
+++ b/chrome/browser/ui/views/frame/themed_background.cc
@@ -102,12 +102,7 @@ void ThemedBackground::PaintBackground(gfx::Canvas* canvas,
const views::View* view,
const BrowserView* browser_view,
ThemeChoice theme_choice) {
- bool painted =
- PaintThemeCustomImage(canvas, view, browser_view, theme_choice);
- if (!painted) {
- canvas->DrawColor(view->GetColorProvider()->GetColor(
- GetThemeChoiceInfo(theme_choice, view).second));
- }
+ canvas->DrawColor(SK_ColorTRANSPARENT);
}
std::optional<SkColor> ThemedBackground::GetBackgroundColor(
diff --git a/chrome/browser/ui/views/side_panel/side_panel.cc b/chrome/browser/ui/views/side_panel/side_panel.cc
index e1cee41274339..9c8d986418391 100644
--- a/chrome/browser/ui/views/side_panel/side_panel.cc
+++ b/chrome/browser/ui/views/side_panel/side_panel.cc
@@ -236,14 +236,7 @@ class ContentParentBackground : public views::Background {
SkRRect rrect;
rrect.setRectRadii(gfx::RectToSkRect(view->GetLocalBounds()), sk_radii);
SkPath path = SkPath::RRect(rrect);
- canvas->ClipPath(path, /*do_anti_alias=*/true);
-
- if (type_ == SidePanelEntry::PanelType::kToolbar) {
- ThemedBackground::PaintBackground(canvas, view, browser_view_);
- } else {
- canvas->DrawColor(
- view->GetColorProvider()->GetColor(kColorSidePanelBackground));
- }
+ canvas->DrawColor(SK_ColorTRANSPARENT);
}
private:
diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
index b89085a51a169..d87ef5bc43ae2 100644
--- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
+++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
@@ -750,6 +750,15 @@ void NativeWidgetNSWindowBridge::CreateContentView(
[compositor_view setLayer:background_layer];
[compositor_view setWantsLayer:YES];
[bridged_view_ addSubview:compositor_view];
+ if (is_translucent_window_) {
+ NSVisualEffectView* vibrancy_view =
+ [[NSVisualEffectView alloc] initWithFrame:[bridged_view_ bounds]];
+ [vibrancy_view setMaterial:NSVisualEffectMaterialUnderWindowBackground];
+ [vibrancy_view setBlendingMode:NSVisualEffectBlendingModeBehindWindow];
+ [vibrancy_view setState:NSVisualEffectStateActive];
+ [vibrancy_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+ [bridged_view_ addSubview:vibrancy_view];
+ }
[bridged_view_ setWantsLayer:YES];
if (corner_radius) {