From 5b2356b452788141080e9726313e426add68b29e Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Thu, 23 May 2024 23:07:39 -0400 Subject: [PATCH] WebContent+WebWorker: Don't set the color value to the index of an enum The NamedColor would be casted to its underlying int to fit the ARGB on the left hand side. --- Userland/Services/WebContent/PageClient.cpp | 4 ++-- Userland/Services/WebWorker/PageHost.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Userland/Services/WebContent/PageClient.cpp b/Userland/Services/WebContent/PageClient.cpp index 64b957df7ce..3e0288e591e 100644 --- a/Userland/Services/WebContent/PageClient.cpp +++ b/Userland/Services/WebContent/PageClient.cpp @@ -145,8 +145,8 @@ void PageClient::setup_palette() VERIFY(!buffer_or_error.is_error()); auto buffer = buffer_or_error.release_value(); auto* theme = buffer.data(); - theme->color[(int)Gfx::ColorRole::Window] = Color::Magenta; - theme->color[(int)Gfx::ColorRole::WindowText] = Color::Cyan; + theme->color[to_underlying(Gfx::ColorRole::Window)] = Color(Color::Magenta).value(); + theme->color[to_underlying(Gfx::ColorRole::WindowText)] = Color(Color::Cyan).value(); m_palette_impl = Gfx::PaletteImpl::create_with_anonymous_buffer(buffer); } diff --git a/Userland/Services/WebWorker/PageHost.cpp b/Userland/Services/WebWorker/PageHost.cpp index 303a1b5f9a3..bca371587fa 100644 --- a/Userland/Services/WebWorker/PageHost.cpp +++ b/Userland/Services/WebWorker/PageHost.cpp @@ -42,8 +42,8 @@ void PageHost::setup_palette() VERIFY(!buffer_or_error.is_error()); auto buffer = buffer_or_error.release_value(); auto* theme = buffer.data(); - theme->color[to_underlying(Gfx::ColorRole::Window)] = Color::Magenta; - theme->color[to_underlying(Gfx::ColorRole::WindowText)] = Color::Cyan; + theme->color[to_underlying(Gfx::ColorRole::Window)] = Color(Color::Magenta).value(); + theme->color[to_underlying(Gfx::ColorRole::WindowText)] = Color(Color::Cyan).value(); m_palette_impl = Gfx::PaletteImpl::create_with_anonymous_buffer(buffer); }