소스 검색

LibWebView+Ladybird: Move page loading to ViewImplementation

Linus Groh 2 년 전
부모
커밋
de1c0c87fe

+ 0 - 12
Ladybird/WebContentView.cpp

@@ -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)

+ 0 - 5
Ladybird/WebContentView.h

@@ -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;

+ 0 - 18
Userland/Libraries/LibWebView/OutOfProcessWebView.cpp

@@ -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);

+ 0 - 8
Userland/Libraries/LibWebView/OutOfProcessWebView.h

@@ -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;
 

+ 17 - 0
Userland/Libraries/LibWebView/ViewImplementation.cpp

@@ -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)

+ 8 - 0
Userland/Libraries/LibWebView/ViewImplementation.h

@@ -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 };
 };