Ladybird: Use a web view for the Qt chrome's View Source action
Unlike the existing popup window, this will provide syntax highlighting.
This commit is contained in:
parent
a718a1f3a6
commit
a6bdf8c2a9
Notes:
sideshowbarker
2024-07-17 18:49:10 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/a6bdf8c2a9 Pull-request: https://github.com/SerenityOS/serenity/pull/20824 Reviewed-by: https://github.com/ADKaster ✅
1 changed files with 3 additions and 8 deletions
|
@ -14,6 +14,7 @@
|
|||
#include <Browser/History.h>
|
||||
#include <LibGfx/ImageFormats/BMPWriter.h>
|
||||
#include <LibGfx/Painter.h>
|
||||
#include <LibWebView/SourceHighlighter.h>
|
||||
#include <QClipboard>
|
||||
#include <QCoreApplication>
|
||||
#include <QCursor>
|
||||
|
@ -26,7 +27,6 @@
|
|||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QPainter>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QPoint>
|
||||
#include <QResizeEvent>
|
||||
|
||||
|
@ -217,13 +217,8 @@ Tab::Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::
|
|||
QObject::connect(focus_location_editor_action, &QAction::triggered, this, &Tab::focus_location_editor);
|
||||
|
||||
view().on_received_source = [this](auto const& url, auto const& source) {
|
||||
auto* text_edit = new QPlainTextEdit(this);
|
||||
text_edit->setWindowFlags(Qt::Window);
|
||||
text_edit->setFont(QFontDatabase::systemFont(QFontDatabase::SystemFont::FixedFont));
|
||||
text_edit->resize(800, 600);
|
||||
text_edit->setWindowTitle(qstring_from_ak_deprecated_string(url.to_deprecated_string()));
|
||||
text_edit->setPlainText(qstring_from_ak_deprecated_string(source));
|
||||
text_edit->show();
|
||||
auto html = WebView::highlight_source(url, source);
|
||||
m_window->new_tab(html, url, Web::HTML::ActivateTab::Yes);
|
||||
};
|
||||
|
||||
view().on_navigate_back = [this]() {
|
||||
|
|
Loading…
Add table
Reference in a new issue