mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 00:57:36 +00:00
Applications: Use native style sheet for WebViews where appropriate
This commit is contained in:
parent
7436f4fec2
commit
aae7905369
4 changed files with 4 additions and 0 deletions
|
@ -25,6 +25,7 @@ ConsoleWidget::ConsoleWidget()
|
||||||
set_fill_with_background_color(true);
|
set_fill_with_background_color(true);
|
||||||
|
|
||||||
m_output_view = add<WebView::OutOfProcessWebView>();
|
m_output_view = add<WebView::OutOfProcessWebView>();
|
||||||
|
m_output_view->use_native_user_style_sheet();
|
||||||
m_output_view->load("data:text/html,<html style=\"font: 10pt monospace;\"></html>"sv);
|
m_output_view->load("data:text/html,<html style=\"font: 10pt monospace;\"></html>"sv);
|
||||||
// Wait until our output WebView is loaded, and then request any messages that occurred before we existed
|
// Wait until our output WebView is loaded, and then request any messages that occurred before we existed
|
||||||
m_output_view->on_load_finish = [this](auto&) {
|
m_output_view->on_load_finish = [this](auto&) {
|
||||||
|
|
|
@ -117,6 +117,7 @@ ErrorOr<void> MainWidget::initialize_fallibles(GUI::Window& window)
|
||||||
};
|
};
|
||||||
|
|
||||||
m_web_view = find_descendant_of_type_named<WebView::OutOfProcessWebView>("web_view");
|
m_web_view = find_descendant_of_type_named<WebView::OutOfProcessWebView>("web_view");
|
||||||
|
m_web_view->use_native_user_style_sheet();
|
||||||
m_web_view->on_link_click = [this](auto& url, auto&, unsigned) {
|
m_web_view->on_link_click = [this](auto& url, auto&, unsigned) {
|
||||||
if (url.scheme() == "file") {
|
if (url.scheme() == "file") {
|
||||||
auto path = LexicalPath { url.serialize_path() };
|
auto path = LexicalPath { url.serialize_path() };
|
||||||
|
|
|
@ -82,6 +82,7 @@ HelpWindow::HelpWindow(GUI::Window* parent)
|
||||||
m_listview->set_model(HelpListModel::create());
|
m_listview->set_model(HelpListModel::create());
|
||||||
|
|
||||||
m_webview = splitter.add<WebView::OutOfProcessWebView>();
|
m_webview = splitter.add<WebView::OutOfProcessWebView>();
|
||||||
|
m_webview->use_native_user_style_sheet();
|
||||||
m_webview->on_link_click = [this](auto& url, auto&, auto&&) {
|
m_webview->on_link_click = [this](auto& url, auto&, auto&&) {
|
||||||
VERIFY(url.scheme() == "spreadsheet");
|
VERIFY(url.scheme() == "spreadsheet");
|
||||||
if (url.host().template has<String>() && url.host().template get<String>() == "example"sv) {
|
if (url.host().template has<String>() && url.host().template get<String>() == "example"sv) {
|
||||||
|
|
|
@ -35,6 +35,7 @@ ErrorOr<void> WelcomeWidget::create_widgets()
|
||||||
m_banner_font = TRY(Gfx::BitmapFont::try_load_from_file("/res/fonts/MarietaRegular24.font"sv));
|
m_banner_font = TRY(Gfx::BitmapFont::try_load_from_file("/res/fonts/MarietaRegular24.font"sv));
|
||||||
|
|
||||||
m_web_view = find_descendant_of_type_named<WebView::OutOfProcessWebView>("web_view");
|
m_web_view = find_descendant_of_type_named<WebView::OutOfProcessWebView>("web_view");
|
||||||
|
m_web_view->use_native_user_style_sheet();
|
||||||
auto path = TRY(String::formatted("{}/README.md", Core::StandardPaths::home_directory()));
|
auto path = TRY(String::formatted("{}/README.md", Core::StandardPaths::home_directory()));
|
||||||
m_web_view->load(URL::create_with_file_scheme(path.to_deprecated_string()));
|
m_web_view->load(URL::create_with_file_scheme(path.to_deprecated_string()));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue