1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:07:35 +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

@ -15,7 +15,7 @@
#include <QWidget>
class QLineEdit;
class QTextEdit;
class WebContentView;
namespace Ladybird {
@ -31,6 +31,8 @@ public:
void print_html(StringView);
void reset();
WebContentView& view() { return *m_output_view; }
Function<void(DeprecatedString const&)> on_js_input;
Function<void(i32)> on_request_messages;
@ -38,7 +40,7 @@ private:
void request_console_messages();
void clear_output();
QTextEdit* m_output_view { nullptr };
WebContentView* m_output_view { nullptr };
QLineEdit* m_input { nullptr };
i32 m_highest_notified_message_index { -1 };