1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 00:58:12 +00:00

LibWebView+Ladybird: Move page loading to ViewImplementation

This commit is contained in:
Linus Groh 2023-01-12 20:30:06 +00:00 committed by Andreas Kling
parent 2428e3e675
commit de1c0c87fe
6 changed files with 25 additions and 43 deletions

View file

@ -82,18 +82,6 @@ WebContentView::~WebContentView()
close_sub_widgets();
}
void WebContentView::load(AK::URL const& url)
{
m_url = url;
client().async_load_url(url);
}
void WebContentView::load_html(StringView html, AK::URL const& url)
{
m_url = url;
client().async_load_html(html, url);
}
unsigned get_button_from_qt_event(QMouseEvent const& event)
{
if (event.button() == Qt::MouseButton::LeftButton)

View file

@ -49,9 +49,6 @@ public:
explicit WebContentView(StringView webdriver_content_ipc_path);
virtual ~WebContentView() override;
void load(AK::URL const&);
void load_html(StringView html, AK::URL const&);
Function<void(Gfx::IntPoint screen_position)> on_context_menu_request;
Function<void(const AK::URL&, DeprecatedString const& target, unsigned modifiers)> on_link_click;
Function<void(const AK::URL&, Gfx::IntPoint screen_position)> on_link_context_menu_request;
@ -204,8 +201,6 @@ private:
void handle_web_content_process_crash();
AK::URL m_url;
RefPtr<Gfx::Bitmap> m_backup_bitmap;
StringView m_webdriver_content_ipc_path;

View file

@ -74,24 +74,6 @@ void OutOfProcessWebView::create_client()
client().async_update_screen_rects(GUI::Desktop::the().rects(), GUI::Desktop::the().main_screen_index());
}
void OutOfProcessWebView::load(const AK::URL& url)
{
m_url = url;
client().async_load_url(url);
}
void OutOfProcessWebView::load_html(StringView html, const AK::URL& url)
{
m_url = url;
client().async_load_html(html, url);
}
void OutOfProcessWebView::load_empty_document()
{
m_url = {};
client().async_load_html("", {});
}
void OutOfProcessWebView::paint_event(GUI::PaintEvent& event)
{
Super::paint_event(event);

View file

@ -33,12 +33,6 @@ class OutOfProcessWebView final
public:
virtual ~OutOfProcessWebView() override;
AK::URL url() const { return m_url; }
void load(const AK::URL&);
void load_html(StringView, const AK::URL&);
void load_empty_document();
void debug_request(DeprecatedString const& request, DeprecatedString const& argument = {});
void js_console_input(DeprecatedString const& js_source);
@ -193,8 +187,6 @@ private:
void enqueue_input_event(InputEvent const&);
void process_next_input_event();
AK::URL m_url;
RefPtr<Gfx::Bitmap> m_backup_bitmap;
RefPtr<GUI::Dialog> m_dialog;

View file

@ -22,6 +22,23 @@ WebContentClient const& ViewImplementation::client() const
return *m_client_state.client;
}
void ViewImplementation::load(AK::URL const& url)
{
m_url = url;
client().async_load_url(url);
}
void ViewImplementation::load_html(StringView html, AK::URL const& url)
{
m_url = url;
client().async_load_html(html, url);
}
void ViewImplementation::load_empty_document()
{
load_html(""sv, {});
}
void ViewImplementation::zoom_in()
{
if (m_zoom_level >= ZOOM_MAX_LEVEL)

View file

@ -28,6 +28,12 @@ public:
String node_box_sizing_json;
};
AK::URL const& url() const { return m_url; }
void load(AK::URL const&);
void load_html(StringView, AK::URL const&);
void load_empty_document();
void zoom_in();
void zoom_out();
void reset_zoom();
@ -116,6 +122,8 @@ protected:
bool got_repaint_requests_while_painting { false };
} m_client_state;
AK::URL m_url;
float m_zoom_level { 1.0 };
float m_device_pixel_ratio { 1.0 };
};