2020-06-17 17:31:42 +02:00
|
|
|
/*
|
2022-04-06 15:15:07 +02:00
|
|
|
* Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org>
|
2022-11-21 16:07:47 +00:00
|
|
|
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
2020-06-17 17:31:42 +02:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-06-17 17:31:42 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2024-03-18 16:22:27 +13:00
|
|
|
#include <AK/Queue.h>
|
2021-05-03 20:31:58 +02:00
|
|
|
#include <LibGUI/AbstractScrollableWidget.h>
|
2020-06-17 17:31:42 +02:00
|
|
|
#include <LibGUI/Widget.h>
|
2024-03-18 16:22:27 +13:00
|
|
|
#include <LibURL/URL.h>
|
2022-03-04 16:29:05 +00:00
|
|
|
#include <LibWeb/CSS/Selector.h>
|
2023-03-20 18:39:20 -04:00
|
|
|
#include <LibWeb/HTML/ActivateTab.h>
|
2021-10-26 17:00:10 +01:00
|
|
|
#include <LibWeb/Page/Page.h>
|
2022-10-05 14:32:17 +02:00
|
|
|
#include <LibWebView/ViewImplementation.h>
|
2020-06-17 17:31:42 +02:00
|
|
|
|
2022-11-02 18:08:48 +00:00
|
|
|
namespace Messages::WebContentServer {
|
|
|
|
|
class WebdriverExecuteScriptResponse;
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-30 10:46:33 +02:00
|
|
|
namespace WebView {
|
2020-08-24 15:33:18 +04:30
|
|
|
|
2020-06-17 17:31:42 +02:00
|
|
|
class WebContentClient;
|
|
|
|
|
|
2022-10-05 14:32:17 +02:00
|
|
|
class OutOfProcessWebView final
|
|
|
|
|
: public GUI::AbstractScrollableWidget
|
|
|
|
|
, public ViewImplementation {
|
2020-08-17 16:20:47 +02:00
|
|
|
C_OBJECT(OutOfProcessWebView);
|
2020-06-17 17:31:42 +02:00
|
|
|
|
2022-11-21 15:54:18 +00:00
|
|
|
using Super = GUI::AbstractScrollableWidget;
|
|
|
|
|
|
2020-06-17 17:31:42 +02:00
|
|
|
public:
|
2020-08-17 16:20:47 +02:00
|
|
|
virtual ~OutOfProcessWebView() override;
|
2020-06-17 17:31:42 +02:00
|
|
|
|
2023-12-16 17:49:34 +03:30
|
|
|
ByteString dump_layout_tree();
|
2021-09-08 00:55:35 +02:00
|
|
|
|
2023-08-26 16:30:02 +12:00
|
|
|
OrderedHashMap<String, String> get_local_storage_entries();
|
|
|
|
|
OrderedHashMap<String, String> get_session_storage_entries();
|
2022-04-02 00:14:04 +03:00
|
|
|
|
2023-04-21 07:54:56 -04:00
|
|
|
void set_content_filters(Vector<String>);
|
2023-04-17 13:21:19 -04:00
|
|
|
void set_autoplay_allowed_on_all_websites();
|
|
|
|
|
void set_autoplay_allowlist(Vector<String>);
|
2023-12-16 17:49:34 +03:30
|
|
|
void set_proxy_mappings(Vector<ByteString> proxies, HashMap<ByteString, size_t> mappings);
|
|
|
|
|
void connect_to_webdriver(ByteString const& webdriver_ipc_path);
|
2021-09-27 11:39:17 +02:00
|
|
|
|
2022-12-06 20:27:44 +00:00
|
|
|
void set_window_position(Gfx::IntPoint);
|
2022-12-06 21:35:32 +00:00
|
|
|
void set_window_size(Gfx::IntSize);
|
2022-11-01 14:55:53 -04:00
|
|
|
|
2022-11-09 09:51:39 -05:00
|
|
|
void set_system_visibility_state(bool visible);
|
|
|
|
|
|
2023-01-09 18:55:22 +01: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 17:31:42 +02:00
|
|
|
private:
|
2023-08-07 16:44:20 +02:00
|
|
|
OutOfProcessWebView();
|
2020-06-17 17:31:42 +02:00
|
|
|
|
2020-07-04 23:19:32 +02:00
|
|
|
// ^Widget
|
2020-06-17 17:31:42 +02:00
|
|
|
virtual void paint_event(GUI::PaintEvent&) override;
|
|
|
|
|
virtual void resize_event(GUI::ResizeEvent&) override;
|
2020-06-17 18:05:08 +02: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 19:45:41 +01:00
|
|
|
virtual void mousewheel_event(GUI::MouseEvent&) override;
|
2022-06-14 19:38:32 +02:00
|
|
|
virtual void doubleclick_event(GUI::MouseEvent&) override;
|
2020-08-03 19:58:59 +02:00
|
|
|
virtual void keydown_event(GUI::KeyEvent&) override;
|
2021-09-28 15:39:35 +02:00
|
|
|
virtual void keyup_event(GUI::KeyEvent&) override;
|
2020-10-08 22:13:54 +01:00
|
|
|
virtual void theme_change_event(GUI::ThemeChangeEvent&) override;
|
2021-06-13 06:16:06 -06:00
|
|
|
virtual void screen_rects_change_event(GUI::ScreenRectsChangeEvent&) override;
|
2022-02-06 19:03:13 +01:00
|
|
|
virtual void focusin_event(GUI::FocusEvent&) override;
|
|
|
|
|
virtual void focusout_event(GUI::FocusEvent&) override;
|
2022-09-19 20:50:33 +02:00
|
|
|
virtual void show_event(GUI::ShowEvent&) override;
|
|
|
|
|
virtual void hide_event(GUI::HideEvent&) override;
|
2020-06-17 17:31:42 +02:00
|
|
|
|
2021-05-03 20:31:58 +02:00
|
|
|
// ^AbstractScrollableWidget
|
2020-07-04 23:19:32 +02:00
|
|
|
virtual void did_scroll() override;
|
|
|
|
|
|
2022-10-05 14:32:17 +02:00
|
|
|
// ^WebView::ViewImplementation
|
2024-01-30 09:12:14 -07:00
|
|
|
virtual void initialize_client(CreateNewClient) override;
|
2023-01-12 19:49:49 +00:00
|
|
|
virtual void update_zoom() override;
|
2022-10-05 14:32:17 +02:00
|
|
|
|
2023-12-14 07:17:00 +01:00
|
|
|
virtual Web::DevicePixelRect viewport_rect() const override;
|
2023-05-17 10:12:13 -04: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 20:57:57 +02:00
|
|
|
|
2024-03-03 22:07:49 -05:00
|
|
|
void enqueue_native_event(Web::MouseEvent::Type, GUI::MouseEvent const& event);
|
|
|
|
|
void enqueue_native_event(Web::KeyEvent::Type, GUI::KeyEvent const& event);
|
|
|
|
|
void finish_handling_key_event(Web::KeyEvent const&);
|
2023-01-09 18:55:22 +01:00
|
|
|
|
|
|
|
|
bool m_content_scales_to_viewport { false };
|
2020-06-17 17:31:42 +02:00
|
|
|
};
|
2020-08-24 15:33:18 +04:30
|
|
|
|
|
|
|
|
}
|