mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 16:10:20 +00:00
LibWeb: Port the WebContent service to Core::AnonymousBuffer for themes
This commit is contained in:
parent
04f95f9160
commit
d846808122
Notes:
sideshowbarker
2024-07-18 23:10:55 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/d846808122c
4 changed files with 7 additions and 12 deletions
|
@ -73,13 +73,8 @@ OwnPtr<Messages::WebContentServer::GreetResponse> ClientConnection::handle(const
|
|||
|
||||
void ClientConnection::handle(const Messages::WebContentServer::UpdateSystemTheme& message)
|
||||
{
|
||||
auto shared_buffer = SharedBuffer::create_from_shbuf_id(message.shbuf_id());
|
||||
if (!shared_buffer) {
|
||||
dbgln("WebContentServer::UpdateSystemTheme: SharedBuffer already gone! Ignoring :^)");
|
||||
return;
|
||||
}
|
||||
Gfx::set_system_theme(*shared_buffer);
|
||||
auto impl = Gfx::PaletteImpl::create_with_shared_buffer(*shared_buffer);
|
||||
Gfx::set_system_theme(message.theme_buffer());
|
||||
auto impl = Gfx::PaletteImpl::create_with_anonymous_buffer(message.theme_buffer());
|
||||
m_page_host->set_palette_impl(*impl);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,11 +49,11 @@ PageHost::~PageHost()
|
|||
void PageHost::setup_palette()
|
||||
{
|
||||
// FIXME: Get the proper palette from our peer somehow
|
||||
auto buffer = SharedBuffer::create_with_size(sizeof(Gfx::SystemTheme));
|
||||
auto* theme = buffer->data<Gfx::SystemTheme>();
|
||||
auto buffer = Core::AnonymousBuffer::create_with_size(sizeof(Gfx::SystemTheme));
|
||||
auto* theme = buffer.data<Gfx::SystemTheme>();
|
||||
theme->color[(int)Gfx::ColorRole::Window] = Color::Magenta;
|
||||
theme->color[(int)Gfx::ColorRole::WindowText] = Color::Cyan;
|
||||
m_palette_impl = Gfx::PaletteImpl::create_with_shared_buffer(*buffer);
|
||||
m_palette_impl = Gfx::PaletteImpl::create_with_anonymous_buffer(buffer);
|
||||
}
|
||||
|
||||
Gfx::Palette PageHost::palette() const
|
||||
|
|
|
@ -2,7 +2,7 @@ endpoint WebContentServer = 89
|
|||
{
|
||||
Greet(i32 client_pid) => (i32 client_id, i32 server_pid)
|
||||
|
||||
UpdateSystemTheme(i32 shbuf_id) =|
|
||||
UpdateSystemTheme(Core::AnonymousBuffer theme_buffer) =|
|
||||
|
||||
LoadURL(URL url) =|
|
||||
LoadHTML(String html, URL url) =|
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
int main(int, char**)
|
||||
{
|
||||
Core::EventLoop event_loop;
|
||||
if (pledge("stdio sendfd shared_buffer accept unix rpath recvfd", nullptr) < 0) {
|
||||
if (pledge("stdio recvfd sendfd shared_buffer accept unix rpath recvfd", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue