2022-10-05 12:32:17 +00:00
|
|
|
/*
|
2024-10-04 11:19:50 +00:00
|
|
|
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
|
2023-01-12 20:22:14 +00:00
|
|
|
* Copyright (c) 2023, Linus Groh <linusg@serenityos.org>
|
2022-10-05 12:32:17 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Forward.h>
|
2023-05-17 16:37:31 +00:00
|
|
|
#include <AK/Function.h>
|
2023-12-09 21:57:57 +00:00
|
|
|
#include <AK/LexicalPath.h>
|
2024-03-04 03:07:49 +00:00
|
|
|
#include <AK/Queue.h>
|
2023-01-12 20:22:14 +00:00
|
|
|
#include <AK/String.h>
|
2024-06-20 18:34:51 +00:00
|
|
|
#include <LibCore/Forward.h>
|
2023-12-31 14:51:02 +00:00
|
|
|
#include <LibCore/Promise.h>
|
2022-10-05 12:32:17 +00:00
|
|
|
#include <LibGfx/Forward.h>
|
|
|
|
#include <LibGfx/StandardCursor.h>
|
|
|
|
#include <LibWeb/Forward.h>
|
2023-03-20 22:39:20 +00:00
|
|
|
#include <LibWeb/HTML/ActivateTab.h>
|
2024-03-26 23:27:06 +00:00
|
|
|
#include <LibWeb/HTML/AudioPlayState.h>
|
2023-12-11 05:53:10 +00:00
|
|
|
#include <LibWeb/HTML/ColorPickerUpdateState.h>
|
2024-03-14 16:26:00 +00:00
|
|
|
#include <LibWeb/HTML/FileFilter.h>
|
2023-12-07 14:53:49 +00:00
|
|
|
#include <LibWeb/HTML/SelectItem.h>
|
2024-09-12 16:56:31 +00:00
|
|
|
#include <LibWeb/Page/EventResult.h>
|
2024-03-04 03:07:49 +00:00
|
|
|
#include <LibWeb/Page/InputEvent.h>
|
2022-10-05 12:32:17 +00:00
|
|
|
#include <LibWebView/Forward.h>
|
2024-09-19 14:40:00 +00:00
|
|
|
#include <LibWebView/PageInfo.h>
|
2023-01-12 19:27:17 +00:00
|
|
|
#include <LibWebView/WebContentClient.h>
|
2022-10-05 12:32:17 +00:00
|
|
|
|
|
|
|
namespace WebView {
|
|
|
|
|
|
|
|
class ViewImplementation {
|
|
|
|
public:
|
2024-02-03 01:00:48 +00:00
|
|
|
virtual ~ViewImplementation();
|
2022-10-05 12:32:17 +00:00
|
|
|
|
2023-01-12 20:22:14 +00:00
|
|
|
struct DOMNodeProperties {
|
|
|
|
String computed_style_json;
|
|
|
|
String resolved_style_json;
|
|
|
|
String custom_properties_json;
|
|
|
|
String node_box_sizing_json;
|
2023-05-21 13:52:03 +00:00
|
|
|
String aria_properties_state_json;
|
2024-08-09 15:07:27 +00:00
|
|
|
String fonts_json;
|
2023-01-12 20:22:14 +00:00
|
|
|
};
|
|
|
|
|
2024-03-18 03:22:27 +00:00
|
|
|
void set_url(Badge<WebContentClient>, URL::URL url) { m_url = move(url); }
|
|
|
|
URL::URL const& url() const { return m_url; }
|
2023-01-12 20:30:06 +00:00
|
|
|
|
2023-03-16 15:24:30 +00:00
|
|
|
String const& handle() const { return m_client_state.client_handle; }
|
|
|
|
|
2023-05-20 14:50:05 +00:00
|
|
|
void server_did_paint(Badge<WebContentClient>, i32 bitmap_id, Gfx::IntSize size);
|
|
|
|
|
2024-10-28 11:48:49 +00:00
|
|
|
void set_window_position(Gfx::IntPoint);
|
|
|
|
void set_window_size(Gfx::IntSize);
|
2024-10-29 03:37:11 +00:00
|
|
|
void did_update_window_rect();
|
2024-10-28 11:48:49 +00:00
|
|
|
|
2024-11-13 16:24:16 +00:00
|
|
|
void set_system_visibility_state(Web::HTML::VisibilityState);
|
|
|
|
|
2024-03-18 03:22:27 +00:00
|
|
|
void load(URL::URL const&);
|
2023-09-17 15:12:17 +00:00
|
|
|
void load_html(StringView);
|
2023-01-12 20:30:06 +00:00
|
|
|
void load_empty_document();
|
2024-04-13 16:51:27 +00:00
|
|
|
void reload();
|
2024-04-13 20:33:48 +00:00
|
|
|
void traverse_the_history_by_delta(int delta);
|
2023-01-12 20:30:06 +00:00
|
|
|
|
2023-01-12 19:49:49 +00:00
|
|
|
void zoom_in();
|
|
|
|
void zoom_out();
|
|
|
|
void reset_zoom();
|
2023-03-26 18:41:56 +00:00
|
|
|
float zoom_level() const { return m_zoom_level; }
|
2023-12-12 21:33:36 +00:00
|
|
|
float device_pixel_ratio() const { return m_device_pixel_ratio; }
|
2023-01-12 20:22:14 +00:00
|
|
|
|
2024-03-04 03:07:49 +00:00
|
|
|
void enqueue_input_event(Web::InputEvent);
|
2024-09-12 16:56:31 +00:00
|
|
|
void did_finish_handling_input_event(Badge<WebContentClient>, Web::EventResult event_result);
|
2024-03-04 03:07:49 +00:00
|
|
|
|
2023-01-12 20:44:42 +00:00
|
|
|
void set_preferred_color_scheme(Web::CSS::PreferredColorScheme);
|
2024-06-12 23:03:56 +00:00
|
|
|
void set_preferred_contrast(Web::CSS::PreferredContrast);
|
2024-06-13 14:15:59 +00:00
|
|
|
void set_preferred_motion(Web::CSS::PreferredMotion);
|
2024-07-02 19:29:43 +00:00
|
|
|
|
2024-07-23 20:10:24 +00:00
|
|
|
void set_preferred_languages(Vector<String>);
|
|
|
|
|
2024-07-02 19:29:43 +00:00
|
|
|
void set_enable_do_not_track(bool);
|
2023-01-12 20:44:42 +00:00
|
|
|
|
2024-09-22 22:12:36 +00:00
|
|
|
void set_enable_autoplay(bool);
|
|
|
|
|
2023-12-16 14:19:34 +00:00
|
|
|
ByteString selected_text();
|
2023-10-23 20:52:57 +00:00
|
|
|
Optional<String> selected_text_with_whitespace_collapsed();
|
2023-01-12 20:42:42 +00:00
|
|
|
void select_all();
|
2024-05-31 20:01:34 +00:00
|
|
|
void find_in_page(String const& query, CaseSensitivity = CaseSensitivity::CaseInsensitive);
|
2024-05-29 19:09:33 +00:00
|
|
|
void find_in_page_next_match();
|
|
|
|
void find_in_page_previous_match();
|
2024-03-22 10:56:49 +00:00
|
|
|
void paste(String const&);
|
2023-01-12 20:42:42 +00:00
|
|
|
|
2023-01-12 19:58:00 +00:00
|
|
|
void get_source();
|
2023-01-12 19:49:49 +00:00
|
|
|
|
2023-01-12 20:22:14 +00:00
|
|
|
void inspect_dom_tree();
|
2024-10-20 08:37:44 +00:00
|
|
|
void inspect_dom_node(Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element);
|
2023-01-12 20:22:14 +00:00
|
|
|
void inspect_accessibility_tree();
|
|
|
|
void clear_inspected_dom_node();
|
2023-12-30 14:42:24 +00:00
|
|
|
void get_hovered_node_id();
|
2023-01-12 20:22:14 +00:00
|
|
|
|
2024-10-20 08:37:44 +00:00
|
|
|
void set_dom_node_text(Web::UniqueNodeID node_id, String text);
|
|
|
|
void set_dom_node_tag(Web::UniqueNodeID node_id, String name);
|
|
|
|
void add_dom_node_attributes(Web::UniqueNodeID node_id, Vector<Attribute> attributes);
|
|
|
|
void replace_dom_node_attribute(Web::UniqueNodeID node_id, String name, Vector<Attribute> replacement_attributes);
|
|
|
|
void create_child_element(Web::UniqueNodeID node_id);
|
|
|
|
void create_child_text_node(Web::UniqueNodeID node_id);
|
|
|
|
void clone_dom_node(Web::UniqueNodeID node_id);
|
|
|
|
void remove_dom_node(Web::UniqueNodeID node_id);
|
|
|
|
void get_dom_node_html(Web::UniqueNodeID node_id);
|
2023-11-19 15:42:11 +00:00
|
|
|
|
2024-08-23 10:18:35 +00:00
|
|
|
void list_style_sheets();
|
|
|
|
void request_style_sheet_source(Web::CSS::StyleSheetIdentifier const&);
|
|
|
|
|
2023-12-16 14:19:34 +00:00
|
|
|
void debug_request(ByteString const& request, ByteString const& argument = {});
|
2023-01-12 20:34:08 +00:00
|
|
|
|
2023-01-12 20:39:08 +00:00
|
|
|
void run_javascript(StringView);
|
2023-12-16 14:19:34 +00:00
|
|
|
void js_console_input(ByteString const& js_source);
|
2023-05-17 15:54:36 +00:00
|
|
|
void js_console_request_messages(i32 start_index);
|
2023-01-12 20:39:08 +00:00
|
|
|
|
2023-05-17 18:23:34 +00:00
|
|
|
void alert_closed();
|
|
|
|
void confirm_closed(bool accepted);
|
|
|
|
void prompt_closed(Optional<String> response);
|
2023-12-11 05:53:10 +00:00
|
|
|
void color_picker_update(Optional<Color> picked_color, Web::HTML::ColorPickerUpdateState state);
|
2024-02-25 18:02:47 +00:00
|
|
|
void file_picker_closed(Vector<Web::HTML::SelectedFile> selected_files);
|
2024-04-03 17:19:08 +00:00
|
|
|
void select_dropdown_closed(Optional<u32> const& selected_item_id);
|
2023-05-17 18:23:34 +00:00
|
|
|
|
2023-06-16 14:51:38 +00:00
|
|
|
void toggle_media_play_state();
|
2023-06-16 15:29:54 +00:00
|
|
|
void toggle_media_mute_state();
|
2023-06-16 14:51:38 +00:00
|
|
|
void toggle_media_loop_state();
|
|
|
|
void toggle_media_controls_state();
|
2023-05-15 15:17:58 +00:00
|
|
|
|
2024-03-30 13:41:15 +00:00
|
|
|
Web::HTML::MuteState page_mute_state() const { return m_mute_state; }
|
|
|
|
void toggle_page_mute_state();
|
|
|
|
|
2024-03-26 23:27:06 +00:00
|
|
|
void did_change_audio_play_state(Badge<WebContentClient>, Web::HTML::AudioPlayState);
|
|
|
|
Web::HTML::AudioPlayState audio_play_state() const { return m_audio_play_state; }
|
|
|
|
|
2024-04-13 21:12:55 +00:00
|
|
|
void did_update_navigation_buttons_state(Badge<WebContentClient>, bool back_enabled, bool forward_enabled) const;
|
|
|
|
|
2024-06-17 15:50:57 +00:00
|
|
|
void did_allocate_backing_stores(Badge<WebContentClient>, i32 front_bitmap_id, Gfx::ShareableBitmap const&, i32 back_bitmap_id, Gfx::ShareableBitmap const&);
|
2024-06-20 18:34:51 +00:00
|
|
|
#ifdef AK_OS_MACOS
|
|
|
|
void did_allocate_iosurface_backing_stores(i32 front_bitmap_id, Core::MachPort&&, i32 back_bitmap_id, Core::MachPort&&);
|
|
|
|
#endif
|
2024-06-17 15:50:57 +00:00
|
|
|
|
2023-05-17 13:53:13 +00:00
|
|
|
enum class ScreenshotType {
|
|
|
|
Visible,
|
|
|
|
Full,
|
|
|
|
};
|
2023-12-31 14:51:02 +00:00
|
|
|
NonnullRefPtr<Core::Promise<LexicalPath>> take_screenshot(ScreenshotType);
|
2024-10-20 08:37:44 +00:00
|
|
|
NonnullRefPtr<Core::Promise<LexicalPath>> take_dom_node_screenshot(Web::UniqueNodeID);
|
2023-12-31 14:51:02 +00:00
|
|
|
virtual void did_receive_screenshot(Badge<WebContentClient>, Gfx::ShareableBitmap const&);
|
2023-05-17 13:53:13 +00:00
|
|
|
|
2024-09-19 14:40:00 +00:00
|
|
|
NonnullRefPtr<Core::Promise<String>> request_internal_page_info(PageInfoType);
|
|
|
|
void did_receive_internal_page_info(Badge<WebContentClient>, PageInfoType, String const&);
|
|
|
|
|
2023-12-12 12:25:06 +00:00
|
|
|
ErrorOr<LexicalPath> dump_gc_graph();
|
|
|
|
|
2023-08-26 17:34:59 +00:00
|
|
|
void set_user_style_sheet(String source);
|
|
|
|
// Load Native.css as the User style sheet, which attempts to make WebView content look as close to
|
|
|
|
// native GUI widgets as possible.
|
|
|
|
void use_native_user_style_sheet();
|
|
|
|
|
2023-11-23 17:22:23 +00:00
|
|
|
void enable_inspector_prototype();
|
|
|
|
|
2023-05-20 14:50:05 +00:00
|
|
|
Function<void()> on_ready_to_paint;
|
2024-01-31 03:05:00 +00:00
|
|
|
Function<String(Web::HTML::ActivateTab, Web::HTML::WebViewHints, Optional<u64>)> on_new_web_view;
|
2023-05-17 16:37:31 +00:00
|
|
|
Function<void()> on_activate_tab;
|
|
|
|
Function<void()> on_close;
|
|
|
|
Function<void(Gfx::IntPoint screen_position)> on_context_menu_request;
|
2024-03-29 02:02:55 +00:00
|
|
|
Function<void(URL::URL const&, Gfx::IntPoint screen_position)> on_link_context_menu_request;
|
|
|
|
Function<void(URL::URL const&, Gfx::IntPoint screen_position, Gfx::ShareableBitmap const&)> on_image_context_menu_request;
|
2023-06-16 14:51:38 +00:00
|
|
|
Function<void(Gfx::IntPoint screen_position, Web::Page::MediaContextMenu const&)> on_media_context_menu_request;
|
2024-03-29 02:02:55 +00:00
|
|
|
Function<void(URL::URL const&)> on_link_hover;
|
2023-05-17 16:37:31 +00:00
|
|
|
Function<void()> on_link_unhover;
|
2024-03-29 02:02:55 +00:00
|
|
|
Function<void(URL::URL const&, ByteString const& target, unsigned modifiers)> on_link_click;
|
|
|
|
Function<void(URL::URL const&, ByteString const& target, unsigned modifiers)> on_link_middle_click;
|
2023-12-16 14:19:34 +00:00
|
|
|
Function<void(ByteString const&)> on_title_change;
|
2024-04-14 08:27:20 +00:00
|
|
|
Function<void(URL::URL const&)> on_url_change;
|
2024-03-29 02:02:55 +00:00
|
|
|
Function<void(URL::URL const&, bool)> on_load_start;
|
|
|
|
Function<void(URL::URL const&)> on_load_finish;
|
2023-12-16 14:19:34 +00:00
|
|
|
Function<void(ByteString const& path, i32)> on_request_file;
|
2023-05-17 16:37:31 +00:00
|
|
|
Function<void(Gfx::Bitmap const&)> on_favicon_change;
|
2023-08-23 14:43:27 +00:00
|
|
|
Function<void(Gfx::StandardCursor)> on_cursor_change;
|
2024-07-02 14:48:57 +00:00
|
|
|
Function<void(Gfx::IntPoint, ByteString const&)> on_request_tooltip_override;
|
|
|
|
Function<void()> on_stop_tooltip_override;
|
2024-07-02 12:16:24 +00:00
|
|
|
Function<void(ByteString const&)> on_enter_tooltip_area;
|
2023-08-23 15:11:39 +00:00
|
|
|
Function<void()> on_leave_tooltip_area;
|
2023-05-17 18:23:34 +00:00
|
|
|
Function<void(String const& message)> on_request_alert;
|
|
|
|
Function<void(String const& message)> on_request_confirm;
|
|
|
|
Function<void(String const& message, String const& default_)> on_request_prompt;
|
|
|
|
Function<void(String const& message)> on_request_set_prompt_text;
|
|
|
|
Function<void()> on_request_accept_dialog;
|
|
|
|
Function<void()> on_request_dismiss_dialog;
|
2024-10-18 21:20:15 +00:00
|
|
|
Function<void(URL::URL const&, URL::URL const&, String const&)> on_received_source;
|
2023-12-16 14:19:34 +00:00
|
|
|
Function<void(ByteString const&)> on_received_dom_tree;
|
2023-12-30 14:30:27 +00:00
|
|
|
Function<void(Optional<DOMNodeProperties>)> on_received_dom_node_properties;
|
2023-12-16 14:19:34 +00:00
|
|
|
Function<void(ByteString const&)> on_received_accessibility_tree;
|
2024-08-23 10:18:35 +00:00
|
|
|
Function<void(Vector<Web::CSS::StyleSheetIdentifier>)> on_received_style_sheet_list;
|
|
|
|
Function<void(Web::CSS::StyleSheetIdentifier const&)> on_inspector_requested_style_sheet_source;
|
2024-10-18 21:20:15 +00:00
|
|
|
Function<void(Web::CSS::StyleSheetIdentifier const&, URL::URL const&, String const&)> on_received_style_sheet_source;
|
2024-10-20 08:37:44 +00:00
|
|
|
Function<void(Web::UniqueNodeID)> on_received_hovered_node_id;
|
|
|
|
Function<void(Optional<Web::UniqueNodeID> const& node_id)> on_finshed_editing_dom_node;
|
2023-12-30 19:32:50 +00:00
|
|
|
Function<void(String const&)> on_received_dom_node_html;
|
2023-08-23 15:25:24 +00:00
|
|
|
Function<void(i32 message_id)> on_received_console_message;
|
2023-12-16 14:19:34 +00:00
|
|
|
Function<void(i32 start_index, Vector<ByteString> const& message_types, Vector<ByteString> const& messages)> on_received_console_messages;
|
2023-05-17 16:37:31 +00:00
|
|
|
Function<void(i32 count_waiting)> on_resource_status_change;
|
|
|
|
Function<void()> on_restore_window;
|
2024-10-29 03:37:11 +00:00
|
|
|
Function<void(Gfx::IntPoint)> on_reposition_window;
|
|
|
|
Function<void(Gfx::IntSize)> on_resize_window;
|
2024-10-29 03:45:18 +00:00
|
|
|
Function<void()> on_maximize_window;
|
|
|
|
Function<void()> on_minimize_window;
|
|
|
|
Function<void()> on_fullscreen_window;
|
2023-09-04 09:32:40 +00:00
|
|
|
Function<void(Color current_color)> on_request_color_picker;
|
2024-03-14 16:26:00 +00:00
|
|
|
Function<void(Web::HTML::FileFilter const& accepted_file_types, Web::HTML::AllowMultipleFiles)> on_request_file_picker;
|
2023-12-07 14:53:49 +00:00
|
|
|
Function<void(Gfx::IntPoint content_position, i32 minimum_width, Vector<Web::HTML::SelectItem> items)> on_request_select_dropdown;
|
2024-03-04 03:07:49 +00:00
|
|
|
Function<void(Web::KeyEvent const&)> on_finish_handling_key_event;
|
2024-08-17 17:36:28 +00:00
|
|
|
Function<void(Web::DragEvent const&)> on_finish_handling_drag_event;
|
2024-10-02 16:38:10 +00:00
|
|
|
Function<void(String const&)> on_text_test_finish;
|
2024-06-09 17:35:32 +00:00
|
|
|
Function<void(size_t current_match_index, Optional<size_t> const& total_match_count)> on_find_in_page;
|
2023-09-18 23:51:48 +00:00
|
|
|
Function<void(Gfx::Color)> on_theme_color_change;
|
2023-11-10 18:35:41 +00:00
|
|
|
Function<void(String const&, String const&, String const&)> on_insert_clipboard_entry;
|
2024-03-26 23:27:06 +00:00
|
|
|
Function<void(Web::HTML::AudioPlayState)> on_audio_play_state_changed;
|
2024-04-13 21:12:55 +00:00
|
|
|
Function<void(bool, bool)> on_navigation_buttons_state_changed;
|
2023-11-23 17:22:23 +00:00
|
|
|
Function<void()> on_inspector_loaded;
|
2024-10-20 08:37:44 +00:00
|
|
|
Function<void(Web::UniqueNodeID, Optional<Web::CSS::Selector::PseudoElement::Type> const&)> on_inspector_selected_dom_node;
|
|
|
|
Function<void(Web::UniqueNodeID, String const&)> on_inspector_set_dom_node_text;
|
|
|
|
Function<void(Web::UniqueNodeID, String const&)> on_inspector_set_dom_node_tag;
|
|
|
|
Function<void(Web::UniqueNodeID, Vector<Attribute> const&)> on_inspector_added_dom_node_attributes;
|
|
|
|
Function<void(Web::UniqueNodeID, size_t, Vector<Attribute> const&)> on_inspector_replaced_dom_node_attribute;
|
|
|
|
Function<void(Web::UniqueNodeID, Gfx::IntPoint, String const&, Optional<String> const&, Optional<size_t> const&)> on_inspector_requested_dom_tree_context_menu;
|
2024-09-06 17:22:16 +00:00
|
|
|
Function<void(size_t, Gfx::IntPoint)> on_inspector_requested_cookie_context_menu;
|
2023-12-01 00:27:32 +00:00
|
|
|
Function<void(String const&)> on_inspector_executed_console_script;
|
2024-08-19 16:11:39 +00:00
|
|
|
Function<void(String const&)> on_inspector_exported_inspector_html;
|
2024-11-13 21:35:17 +00:00
|
|
|
Function<void()> on_web_content_crashed;
|
2023-01-12 19:27:17 +00:00
|
|
|
|
2024-06-03 14:53:55 +00:00
|
|
|
virtual Web::DevicePixelSize viewport_size() const = 0;
|
2023-05-17 14:12:13 +00:00
|
|
|
virtual Gfx::IntPoint to_content_position(Gfx::IntPoint widget_position) const = 0;
|
|
|
|
virtual Gfx::IntPoint to_widget_position(Gfx::IntPoint content_position) const = 0;
|
2023-05-15 05:59:51 +00:00
|
|
|
|
2023-01-12 19:27:17 +00:00
|
|
|
protected:
|
2023-01-12 19:49:49 +00:00
|
|
|
static constexpr auto ZOOM_MIN_LEVEL = 0.3f;
|
|
|
|
static constexpr auto ZOOM_MAX_LEVEL = 5.0f;
|
|
|
|
static constexpr auto ZOOM_STEP = 0.1f;
|
|
|
|
|
2023-08-07 14:44:20 +00:00
|
|
|
ViewImplementation();
|
2023-05-15 05:59:51 +00:00
|
|
|
|
2023-01-12 19:27:17 +00:00
|
|
|
WebContentClient& client();
|
|
|
|
WebContentClient const& client() const;
|
2024-02-03 01:00:48 +00:00
|
|
|
u64 page_id() const;
|
2023-01-12 19:49:49 +00:00
|
|
|
virtual void update_zoom() = 0;
|
2023-01-12 19:27:17 +00:00
|
|
|
|
2023-05-15 05:59:51 +00:00
|
|
|
void handle_resize();
|
|
|
|
|
2024-01-30 16:12:14 +00:00
|
|
|
enum class CreateNewClient {
|
|
|
|
No,
|
|
|
|
Yes,
|
|
|
|
};
|
2024-11-13 21:35:17 +00:00
|
|
|
virtual void initialize_client(CreateNewClient = CreateNewClient::Yes);
|
2023-04-15 00:04:28 +00:00
|
|
|
|
2024-11-12 13:43:37 +00:00
|
|
|
enum class LoadErrorPage {
|
|
|
|
No,
|
|
|
|
Yes,
|
|
|
|
};
|
|
|
|
void handle_web_content_process_crash(LoadErrorPage = LoadErrorPage::Yes);
|
2023-05-17 13:53:13 +00:00
|
|
|
|
2023-01-12 19:27:17 +00:00
|
|
|
struct SharedBitmap {
|
|
|
|
i32 id { -1 };
|
2023-12-14 06:17:00 +00:00
|
|
|
Web::DevicePixelSize last_painted_size;
|
2023-01-12 19:27:17 +00:00
|
|
|
RefPtr<Gfx::Bitmap> bitmap;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ClientState {
|
|
|
|
RefPtr<WebContentClient> client;
|
2023-03-16 15:24:30 +00:00
|
|
|
String client_handle;
|
2023-01-12 19:27:17 +00:00
|
|
|
SharedBitmap front_bitmap;
|
|
|
|
SharedBitmap back_bitmap;
|
2024-01-30 16:12:14 +00:00
|
|
|
u64 page_index { 0 };
|
2023-01-12 19:27:17 +00:00
|
|
|
bool has_usable_bitmap { false };
|
|
|
|
} m_client_state;
|
2023-01-12 19:49:49 +00:00
|
|
|
|
2024-03-18 03:22:27 +00:00
|
|
|
URL::URL m_url;
|
2023-01-12 20:30:06 +00:00
|
|
|
|
2023-01-12 19:49:49 +00:00
|
|
|
float m_zoom_level { 1.0 };
|
|
|
|
float m_device_pixel_ratio { 1.0 };
|
2023-05-15 05:59:51 +00:00
|
|
|
|
2024-03-04 03:07:49 +00:00
|
|
|
Queue<Web::InputEvent> m_pending_input_events;
|
|
|
|
|
2023-05-15 05:59:51 +00:00
|
|
|
RefPtr<Core::Timer> m_backing_store_shrink_timer;
|
|
|
|
|
|
|
|
RefPtr<Gfx::Bitmap> m_backup_bitmap;
|
2023-12-14 06:17:00 +00:00
|
|
|
Web::DevicePixelSize m_backup_bitmap_size;
|
2023-05-27 16:46:45 +00:00
|
|
|
|
|
|
|
size_t m_crash_count = 0;
|
|
|
|
RefPtr<Core::Timer> m_repeated_crash_timer;
|
2023-12-31 14:51:02 +00:00
|
|
|
|
|
|
|
RefPtr<Core::Promise<LexicalPath>> m_pending_screenshot;
|
2024-09-19 14:40:00 +00:00
|
|
|
RefPtr<Core::Promise<String>> m_pending_info_request;
|
2024-03-26 23:27:06 +00:00
|
|
|
|
2024-11-13 16:24:16 +00:00
|
|
|
Web::HTML::VisibilityState m_system_visibility_state { Web::HTML::VisibilityState::Hidden };
|
|
|
|
|
2024-03-26 23:27:06 +00:00
|
|
|
Web::HTML::AudioPlayState m_audio_play_state { Web::HTML::AudioPlayState::Paused };
|
2024-03-30 13:34:23 +00:00
|
|
|
size_t m_number_of_elements_playing_audio { 0 };
|
2024-03-30 13:41:15 +00:00
|
|
|
|
|
|
|
Web::HTML::MuteState m_mute_state { Web::HTML::MuteState::Unmuted };
|
2022-10-05 12:32:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|