Kaynağa Gözat

Ladybird+LibWebView: Move APIs which only repaint to LibWebView

We can easily add hooks to notify the browsers of these events if any
implementation-specific handling is needed in the future, but for now,
these only repaint the client, which we can do in ViewImplementation.
Timothy Flynn 2 yıl önce
ebeveyn
işleme
682a5f9b70

+ 0 - 10
Ladybird/AppKit/UI/LadybirdWebViewBridge.cpp

@@ -112,16 +112,6 @@ void WebViewBridge::notify_server_did_layout(Badge<WebView::WebContentClient>, G
     }
 }
 
-void WebViewBridge::notify_server_did_invalidate_content_rect(Badge<WebView::WebContentClient>, Gfx::IntRect const&)
-{
-    request_repaint();
-}
-
-void WebViewBridge::notify_server_did_change_selection(Badge<WebView::WebContentClient>)
-{
-    request_repaint();
-}
-
 void WebViewBridge::notify_server_did_request_cursor_change(Badge<WebView::WebContentClient>, Gfx::StandardCursor cursor)
 {
     if (on_cursor_change)

+ 0 - 2
Ladybird/AppKit/UI/LadybirdWebViewBridge.h

@@ -62,8 +62,6 @@ private:
     WebViewBridge(Vector<Gfx::IntRect> screen_rects, float device_pixel_ratio, Optional<StringView> webdriver_content_ipc_path);
 
     virtual void notify_server_did_layout(Badge<WebView::WebContentClient>, Gfx::IntSize content_size) override;
-    virtual void notify_server_did_invalidate_content_rect(Badge<WebView::WebContentClient>, Gfx::IntRect const&) override;
-    virtual void notify_server_did_change_selection(Badge<WebView::WebContentClient>) override;
     virtual void notify_server_did_request_cursor_change(Badge<WebView::WebContentClient>, Gfx::StandardCursor cursor) override;
     virtual void notify_server_did_request_scroll(Badge<WebView::WebContentClient>, i32, i32) override;
     virtual void notify_server_did_request_scroll_to(Badge<WebView::WebContentClient>, Gfx::IntPoint) override;

+ 0 - 10
Ladybird/Qt/WebContentView.cpp

@@ -591,16 +591,6 @@ void WebContentView::create_client(WebView::EnableCallgrindProfiling enable_call
         client().async_connect_to_webdriver(m_webdriver_content_ipc_path);
 }
 
-void WebContentView::notify_server_did_invalidate_content_rect(Badge<WebContentClient>, [[maybe_unused]] Gfx::IntRect const& content_rect)
-{
-    request_repaint();
-}
-
-void WebContentView::notify_server_did_change_selection(Badge<WebContentClient>)
-{
-    request_repaint();
-}
-
 void WebContentView::notify_server_did_request_cursor_change(Badge<WebContentClient>, Gfx::StandardCursor cursor)
 {
     switch (cursor) {

+ 0 - 2
Ladybird/Qt/WebContentView.h

@@ -77,8 +77,6 @@ public:
     void update_palette(PaletteMode = PaletteMode::Default);
 
     virtual void notify_server_did_layout(Badge<WebContentClient>, Gfx::IntSize content_size) override;
-    virtual void notify_server_did_invalidate_content_rect(Badge<WebContentClient>, Gfx::IntRect const&) override;
-    virtual void notify_server_did_change_selection(Badge<WebContentClient>) override;
     virtual void notify_server_did_request_cursor_change(Badge<WebContentClient>, Gfx::StandardCursor cursor) override;
     virtual void notify_server_did_request_scroll(Badge<WebContentClient>, i32, i32) override;
     virtual void notify_server_did_request_scroll_to(Badge<WebContentClient>, Gfx::IntPoint) override;

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

@@ -179,16 +179,6 @@ void OutOfProcessWebView::screen_rects_change_event(GUI::ScreenRectsChangeEvent&
     client().async_update_screen_rects(event.rects(), event.main_screen_index());
 }
 
-void OutOfProcessWebView::notify_server_did_invalidate_content_rect(Badge<WebContentClient>, [[maybe_unused]] Gfx::IntRect const& content_rect)
-{
-    request_repaint();
-}
-
-void OutOfProcessWebView::notify_server_did_change_selection(Badge<WebContentClient>)
-{
-    request_repaint();
-}
-
 void OutOfProcessWebView::notify_server_did_request_cursor_change(Badge<WebContentClient>, Gfx::StandardCursor cursor)
 {
     set_override_cursor(cursor);

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

@@ -83,8 +83,6 @@ private:
     virtual void create_client(EnableCallgrindProfiling = EnableCallgrindProfiling::No) override;
     virtual void update_zoom() override;
     virtual void notify_server_did_layout(Badge<WebContentClient>, Gfx::IntSize content_size) override;
-    virtual void notify_server_did_invalidate_content_rect(Badge<WebContentClient>, Gfx::IntRect const&) override;
-    virtual void notify_server_did_change_selection(Badge<WebContentClient>) override;
     virtual void notify_server_did_request_cursor_change(Badge<WebContentClient>, Gfx::StandardCursor cursor) override;
     virtual void notify_server_did_request_scroll(Badge<WebContentClient>, i32, i32) override;
     virtual void notify_server_did_request_scroll_to(Badge<WebContentClient>, Gfx::IntPoint) override;

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

@@ -70,6 +70,16 @@ void ViewImplementation::server_did_paint(Badge<WebContentClient>, i32 bitmap_id
     }
 }
 
+void ViewImplementation::server_did_invalidate_content_rect(Badge<WebContentClient>, Gfx::IntRect)
+{
+    request_repaint();
+}
+
+void ViewImplementation::server_did_change_selection(Badge<WebContentClient>)
+{
+    request_repaint();
+}
+
 void ViewImplementation::load(AK::URL const& url)
 {
     m_url = url;

+ 2 - 2
Userland/Libraries/LibWebView/ViewImplementation.h

@@ -48,6 +48,8 @@ public:
     String const& handle() const { return m_client_state.client_handle; }
 
     void server_did_paint(Badge<WebContentClient>, i32 bitmap_id, Gfx::IntSize size);
+    void server_did_invalidate_content_rect(Badge<WebContentClient>, Gfx::IntRect rect);
+    void server_did_change_selection(Badge<WebContentClient>);
 
     void load(AK::URL const&);
     void load_html(StringView, AK::URL const&);
@@ -138,8 +140,6 @@ public:
     Function<Gfx::IntRect()> on_fullscreen_window;
 
     virtual void notify_server_did_layout(Badge<WebContentClient>, Gfx::IntSize content_size) = 0;
-    virtual void notify_server_did_invalidate_content_rect(Badge<WebContentClient>, Gfx::IntRect const&) = 0;
-    virtual void notify_server_did_change_selection(Badge<WebContentClient>) = 0;
     virtual void notify_server_did_request_cursor_change(Badge<WebContentClient>, Gfx::StandardCursor cursor) = 0;
     virtual void notify_server_did_request_scroll(Badge<WebContentClient>, i32, i32) = 0;
     virtual void notify_server_did_request_scroll_to(Badge<WebContentClient>, Gfx::IntPoint) = 0;

+ 2 - 2
Userland/Libraries/LibWebView/WebContentClient.cpp

@@ -67,13 +67,13 @@ void WebContentClient::did_invalidate_content_rect(Gfx::IntRect const& content_r
     dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidInvalidateContentRect! content_rect={}", content_rect);
 
     // FIXME: Figure out a way to coalesce these messages to reduce unnecessary painting
-    m_view.notify_server_did_invalidate_content_rect({}, content_rect);
+    m_view.server_did_invalidate_content_rect({}, content_rect);
 }
 
 void WebContentClient::did_change_selection()
 {
     dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidChangeSelection!");
-    m_view.notify_server_did_change_selection({});
+    m_view.server_did_change_selection({});
 }
 
 void WebContentClient::did_request_cursor_change(i32 cursor_type)

+ 0 - 2
Userland/Utilities/headless-browser.cpp

@@ -103,8 +103,6 @@ private:
     HeadlessWebContentView() = default;
 
     void notify_server_did_layout(Badge<WebView::WebContentClient>, Gfx::IntSize) override { }
-    void notify_server_did_invalidate_content_rect(Badge<WebView::WebContentClient>, Gfx::IntRect const&) override { }
-    void notify_server_did_change_selection(Badge<WebView::WebContentClient>) override { }
     void notify_server_did_request_cursor_change(Badge<WebView::WebContentClient>, Gfx::StandardCursor) override { }
     void notify_server_did_request_scroll(Badge<WebView::WebContentClient>, i32, i32) override { }
     void notify_server_did_request_scroll_to(Badge<WebView::WebContentClient>, Gfx::IntPoint) override { }