mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:27:35 +00:00
Ladybird: Inform WebContent whether the AppKit chrome is in dark mode
This commit is contained in:
parent
6e64bf5464
commit
3fc0c21b6c
6 changed files with 77 additions and 11 deletions
|
@ -13,6 +13,8 @@
|
|||
#include <LibWeb/Crypto/Crypto.h>
|
||||
#include <UI/LadybirdWebViewBridge.h>
|
||||
|
||||
#import <UI/Palette.h>
|
||||
|
||||
namespace Ladybird {
|
||||
|
||||
template<typename T>
|
||||
|
@ -85,6 +87,12 @@ void WebViewBridge::set_viewport_rect(Gfx::IntRect viewport_rect, ForResize for_
|
|||
}
|
||||
}
|
||||
|
||||
void WebViewBridge::update_palette()
|
||||
{
|
||||
auto theme = create_system_palette();
|
||||
client().async_update_system_theme(move(theme));
|
||||
}
|
||||
|
||||
void WebViewBridge::mouse_down_event(Gfx::IntPoint position, GUI::MouseButton button, KeyModifier modifiers)
|
||||
{
|
||||
client().async_mouse_down(to_content_position(position), to_underlying(button), to_underlying(button), modifiers);
|
||||
|
@ -183,13 +191,4 @@ void WebViewBridge::create_client(WebView::EnableCallgrindProfiling enable_callg
|
|||
}
|
||||
}
|
||||
|
||||
void WebViewBridge::update_palette()
|
||||
{
|
||||
auto theme = MUST(Gfx::load_system_theme(DeprecatedString::formatted("{}/res/themes/Default.ini", s_serenity_resource_root)));
|
||||
auto palette_impl = Gfx::PaletteImpl::create_with_anonymous_buffer(theme);
|
||||
auto palette = Gfx::Palette(move(palette_impl));
|
||||
|
||||
client().async_update_system_theme(move(theme));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue