Ladybird/AppKit: Remove theme color changing background color

This commit is contained in:
Bastiaan van der Plaat 2023-12-04 19:55:20 +01:00 committed by Tim Flynn
parent 2107ab823d
commit 980e32b4fe
Notes: sideshowbarker 2024-07-17 16:23:06 +09:00
3 changed files with 1 additions and 26 deletions

View File

@ -26,7 +26,6 @@
- (void)loadURL:(URL const&)url;
- (void)onLoadStart:(URL const&)url isRedirect:(BOOL)is_redirect;
- (void)onLoadFinish:(URL const&)url;
- (void)onThemeColorChange:(Color)color;
- (void)onTitleChange:(DeprecatedString const&)title;
- (void)onFaviconChange:(Gfx::Bitmap const&)bitmap;

View File

@ -668,11 +668,7 @@ static void copy_data_to_clipboard(StringView data, NSPasteboardType pasteboard_
};
m_web_view_bridge->on_theme_color_change = [self](auto color) {
self.backgroundColor = [NSColor colorWithRed:(color.red() / 255.0)
green:(color.green() / 255.0)
blue:(color.blue() / 255.0)
alpha:1.0];
[self.observer onThemeColorChange:color];
self.backgroundColor = Ladybird::gfx_color_to_ns_color(color);
};
m_web_view_bridge->on_insert_clipboard_entry = [](auto const& data, auto const&, auto const& mime_type) {

View File

@ -100,8 +100,6 @@ static constexpr CGFloat const WINDOW_HEIGHT = 800;
object:[scroll_view contentView]];
[self setContentView:scroll_view];
self.backgroundColor = [NSColor windowBackgroundColor];
self.titlebarAppearsTransparent = YES;
}
return self;
@ -226,7 +224,6 @@ static constexpr CGFloat const WINDOW_HEIGHT = 800;
- (void)onLoadStart:(URL const&)url isRedirect:(BOOL)is_redirect
{
if (url != self.last_url) {
self.backgroundColor = [NSColor windowBackgroundColor];
self.last_url = url;
}
@ -258,23 +255,6 @@ static constexpr CGFloat const WINDOW_HEIGHT = 800;
[self updateTabTitleAndFavicon];
}
- (void)onThemeColorChange:(Color)color
{
auto* nscolor = [NSColor colorWithRed:((CGFloat)color.red()) / 255.0
green:((CGFloat)color.green()) / 255.0
blue:((CGFloat)color.blue()) / 255.0
alpha:1.0];
CGFloat hue = 0.0;
CGFloat saturation = 0.0;
CGFloat brightness = 0.0;
[nscolor getHue:&hue saturation:&saturation brightness:&brightness alpha:nil];
if (brightness > 0.75)
brightness = 0.75;
nscolor = [NSColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1.0];
self.backgroundColor = nscolor;
self.titlebarAppearsTransparent = YES;
}
- (void)onFaviconChange:(Gfx::Bitmap const&)bitmap
{
static constexpr size_t FAVICON_SIZE = 16;