2020-06-17 12:31:42 -03:00
|
|
|
/*
|
2022-04-06 10:15:07 -03:00
|
|
|
* Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org>
|
2022-11-21 13:07:47 -03:00
|
|
|
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
2020-06-17 12:31:42 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-06-17 12:31:42 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2022-11-21 13:07:47 -03:00
|
|
|
#include <AK/Queue.h>
|
2020-07-06 16:18:16 -03:00
|
|
|
#include <AK/URL.h>
|
2021-05-03 15:31:58 -03:00
|
|
|
#include <LibGUI/AbstractScrollableWidget.h>
|
2020-06-17 12:31:42 -03:00
|
|
|
#include <LibGUI/Widget.h>
|
2022-03-04 13:29:05 -03:00
|
|
|
#include <LibWeb/CSS/Selector.h>
|
2023-03-20 19:39:20 -03:00
|
|
|
#include <LibWeb/HTML/ActivateTab.h>
|
2021-10-26 13:00:10 -03:00
|
|
|
#include <LibWeb/Page/Page.h>
|
2022-10-05 09:32:17 -03:00
|
|
|
#include <LibWebView/ViewImplementation.h>
|
2020-06-17 12:31:42 -03:00
|
|
|
|
2022-11-02 15:08:48 -03:00
|
|
|
namespace Messages::WebContentServer {
|
|
|
|
|
class WebdriverExecuteScriptResponse;
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-30 05:46:33 -03:00
|
|
|
namespace WebView {
|
2020-08-24 08:03:18 -03:00
|
|
|
|
2020-06-17 12:31:42 -03:00
|
|
|
class WebContentClient;
|
|
|
|
|
|
2022-10-05 09:32:17 -03:00
|
|
|
class OutOfProcessWebView final
|
|
|
|
|
: public GUI::AbstractScrollableWidget
|
|
|
|
|
, public ViewImplementation {
|
2020-08-17 11:20:47 -03:00
|
|
|
C_OBJECT(OutOfProcessWebView);
|
2020-06-17 12:31:42 -03:00
|
|
|
|
2022-11-21 12:54:18 -03:00
|
|
|
using Super = GUI::AbstractScrollableWidget;
|
|
|
|
|
|
2020-06-17 12:31:42 -03:00
|
|
|
public:
|
2020-08-17 11:20:47 -03:00
|
|
|
virtual ~OutOfProcessWebView() override;
|
2020-06-17 12:31:42 -03:00
|
|
|
|
2022-12-04 15:02:33 -03:00
|
|
|
DeprecatedString dump_layout_tree();
|
2021-09-07 19:55:35 -03:00
|
|
|
|
2023-08-26 01:30:02 -03:00
|
|
|
OrderedHashMap<String, String> get_local_storage_entries();
|
|
|
|
|
OrderedHashMap<String, String> get_session_storage_entries();
|
2022-04-01 18:14:04 -03:00
|
|
|
|
2023-04-21 08:54:56 -03:00
|
|
|
void set_content_filters(Vector<String>);
|
2023-04-17 14:21:19 -03:00
|
|
|
void set_autoplay_allowed_on_all_websites();
|
|
|
|
|
void set_autoplay_allowlist(Vector<String>);
|
2022-12-04 15:02:33 -03:00
|
|
|
void set_proxy_mappings(Vector<DeprecatedString> proxies, HashMap<DeprecatedString, size_t> mappings);
|
|
|
|
|
void connect_to_webdriver(DeprecatedString const& webdriver_ipc_path);
|
2021-09-27 06:39:17 -03:00
|
|
|
|
2022-12-06 17:27:44 -03:00
|
|
|
void set_window_position(Gfx::IntPoint);
|
2022-12-06 18:35:32 -03:00
|
|
|
void set_window_size(Gfx::IntSize);
|
2022-11-01 15:55:53 -03:00
|
|
|
|
2022-11-09 11:51:39 -03:00
|
|
|
void set_system_visibility_state(bool visible);
|
|
|
|
|
|
2023-01-09 14:55:22 -03:00
|
|
|
// This is a hint that tells OOPWV that the content will scale to the viewport size.
|
|
|
|
|
// In practice, this means that OOPWV may render scaled stale versions of the content while resizing.
|
|
|
|
|
void set_content_scales_to_viewport(bool);
|
|
|
|
|
|
2020-06-17 12:31:42 -03:00
|
|
|
private:
|
2023-08-07 11:44:20 -03:00
|
|
|
OutOfProcessWebView();
|
2020-06-17 12:31:42 -03:00
|
|
|
|
2020-07-04 18:19:32 -03:00
|
|
|
// ^Widget
|
2020-06-17 12:31:42 -03:00
|
|
|
virtual void paint_event(GUI::PaintEvent&) override;
|
|
|
|
|
virtual void resize_event(GUI::ResizeEvent&) override;
|
2020-06-17 13:05:08 -03:00
|
|
|
virtual void mousedown_event(GUI::MouseEvent&) override;
|
|
|
|
|
virtual void mouseup_event(GUI::MouseEvent&) override;
|
|
|
|
|
virtual void mousemove_event(GUI::MouseEvent&) override;
|
2021-02-22 15:45:41 -03:00
|
|
|
virtual void mousewheel_event(GUI::MouseEvent&) override;
|
2022-06-14 14:38:32 -03:00
|
|
|
virtual void doubleclick_event(GUI::MouseEvent&) override;
|
2020-08-03 14:58:59 -03:00
|
|
|
virtual void keydown_event(GUI::KeyEvent&) override;
|
2021-09-28 10:39:35 -03:00
|
|
|
virtual void keyup_event(GUI::KeyEvent&) override;
|
2020-10-08 18:13:54 -03:00
|
|
|
virtual void theme_change_event(GUI::ThemeChangeEvent&) override;
|
2021-06-13 09:16:06 -03:00
|
|
|
virtual void screen_rects_change_event(GUI::ScreenRectsChangeEvent&) override;
|
2022-02-06 15:03:13 -03:00
|
|
|
virtual void focusin_event(GUI::FocusEvent&) override;
|
|
|
|
|
virtual void focusout_event(GUI::FocusEvent&) override;
|
2022-09-19 15:50:33 -03:00
|
|
|
virtual void show_event(GUI::ShowEvent&) override;
|
|
|
|
|
virtual void hide_event(GUI::HideEvent&) override;
|
2020-06-17 12:31:42 -03:00
|
|
|
|
2021-05-03 15:31:58 -03:00
|
|
|
// ^AbstractScrollableWidget
|
2020-07-04 18:19:32 -03:00
|
|
|
virtual void did_scroll() override;
|
|
|
|
|
|
2022-10-05 09:32:17 -03:00
|
|
|
// ^WebView::ViewImplementation
|
2023-07-22 07:41:25 -03:00
|
|
|
virtual void create_client(EnableCallgrindProfiling = EnableCallgrindProfiling::No) override;
|
2023-01-12 16:49:49 -03:00
|
|
|
virtual void update_zoom() override;
|
2022-10-05 09:32:17 -03:00
|
|
|
|
2023-05-15 02:59:51 -03:00
|
|
|
virtual Gfx::IntRect viewport_rect() const override;
|
2023-05-17 11:12:13 -03:00
|
|
|
virtual Gfx::IntPoint to_content_position(Gfx::IntPoint widget_position) const override;
|
|
|
|
|
virtual Gfx::IntPoint to_widget_position(Gfx::IntPoint content_position) const override;
|
2020-07-04 15:57:57 -03:00
|
|
|
|
2022-11-21 13:07:47 -03:00
|
|
|
using InputEvent = Variant<GUI::KeyEvent, GUI::MouseEvent>;
|
|
|
|
|
void enqueue_input_event(InputEvent const&);
|
|
|
|
|
void process_next_input_event();
|
2023-08-23 12:19:21 -03:00
|
|
|
void did_finish_handling_input_event(bool event_was_accepted);
|
2022-11-21 13:07:47 -03:00
|
|
|
|
|
|
|
|
bool m_is_awaiting_response_for_input_event { false };
|
|
|
|
|
Queue<InputEvent> m_pending_input_events;
|
2023-01-09 14:55:22 -03:00
|
|
|
|
|
|
|
|
bool m_content_scales_to_viewport { false };
|
2020-06-17 12:31:42 -03:00
|
|
|
};
|
2020-08-24 08:03:18 -03:00
|
|
|
|
|
|
|
|
}
|