1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:17:44 +00:00

Ladybird: Implement the JavaScript console using a WebContentView

This aligns the Ladybird console implementation with the Browser console
a bit more, which uses OutOfProcessWebView for rendering console output.
This allows us to style the console output to try and match the system
theme.

Using a WebContentView is simpler than trying to style the old QTextEdit
widget, as the console output is HTML with built-in "-libweb-palette-*"
colors. These will override any color we set on the QTextEdit widget.
This commit is contained in:
Timothy Flynn 2023-04-22 21:57:08 -04:00 committed by Andreas Kling
parent 5af715e394
commit 4aca24481e
5 changed files with 80 additions and 22 deletions

View file

@ -98,6 +98,8 @@ public:
void show_js_console();
void show_inspector();
Ladybird::ConsoleWidget* console() { return m_console_widget; };
ErrorOr<String> dump_layout_tree();
void set_viewport_rect(Gfx::IntRect);
@ -107,6 +109,12 @@ public:
Gfx::IntPoint to_content(Gfx::IntPoint) const;
Gfx::IntPoint to_widget(Gfx::IntPoint) const;
enum class PaletteMode {
Default,
Dark,
};
void update_palette(PaletteMode = PaletteMode::Default);
virtual void notify_server_did_layout(Badge<WebContentClient>, Gfx::IntSize content_size) override;
virtual void notify_server_did_paint(Badge<WebContentClient>, i32 bitmap_id) override;
virtual void notify_server_did_invalidate_content_rect(Badge<WebContentClient>, Gfx::IntRect const&) override;
@ -198,8 +206,6 @@ private:
bool is_inspector_open() const;
void close_sub_widgets();
void update_palette();
qreal m_inverse_pixel_scaling_ratio { 1.0 };
bool m_should_show_line_box_borders { false };