diff --git a/DevTools/HackStudio/Editor.cpp b/DevTools/HackStudio/Editor.cpp index da06015855..f7dc5590fc 100644 --- a/DevTools/HackStudio/Editor.cpp +++ b/DevTools/HackStudio/Editor.cpp @@ -47,7 +47,7 @@ #include #include #include -#include +#include // #define EDITOR_DEBUG @@ -59,7 +59,7 @@ Editor::Editor() m_documentation_tooltip_window = GUI::Window::construct(); m_documentation_tooltip_window->set_rect(0, 0, 500, 400); m_documentation_tooltip_window->set_window_type(GUI::WindowType::Tooltip); - m_documentation_page_view = m_documentation_tooltip_window->set_main_widget(); + m_documentation_page_view = m_documentation_tooltip_window->set_main_widget(); m_autocomplete_box = make(make_weak_ptr()); } @@ -182,13 +182,14 @@ void Editor::show_documentation_tooltip_if_available(const String& hovered_token return; } - auto html_text = man_document->render_to_html(); - - m_documentation_page_view->load_html(html_text, {}); - - if (auto* document = m_documentation_page_view->document()) { - const_cast(document->body())->set_attribute(Web::HTML::AttributeNames::style, "background-color: #dac7b5;"); - } + StringBuilder html; + // FIXME: With the InProcessWebView we used to manipulate the document body directly, + // With OutOfProcessWebView this isn't possible (at the moment). The ideal solution + // is probably to tweak Markdown::Document::render_to_html() so we can inject styles + // into the rendered HTML easily. + html.append(man_document->render_to_html()); + html.append(""); + m_documentation_page_view->load_html(html.build(), {}); m_documentation_tooltip_window->move_to(screen_location.translated(4, 4)); m_documentation_tooltip_window->show(); diff --git a/DevTools/HackStudio/Editor.h b/DevTools/HackStudio/Editor.h index 90273ff27f..941a02c238 100644 --- a/DevTools/HackStudio/Editor.h +++ b/DevTools/HackStudio/Editor.h @@ -100,7 +100,7 @@ private: RefPtr m_documentation_tooltip_window; OwnPtr m_autocomplete_box; - RefPtr m_documentation_page_view; + RefPtr m_documentation_page_view; String m_last_parsed_token; GUI::TextPosition m_previous_text_position { 0, 0 }; bool m_hovering_editor { false };