mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 17:35:08 +00:00
Ladybird+LibWebView: Migrate input completions to LibWebView callbacks
This commit is contained in:
parent
5116e97a9d
commit
edec5b1d91
9 changed files with 9 additions and 21 deletions
|
@ -133,10 +133,6 @@ Optional<WebViewBridge::Paintable> WebViewBridge::paintable()
|
||||||
return Paintable { *bitmap, bitmap_size };
|
return Paintable { *bitmap, bitmap_size };
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebViewBridge::notify_server_did_finish_handling_input_event(bool)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebViewBridge::update_zoom()
|
void WebViewBridge::update_zoom()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,8 +52,6 @@ public:
|
||||||
private:
|
private:
|
||||||
WebViewBridge(Vector<Gfx::IntRect> screen_rects, float device_pixel_ratio, Optional<StringView> webdriver_content_ipc_path);
|
WebViewBridge(Vector<Gfx::IntRect> screen_rects, float device_pixel_ratio, Optional<StringView> webdriver_content_ipc_path);
|
||||||
|
|
||||||
virtual void notify_server_did_finish_handling_input_event(bool event_was_accepted) override;
|
|
||||||
|
|
||||||
virtual void update_zoom() override;
|
virtual void update_zoom() override;
|
||||||
virtual Gfx::IntRect viewport_rect() const override;
|
virtual Gfx::IntRect viewport_rect() const override;
|
||||||
virtual Gfx::IntPoint to_content_position(Gfx::IntPoint widget_position) const override;
|
virtual Gfx::IntPoint to_content_position(Gfx::IntPoint widget_position) const override;
|
||||||
|
|
|
@ -736,13 +736,6 @@ bool WebContentView::event(QEvent* event)
|
||||||
return QAbstractScrollArea::event(event);
|
return QAbstractScrollArea::event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContentView::notify_server_did_finish_handling_input_event(bool event_was_accepted)
|
|
||||||
{
|
|
||||||
// FIXME: Currently Ladybird handles the keyboard shortcuts before passing the event to web content, so
|
|
||||||
// we don't need to do anything here. But we'll need to once we start asking web content first.
|
|
||||||
(void)event_was_accepted;
|
|
||||||
}
|
|
||||||
|
|
||||||
ErrorOr<String> WebContentView::dump_layout_tree()
|
ErrorOr<String> WebContentView::dump_layout_tree()
|
||||||
{
|
{
|
||||||
return String::from_deprecated_string(client().dump_layout_tree());
|
return String::from_deprecated_string(client().dump_layout_tree());
|
||||||
|
|
|
@ -76,8 +76,6 @@ public:
|
||||||
};
|
};
|
||||||
void update_palette(PaletteMode = PaletteMode::Default);
|
void update_palette(PaletteMode = PaletteMode::Default);
|
||||||
|
|
||||||
virtual void notify_server_did_finish_handling_input_event(bool event_was_accepted) override;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void urls_dropped(QList<QUrl> const&);
|
void urls_dropped(QList<QUrl> const&);
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,10 @@ OutOfProcessWebView::OutOfProcessWebView()
|
||||||
on_leave_tooltip_area = []() {
|
on_leave_tooltip_area = []() {
|
||||||
GUI::Application::the()->hide_tooltip();
|
GUI::Application::the()->hide_tooltip();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
on_finish_handling_input_event = [this](auto event_was_accepted) {
|
||||||
|
did_finish_handling_input_event(event_was_accepted);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
OutOfProcessWebView::~OutOfProcessWebView() = default;
|
OutOfProcessWebView::~OutOfProcessWebView() = default;
|
||||||
|
@ -350,7 +354,7 @@ void OutOfProcessWebView::process_next_input_event()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutOfProcessWebView::notify_server_did_finish_handling_input_event(bool event_was_accepted)
|
void OutOfProcessWebView::did_finish_handling_input_event(bool event_was_accepted)
|
||||||
{
|
{
|
||||||
VERIFY(m_is_awaiting_response_for_input_event);
|
VERIFY(m_is_awaiting_response_for_input_event);
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,6 @@ private:
|
||||||
// ^WebView::ViewImplementation
|
// ^WebView::ViewImplementation
|
||||||
virtual void create_client(EnableCallgrindProfiling = EnableCallgrindProfiling::No) override;
|
virtual void create_client(EnableCallgrindProfiling = EnableCallgrindProfiling::No) override;
|
||||||
virtual void update_zoom() override;
|
virtual void update_zoom() override;
|
||||||
virtual void notify_server_did_finish_handling_input_event(bool event_was_accepted) override;
|
|
||||||
|
|
||||||
virtual Gfx::IntRect viewport_rect() const override;
|
virtual Gfx::IntRect viewport_rect() const override;
|
||||||
virtual Gfx::IntPoint to_content_position(Gfx::IntPoint widget_position) const override;
|
virtual Gfx::IntPoint to_content_position(Gfx::IntPoint widget_position) const override;
|
||||||
|
@ -91,6 +90,7 @@ private:
|
||||||
using InputEvent = Variant<GUI::KeyEvent, GUI::MouseEvent>;
|
using InputEvent = Variant<GUI::KeyEvent, GUI::MouseEvent>;
|
||||||
void enqueue_input_event(InputEvent const&);
|
void enqueue_input_event(InputEvent const&);
|
||||||
void process_next_input_event();
|
void process_next_input_event();
|
||||||
|
void did_finish_handling_input_event(bool event_was_accepted);
|
||||||
|
|
||||||
bool m_is_awaiting_response_for_input_event { false };
|
bool m_is_awaiting_response_for_input_event { false };
|
||||||
Queue<InputEvent> m_pending_input_events;
|
Queue<InputEvent> m_pending_input_events;
|
||||||
|
|
|
@ -145,8 +145,7 @@ public:
|
||||||
Function<Gfx::IntRect()> on_maximize_window;
|
Function<Gfx::IntRect()> on_maximize_window;
|
||||||
Function<Gfx::IntRect()> on_minimize_window;
|
Function<Gfx::IntRect()> on_minimize_window;
|
||||||
Function<Gfx::IntRect()> on_fullscreen_window;
|
Function<Gfx::IntRect()> on_fullscreen_window;
|
||||||
|
Function<void(bool)> on_finish_handling_input_event;
|
||||||
virtual void notify_server_did_finish_handling_input_event(bool event_was_accepted) = 0;
|
|
||||||
|
|
||||||
virtual Gfx::IntRect viewport_rect() const = 0;
|
virtual Gfx::IntRect viewport_rect() const = 0;
|
||||||
virtual Gfx::IntPoint to_content_position(Gfx::IntPoint widget_position) const = 0;
|
virtual Gfx::IntPoint to_content_position(Gfx::IntPoint widget_position) const = 0;
|
||||||
|
|
|
@ -380,7 +380,8 @@ void WebContentClient::did_request_file(DeprecatedString const& path, i32 reques
|
||||||
|
|
||||||
void WebContentClient::did_finish_handling_input_event(bool event_was_accepted)
|
void WebContentClient::did_finish_handling_input_event(bool event_was_accepted)
|
||||||
{
|
{
|
||||||
m_view.notify_server_did_finish_handling_input_event(event_was_accepted);
|
if (m_view.on_finish_handling_input_event)
|
||||||
|
m_view.on_finish_handling_input_event(event_was_accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,6 @@ public:
|
||||||
private:
|
private:
|
||||||
HeadlessWebContentView() = default;
|
HeadlessWebContentView() = default;
|
||||||
|
|
||||||
void notify_server_did_finish_handling_input_event(bool) override { }
|
|
||||||
void update_zoom() override { }
|
void update_zoom() override { }
|
||||||
void create_client(WebView::EnableCallgrindProfiling) override { }
|
void create_client(WebView::EnableCallgrindProfiling) override { }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue