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

HackStudio: Use a single global tooltip window

Previously, every Editor instance had two instances of tooltip windows
& `OutOfProcessWebView`s, one for documentation and one for parameter
hints.

They were initialized with the Editor, which slowed down creation of new
tabs.

We use a single global tooltip & OOPWV instance that is shared between
tabs.

Closes #15488

Co-authored-by: Sam Atkins <atkinssj@serenityos.org>
This commit is contained in:
Itamar 2022-10-06 15:30:29 +03:00 committed by Sam Atkins
parent 2046a670b3
commit c30c6eb1c1
2 changed files with 51 additions and 38 deletions

View file

@ -78,6 +78,7 @@ private:
Gfx::IntRect gutter_icon_rect(size_t line_number) const;
static Gfx::Bitmap const& breakpoint_icon_bitmap();
static Gfx::Bitmap const& current_position_icon_bitmap();
static ErrorOr<void> initialize_tooltip_window();
struct AutoCompleteRequestData {
GUI::TextPosition position;
@ -106,15 +107,9 @@ private:
void on_token_info_timer_tick();
void on_tokens_info_result(Vector<CodeComprehension::TokenInfo> const& tokens_info);
void create_tokens_info_timer();
ErrorOr<void> initialize_documentation_tooltip();
ErrorOr<void> initialize_parameters_hint_tooltip();
explicit Editor();
RefPtr<GUI::Window> m_documentation_tooltip_window;
RefPtr<GUI::Window> m_parameters_hint_tooltip_window;
RefPtr<WebView::OutOfProcessWebView> m_documentation_page_view;
RefPtr<WebView::OutOfProcessWebView> m_parameter_hint_page_view;
String m_last_parsed_token;
GUI::TextPosition m_previous_text_position { 0, 0 };
bool m_hovering_editor { false };