| 
									
										
										
										
											2022-10-05 14:32:17 +02:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2024-10-04 13:19:50 +02: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 14:32:17 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <AK/Forward.h>
 | 
					
						
							| 
									
										
										
										
											2023-05-17 12:37:31 -04:00
										 |  |  | #include <AK/Function.h>
 | 
					
						
							| 
									
										
										
										
											2025-02-21 12:39:43 -05:00
										 |  |  | #include <AK/JsonObject.h>
 | 
					
						
							| 
									
										
										
										
											2023-12-09 16:57:57 -05:00
										 |  |  | #include <AK/LexicalPath.h>
 | 
					
						
							| 
									
										
										
										
											2024-03-03 22:07:49 -05:00
										 |  |  | #include <AK/Queue.h>
 | 
					
						
							| 
									
										
										
										
											2023-01-12 20:22:14 +00:00
										 |  |  | #include <AK/String.h>
 | 
					
						
							| 
									
										
										
										
											2025-07-28 16:51:01 -04:00
										 |  |  | #include <AK/Utf16String.h>
 | 
					
						
							| 
									
										
										
										
											2024-06-20 21:34:51 +03:00
										 |  |  | #include <LibCore/Forward.h>
 | 
					
						
							| 
									
										
										
										
											2023-12-31 09:51:02 -05:00
										 |  |  | #include <LibCore/Promise.h>
 | 
					
						
							| 
									
										
										
										
											2025-02-17 15:49:05 +00:00
										 |  |  | #include <LibGfx/Cursor.h>
 | 
					
						
							| 
									
										
										
										
											2022-10-05 14:32:17 +02:00
										 |  |  | #include <LibGfx/Forward.h>
 | 
					
						
							|  |  |  | #include <LibWeb/Forward.h>
 | 
					
						
							| 
									
										
										
										
											2023-03-20 18:39:20 -04:00
										 |  |  | #include <LibWeb/HTML/ActivateTab.h>
 | 
					
						
							| 
									
										
										
										
											2024-03-26 19:27:06 -04:00
										 |  |  | #include <LibWeb/HTML/AudioPlayState.h>
 | 
					
						
							| 
									
										
										
										
											2023-12-11 06:53:10 +01:00
										 |  |  | #include <LibWeb/HTML/ColorPickerUpdateState.h>
 | 
					
						
							| 
									
										
										
										
											2024-03-14 12:26:00 -04:00
										 |  |  | #include <LibWeb/HTML/FileFilter.h>
 | 
					
						
							| 
									
										
										
										
											2023-12-07 15:53:49 +01:00
										 |  |  | #include <LibWeb/HTML/SelectItem.h>
 | 
					
						
							| 
									
										
										
										
											2024-09-12 12:56:31 -04:00
										 |  |  | #include <LibWeb/Page/EventResult.h>
 | 
					
						
							| 
									
										
										
										
											2024-03-03 22:07:49 -05:00
										 |  |  | #include <LibWeb/Page/InputEvent.h>
 | 
					
						
							| 
									
										
										
										
											2025-03-19 15:50:56 -04:00
										 |  |  | #include <LibWebView/DOMNodeProperties.h>
 | 
					
						
							| 
									
										
										
										
											2022-10-05 14:32:17 +02:00
										 |  |  | #include <LibWebView/Forward.h>
 | 
					
						
							| 
									
										
										
										
											2024-09-19 10:40:00 -04:00
										 |  |  | #include <LibWebView/PageInfo.h>
 | 
					
						
							| 
									
										
										
										
											2025-03-29 08:19:00 -04:00
										 |  |  | #include <LibWebView/Settings.h>
 | 
					
						
							| 
									
										
										
										
											2023-01-12 19:27:17 +00:00
										 |  |  | #include <LibWebView/WebContentClient.h>
 | 
					
						
							| 
									
										
										
										
											2022-10-05 14:32:17 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace WebView { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-01 20:55:11 -07:00
										 |  |  | class WEBVIEW_API ViewImplementation : public SettingsObserver { | 
					
						
							| 
									
										
										
										
											2022-10-05 14:32:17 +02:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2024-02-02 18:00:48 -07:00
										 |  |  |     virtual ~ViewImplementation(); | 
					
						
							| 
									
										
										
										
											2022-10-05 14:32:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-15 08:06:36 -05:00
										 |  |  |     static void for_each_view(Function<IterationDecision(ViewImplementation&)>); | 
					
						
							|  |  |  |     static Optional<ViewImplementation&> find_view_by_id(u64); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     u64 view_id() const { return m_view_id; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-18 16:22:27 +13: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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-28 16:51:01 -04:00
										 |  |  |     void set_title(Badge<WebContentClient>, Utf16String title) { m_title = move(title); } | 
					
						
							|  |  |  |     Utf16String const& title() const { return m_title; } | 
					
						
							| 
									
										
										
										
											2025-02-17 06:43:06 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-16 18:24:30 +03:00
										 |  |  |     String const& handle() const { return m_client_state.client_handle; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-09 11:40:34 -04:00
										 |  |  |     void create_new_process_for_cross_site_navigation(URL::URL const&); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-20 10:50:05 -04:00
										 |  |  |     void server_did_paint(Badge<WebContentClient>, i32 bitmap_id, Gfx::IntSize size); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-28 07:48:49 -04:00
										 |  |  |     void set_window_position(Gfx::IntPoint); | 
					
						
							|  |  |  |     void set_window_size(Gfx::IntSize); | 
					
						
							| 
									
										
										
										
											2024-10-28 23:37:11 -04:00
										 |  |  |     void did_update_window_rect(); | 
					
						
							| 
									
										
										
										
											2024-10-28 07:48:49 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-13 11:24:16 -05:00
										 |  |  |     void set_system_visibility_state(Web::HTML::VisibilityState); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-18 16:22:27 +13:00
										 |  |  |     void load(URL::URL const&); | 
					
						
							| 
									
										
										
										
											2023-09-17 17:12:17 +02:00
										 |  |  |     void load_html(StringView); | 
					
						
							| 
									
										
										
										
											2023-01-12 20:30:06 +00:00
										 |  |  |     void load_empty_document(); | 
					
						
							| 
									
										
										
										
											2024-04-13 18:51:27 +02:00
										 |  |  |     void reload(); | 
					
						
							| 
									
										
										
										
											2024-04-13 22:33:48 +02: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(); | 
					
						
							| 
									
										
										
										
											2024-12-23 22:15:06 +01:00
										 |  |  |     void set_zoom(double zoom_level); | 
					
						
							| 
									
										
										
										
											2023-01-12 19:49:49 +00:00
										 |  |  |     void reset_zoom(); | 
					
						
							| 
									
										
										
										
											2023-03-26 19:41:56 +01:00
										 |  |  |     float zoom_level() const { return m_zoom_level; } | 
					
						
							| 
									
										
										
										
											2023-12-12 22:33:36 +01:00
										 |  |  |     float device_pixel_ratio() const { return m_device_pixel_ratio; } | 
					
						
							| 
									
										
										
										
											2025-07-25 13:10:00 +01:00
										 |  |  |     double maximum_frames_per_second() const { return m_maximum_frames_per_second; } | 
					
						
							| 
									
										
										
										
											2023-01-12 20:22:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-03 22:07:49 -05:00
										 |  |  |     void enqueue_input_event(Web::InputEvent); | 
					
						
							| 
									
										
										
										
											2024-09-12 12:56:31 -04:00
										 |  |  |     void did_finish_handling_input_event(Badge<WebContentClient>, Web::EventResult event_result); | 
					
						
							| 
									
										
										
										
											2024-03-03 22:07:49 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-12 20:44:42 +00:00
										 |  |  |     void set_preferred_color_scheme(Web::CSS::PreferredColorScheme); | 
					
						
							| 
									
										
										
										
											2024-06-13 01:03:56 +02:00
										 |  |  |     void set_preferred_contrast(Web::CSS::PreferredContrast); | 
					
						
							| 
									
										
										
										
											2024-06-13 16:15:59 +02:00
										 |  |  |     void set_preferred_motion(Web::CSS::PreferredMotion); | 
					
						
							| 
									
										
										
										
											2024-07-02 20:29:43 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-16 17:49:34 +03:30
										 |  |  |     ByteString selected_text(); | 
					
						
							| 
									
										
										
										
											2023-10-23 16:52:57 -04:00
										 |  |  |     Optional<String> selected_text_with_whitespace_collapsed(); | 
					
						
							| 
									
										
										
										
											2023-01-12 20:42:42 +00:00
										 |  |  |     void select_all(); | 
					
						
							| 
									
										
										
										
											2024-05-31 16:01:34 -04:00
										 |  |  |     void find_in_page(String const& query, CaseSensitivity = CaseSensitivity::CaseInsensitive); | 
					
						
							| 
									
										
										
										
											2024-05-29 20:09:33 +01:00
										 |  |  |     void find_in_page_next_match(); | 
					
						
							|  |  |  |     void find_in_page_previous_match(); | 
					
						
							| 
									
										
										
										
											2024-03-22 11:56:49 +01: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(); | 
					
						
							|  |  |  |     void inspect_accessibility_tree(); | 
					
						
							| 
									
										
										
										
											2023-12-30 09:42:24 -05:00
										 |  |  |     void get_hovered_node_id(); | 
					
						
							| 
									
										
										
										
											2023-01-12 20:22:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-20 16:56:46 +00:00
										 |  |  |     void inspect_dom_node(Web::UniqueNodeID node_id, DOMNodeProperties::Type, Optional<Web::CSS::PseudoElement> pseudo_element); | 
					
						
							| 
									
										
										
										
											2025-02-21 09:34:02 -05:00
										 |  |  |     void clear_inspected_dom_node(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-20 16:56:46 +00:00
										 |  |  |     void highlight_dom_node(Web::UniqueNodeID node_id, Optional<Web::CSS::PseudoElement> pseudo_element); | 
					
						
							| 
									
										
										
										
											2025-02-21 09:34:02 -05:00
										 |  |  |     void clear_highlighted_dom_node(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-06 17:32:43 -05:00
										 |  |  |     void set_listen_for_dom_mutations(bool); | 
					
						
							| 
									
										
										
										
											2025-03-10 18:15:31 -04:00
										 |  |  |     void get_dom_node_inner_html(Web::UniqueNodeID node_id); | 
					
						
							| 
									
										
										
										
											2025-03-10 17:36:41 -04:00
										 |  |  |     void get_dom_node_outer_html(Web::UniqueNodeID node_id); | 
					
						
							|  |  |  |     void set_dom_node_outer_html(Web::UniqueNodeID node_id, String const& html); | 
					
						
							| 
									
										
										
										
											2025-03-08 11:00:03 -05:00
										 |  |  |     void set_dom_node_text(Web::UniqueNodeID node_id, String const& text); | 
					
						
							|  |  |  |     void set_dom_node_tag(Web::UniqueNodeID node_id, String const& name); | 
					
						
							|  |  |  |     void add_dom_node_attributes(Web::UniqueNodeID node_id, ReadonlySpan<Attribute> attributes); | 
					
						
							|  |  |  |     void replace_dom_node_attribute(Web::UniqueNodeID node_id, String const& name, ReadonlySpan<Attribute> replacement_attributes); | 
					
						
							| 
									
										
										
										
											2024-10-20 10:37:44 +02:00
										 |  |  |     void create_child_element(Web::UniqueNodeID node_id); | 
					
						
							|  |  |  |     void create_child_text_node(Web::UniqueNodeID node_id); | 
					
						
							| 
									
										
										
										
											2025-03-10 18:01:29 -04:00
										 |  |  |     void insert_dom_node_before(Web::UniqueNodeID node_id, Web::UniqueNodeID parent_node_id, Optional<Web::UniqueNodeID> sibling_node_id); | 
					
						
							| 
									
										
										
										
											2024-10-20 10:37:44 +02:00
										 |  |  |     void clone_dom_node(Web::UniqueNodeID node_id); | 
					
						
							|  |  |  |     void remove_dom_node(Web::UniqueNodeID node_id); | 
					
						
							| 
									
										
										
										
											2023-11-19 10:42:11 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-23 11:18:35 +01:00
										 |  |  |     void list_style_sheets(); | 
					
						
							|  |  |  |     void request_style_sheet_source(Web::CSS::StyleSheetIdentifier const&); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-16 17:49:34 +03:30
										 |  |  |     void debug_request(ByteString const& request, ByteString const& argument = {}); | 
					
						
							| 
									
										
										
										
											2023-01-12 20:34:08 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-08 11:00:03 -05:00
										 |  |  |     void run_javascript(String const&); | 
					
						
							|  |  |  |     void js_console_input(String const&); | 
					
						
							| 
									
										
										
										
											2023-05-17 11:54:36 -04:00
										 |  |  |     void js_console_request_messages(i32 start_index); | 
					
						
							| 
									
										
										
										
											2023-01-12 20:39:08 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-17 14:23:34 -04:00
										 |  |  |     void alert_closed(); | 
					
						
							|  |  |  |     void confirm_closed(bool accepted); | 
					
						
							| 
									
										
										
										
											2025-03-08 11:00:03 -05:00
										 |  |  |     void prompt_closed(Optional<String> const& response); | 
					
						
							| 
									
										
										
										
											2023-12-11 06:53:10 +01:00
										 |  |  |     void color_picker_update(Optional<Color> picked_color, Web::HTML::ColorPickerUpdateState state); | 
					
						
							| 
									
										
										
										
											2024-02-25 13:02:47 -05:00
										 |  |  |     void file_picker_closed(Vector<Web::HTML::SelectedFile> selected_files); | 
					
						
							| 
									
										
										
										
											2024-04-03 19:19:08 +02:00
										 |  |  |     void select_dropdown_closed(Optional<u32> const& selected_item_id); | 
					
						
							| 
									
										
										
										
											2023-05-17 14:23:34 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-01 11:38:31 -04:00
										 |  |  |     void retrieved_clipboard_entries(u64 request_id, ReadonlySpan<Web::Clipboard::SystemClipboardItem>); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-16 10:51:38 -04:00
										 |  |  |     void toggle_media_play_state(); | 
					
						
							| 
									
										
										
										
											2023-06-16 11:29:54 -04:00
										 |  |  |     void toggle_media_mute_state(); | 
					
						
							| 
									
										
										
										
											2023-06-16 10:51:38 -04:00
										 |  |  |     void toggle_media_loop_state(); | 
					
						
							|  |  |  |     void toggle_media_controls_state(); | 
					
						
							| 
									
										
										
										
											2023-05-15 11:17:58 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-30 09:41:15 -04:00
										 |  |  |     Web::HTML::MuteState page_mute_state() const { return m_mute_state; } | 
					
						
							|  |  |  |     void toggle_page_mute_state(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-26 19:27:06 -04: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 23:12:55 +02:00
										 |  |  |     void did_update_navigation_buttons_state(Badge<WebContentClient>, bool back_enabled, bool forward_enabled) const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-17 18:50:57 +03: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 21:34:51 +03: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 18:50:57 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-17 09:53:13 -04:00
										 |  |  |     enum class ScreenshotType { | 
					
						
							|  |  |  |         Visible, | 
					
						
							|  |  |  |         Full, | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2023-12-31 09:51:02 -05:00
										 |  |  |     NonnullRefPtr<Core::Promise<LexicalPath>> take_screenshot(ScreenshotType); | 
					
						
							| 
									
										
										
										
											2024-10-20 10:37:44 +02:00
										 |  |  |     NonnullRefPtr<Core::Promise<LexicalPath>> take_dom_node_screenshot(Web::UniqueNodeID); | 
					
						
							| 
									
										
										
										
											2023-12-31 09:51:02 -05:00
										 |  |  |     virtual void did_receive_screenshot(Badge<WebContentClient>, Gfx::ShareableBitmap const&); | 
					
						
							| 
									
										
										
										
											2023-05-17 09:53:13 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-19 10:40:00 -04:00
										 |  |  |     NonnullRefPtr<Core::Promise<String>> request_internal_page_info(PageInfoType); | 
					
						
							|  |  |  |     void did_receive_internal_page_info(Badge<WebContentClient>, PageInfoType, String const&); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-12 13:25:06 +01:00
										 |  |  |     ErrorOr<LexicalPath> dump_gc_graph(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-08 11:00:03 -05:00
										 |  |  |     void set_user_style_sheet(String const& source); | 
					
						
							| 
									
										
										
										
											2023-08-26 13:34:59 -04:00
										 |  |  |     // 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-05-20 10:50:05 -04:00
										 |  |  |     Function<void()> on_ready_to_paint; | 
					
						
							| 
									
										
										
										
											2024-01-30 20:05:00 -07:00
										 |  |  |     Function<String(Web::HTML::ActivateTab, Web::HTML::WebViewHints, Optional<u64>)> on_new_web_view; | 
					
						
							| 
									
										
										
										
											2023-05-17 12:37:31 -04:00
										 |  |  |     Function<void()> on_activate_tab; | 
					
						
							|  |  |  |     Function<void()> on_close; | 
					
						
							|  |  |  |     Function<void(Gfx::IntPoint screen_position)> on_context_menu_request; | 
					
						
							| 
									
										
										
										
											2024-03-28 22:02:55 -04:00
										 |  |  |     Function<void(URL::URL const&, Gfx::IntPoint screen_position)> on_link_context_menu_request; | 
					
						
							| 
									
										
										
										
											2025-01-10 20:33:27 +11:00
										 |  |  |     Function<void(URL::URL const&, Gfx::IntPoint screen_position, Optional<Gfx::ShareableBitmap> const&)> on_image_context_menu_request; | 
					
						
							| 
									
										
										
										
											2023-06-16 10:51:38 -04:00
										 |  |  |     Function<void(Gfx::IntPoint screen_position, Web::Page::MediaContextMenu const&)> on_media_context_menu_request; | 
					
						
							| 
									
										
										
										
											2024-03-28 22:02:55 -04:00
										 |  |  |     Function<void(URL::URL const&)> on_link_hover; | 
					
						
							| 
									
										
										
										
											2023-05-17 12:37:31 -04:00
										 |  |  |     Function<void()> on_link_unhover; | 
					
						
							| 
									
										
										
										
											2024-03-28 22:02:55 -04: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; | 
					
						
							| 
									
										
										
										
											2025-07-28 16:51:01 -04:00
										 |  |  |     Function<void(Utf16String const&)> on_title_change; | 
					
						
							| 
									
										
										
										
											2024-04-14 10:27:20 +02:00
										 |  |  |     Function<void(URL::URL const&)> on_url_change; | 
					
						
							| 
									
										
										
										
											2024-03-28 22:02:55 -04:00
										 |  |  |     Function<void(URL::URL const&, bool)> on_load_start; | 
					
						
							|  |  |  |     Function<void(URL::URL const&)> on_load_finish; | 
					
						
							| 
									
										
										
										
											2023-12-16 17:49:34 +03:30
										 |  |  |     Function<void(ByteString const& path, i32)> on_request_file; | 
					
						
							| 
									
										
										
										
											2023-05-17 12:37:31 -04:00
										 |  |  |     Function<void(Gfx::Bitmap const&)> on_favicon_change; | 
					
						
							| 
									
										
										
										
											2025-02-20 12:17:29 +00:00
										 |  |  |     Function<void(Gfx::Cursor const&)> on_cursor_change; | 
					
						
							| 
									
										
										
										
											2024-07-02 16:48:57 +02:00
										 |  |  |     Function<void(Gfx::IntPoint, ByteString const&)> on_request_tooltip_override; | 
					
						
							|  |  |  |     Function<void()> on_stop_tooltip_override; | 
					
						
							| 
									
										
										
										
											2024-07-02 14:16:24 +02:00
										 |  |  |     Function<void(ByteString const&)> on_enter_tooltip_area; | 
					
						
							| 
									
										
										
										
											2023-08-23 11:11:39 -04:00
										 |  |  |     Function<void()> on_leave_tooltip_area; | 
					
						
							| 
									
										
										
										
											2023-05-17 14:23:34 -04: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 17:20:15 -04:00
										 |  |  |     Function<void(URL::URL const&, URL::URL const&, String const&)> on_received_source; | 
					
						
							| 
									
										
										
										
											2025-02-21 12:39:43 -05:00
										 |  |  |     Function<void(JsonObject)> on_received_dom_tree; | 
					
						
							|  |  |  |     Function<void(DOMNodeProperties)> on_received_dom_node_properties; | 
					
						
							|  |  |  |     Function<void(JsonObject)> on_received_accessibility_tree; | 
					
						
							| 
									
										
										
										
											2024-10-20 10:37:44 +02:00
										 |  |  |     Function<void(Web::UniqueNodeID)> on_received_hovered_node_id; | 
					
						
							| 
									
										
										
										
											2025-03-06 17:32:43 -05:00
										 |  |  |     Function<void(Mutation)> on_dom_mutation_received; | 
					
						
							| 
									
										
										
										
											2025-04-07 10:46:22 +00:00
										 |  |  |     Function<void(Optional<Web::UniqueNodeID> const& node_id)> on_finished_editing_dom_node; | 
					
						
							| 
									
										
										
										
											2025-03-10 17:36:41 -04:00
										 |  |  |     Function<void(String)> on_received_dom_node_html; | 
					
						
							| 
									
										
										
										
											2025-03-14 16:22:16 -04:00
										 |  |  |     Function<void(Vector<Web::CSS::StyleSheetIdentifier>)> on_received_style_sheet_list; | 
					
						
							|  |  |  |     Function<void(Web::CSS::StyleSheetIdentifier const&, URL::URL const&, String const&)> on_received_style_sheet_source; | 
					
						
							| 
									
										
										
										
											2025-02-24 11:57:33 -05:00
										 |  |  |     Function<void(JsonValue)> on_received_js_console_result; | 
					
						
							| 
									
										
										
										
											2025-03-04 07:56:42 -05:00
										 |  |  |     Function<void(i32 message_id)> on_console_message_available; | 
					
						
							| 
									
										
										
										
											2025-03-25 10:11:17 -04:00
										 |  |  |     Function<void(i32 start_index, Vector<ConsoleOutput>)> on_received_console_messages; | 
					
						
							| 
									
										
										
										
											2023-05-17 12:37:31 -04:00
										 |  |  |     Function<void(i32 count_waiting)> on_resource_status_change; | 
					
						
							|  |  |  |     Function<void()> on_restore_window; | 
					
						
							| 
									
										
										
										
											2024-10-28 23:37:11 -04:00
										 |  |  |     Function<void(Gfx::IntPoint)> on_reposition_window; | 
					
						
							|  |  |  |     Function<void(Gfx::IntSize)> on_resize_window; | 
					
						
							| 
									
										
										
										
											2024-10-28 23:45:18 -04:00
										 |  |  |     Function<void()> on_maximize_window; | 
					
						
							|  |  |  |     Function<void()> on_minimize_window; | 
					
						
							|  |  |  |     Function<void()> on_fullscreen_window; | 
					
						
							| 
									
										
										
										
											2023-09-04 11:32:40 +02:00
										 |  |  |     Function<void(Color current_color)> on_request_color_picker; | 
					
						
							| 
									
										
										
										
											2024-03-14 12:26:00 -04:00
										 |  |  |     Function<void(Web::HTML::FileFilter const& accepted_file_types, Web::HTML::AllowMultipleFiles)> on_request_file_picker; | 
					
						
							| 
									
										
										
										
											2023-12-07 15:53:49 +01:00
										 |  |  |     Function<void(Gfx::IntPoint content_position, i32 minimum_width, Vector<Web::HTML::SelectItem> items)> on_request_select_dropdown; | 
					
						
							| 
									
										
										
										
											2024-03-03 22:07:49 -05:00
										 |  |  |     Function<void(Web::KeyEvent const&)> on_finish_handling_key_event; | 
					
						
							| 
									
										
										
										
											2024-08-17 13:36:28 -04:00
										 |  |  |     Function<void(Web::DragEvent const&)> on_finish_handling_drag_event; | 
					
						
							| 
									
										
										
										
											2025-03-18 17:37:32 +01:00
										 |  |  |     Function<void(String const&)> on_test_finish; | 
					
						
							| 
									
										
										
										
											2024-12-19 14:16:05 +00:00
										 |  |  |     Function<void(double milliseconds)> on_set_test_timeout; | 
					
						
							| 
									
										
										
										
											2025-07-16 10:24:15 +02:00
										 |  |  |     Function<void(JsonValue)> on_reference_test_metadata; | 
					
						
							| 
									
										
										
										
											2024-12-23 22:15:06 +01:00
										 |  |  |     Function<void(double factor)> on_set_browser_zoom; | 
					
						
							| 
									
										
										
										
											2024-06-09 18:35:32 +01:00
										 |  |  |     Function<void(size_t current_match_index, Optional<size_t> const& total_match_count)> on_find_in_page; | 
					
						
							| 
									
										
										
										
											2023-09-19 01:51:48 +02:00
										 |  |  |     Function<void(Gfx::Color)> on_theme_color_change; | 
					
						
							| 
									
										
										
										
											2025-05-01 11:38:31 -04:00
										 |  |  |     Function<void(Web::Clipboard::SystemClipboardRepresentation, String const&)> on_insert_clipboard_entry; | 
					
						
							| 
									
										
										
										
											2025-09-04 08:53:57 -04:00
										 |  |  |     Function<String()> on_request_clipboard_text; | 
					
						
							| 
									
										
										
										
											2025-05-01 11:38:31 -04:00
										 |  |  |     Function<void(u64 request_id)> on_request_clipboard_entries; | 
					
						
							| 
									
										
										
										
											2024-03-26 19:27:06 -04:00
										 |  |  |     Function<void(Web::HTML::AudioPlayState)> on_audio_play_state_changed; | 
					
						
							| 
									
										
										
										
											2024-04-13 23:12:55 +02:00
										 |  |  |     Function<void(bool, bool)> on_navigation_buttons_state_changed; | 
					
						
							| 
									
										
										
										
											2024-11-13 16:35:17 -05:00
										 |  |  |     Function<void()> on_web_content_crashed; | 
					
						
							| 
									
										
										
										
											2023-01-12 19:27:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-03 17:53:55 +03:00
										 |  |  |     virtual Web::DevicePixelSize viewport_size() const = 0; | 
					
						
							| 
									
										
										
										
											2023-05-17 10:12:13 -04: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 07:59:51 +02: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 16:44:20 +02:00
										 |  |  |     ViewImplementation(); | 
					
						
							| 
									
										
										
										
											2023-05-15 07:59:51 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-12 19:27:17 +00:00
										 |  |  |     WebContentClient& client(); | 
					
						
							|  |  |  |     WebContentClient const& client() const; | 
					
						
							| 
									
										
										
										
											2024-02-02 18:00:48 -07: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 07:59:51 +02:00
										 |  |  |     void handle_resize(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-30 09:12:14 -07:00
										 |  |  |     enum class CreateNewClient { | 
					
						
							|  |  |  |         No, | 
					
						
							|  |  |  |         Yes, | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2024-11-13 16:35:17 -05:00
										 |  |  |     virtual void initialize_client(CreateNewClient = CreateNewClient::Yes); | 
					
						
							| 
									
										
										
										
											2023-04-15 01:04:28 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-12 08:43:37 -05:00
										 |  |  |     enum class LoadErrorPage { | 
					
						
							|  |  |  |         No, | 
					
						
							|  |  |  |         Yes, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     void handle_web_content_process_crash(LoadErrorPage = LoadErrorPage::Yes); | 
					
						
							| 
									
										
										
										
											2023-05-17 09:53:13 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-23 11:15:31 -05:00
										 |  |  |     virtual void default_zoom_level_factor_changed() override; | 
					
						
							| 
									
										
										
										
											2025-04-03 13:53:02 -04:00
										 |  |  |     virtual void languages_changed() override; | 
					
						
							| 
									
										
										
										
											2025-03-29 08:19:00 -04:00
										 |  |  |     virtual void autoplay_settings_changed() override; | 
					
						
							| 
									
										
										
										
											2025-04-02 09:47:44 -04:00
										 |  |  |     virtual void do_not_track_changed() override; | 
					
						
							| 
									
										
										
										
											2025-03-29 08:19:00 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-12 19:27:17 +00:00
										 |  |  |     struct SharedBitmap { | 
					
						
							|  |  |  |         i32 id { -1 }; | 
					
						
							| 
									
										
										
										
											2023-12-14 07:17:00 +01:00
										 |  |  |         Web::DevicePixelSize last_painted_size; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:50:18 -06:00
										 |  |  |         RefPtr<Gfx::Bitmap const> bitmap; | 
					
						
							| 
									
										
										
										
											2023-01-12 19:27:17 +00:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     struct ClientState { | 
					
						
							|  |  |  |         RefPtr<WebContentClient> client; | 
					
						
							| 
									
										
										
										
											2023-03-16 18:24:30 +03:00
										 |  |  |         String client_handle; | 
					
						
							| 
									
										
										
										
											2023-01-12 19:27:17 +00:00
										 |  |  |         SharedBitmap front_bitmap; | 
					
						
							|  |  |  |         SharedBitmap back_bitmap; | 
					
						
							| 
									
										
										
										
											2024-01-30 09:12:14 -07: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 16:22:27 +13:00
										 |  |  |     URL::URL m_url; | 
					
						
							| 
									
										
										
										
											2025-07-28 16:51:01 -04:00
										 |  |  |     Utf16String m_title; | 
					
						
							| 
									
										
										
										
											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 }; | 
					
						
							| 
									
										
										
										
											2025-07-25 13:10:00 +01:00
										 |  |  |     double m_maximum_frames_per_second { 60.0 }; | 
					
						
							| 
									
										
										
										
											2023-05-15 07:59:51 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-03 22:07:49 -05:00
										 |  |  |     Queue<Web::InputEvent> m_pending_input_events; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-15 07:59:51 +02:00
										 |  |  |     RefPtr<Core::Timer> m_backing_store_shrink_timer; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:50:18 -06:00
										 |  |  |     RefPtr<Gfx::Bitmap const> m_backup_bitmap; | 
					
						
							| 
									
										
										
										
											2023-12-14 07:17:00 +01:00
										 |  |  |     Web::DevicePixelSize m_backup_bitmap_size; | 
					
						
							| 
									
										
										
										
											2023-05-27 10:46:45 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  |     size_t m_crash_count = 0; | 
					
						
							|  |  |  |     RefPtr<Core::Timer> m_repeated_crash_timer; | 
					
						
							| 
									
										
										
										
											2023-12-31 09:51:02 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     RefPtr<Core::Promise<LexicalPath>> m_pending_screenshot; | 
					
						
							| 
									
										
										
										
											2024-09-19 10:40:00 -04:00
										 |  |  |     RefPtr<Core::Promise<String>> m_pending_info_request; | 
					
						
							| 
									
										
										
										
											2024-03-26 19:27:06 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-13 11:24:16 -05:00
										 |  |  |     Web::HTML::VisibilityState m_system_visibility_state { Web::HTML::VisibilityState::Hidden }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-26 19:27:06 -04:00
										 |  |  |     Web::HTML::AudioPlayState m_audio_play_state { Web::HTML::AudioPlayState::Paused }; | 
					
						
							| 
									
										
										
										
											2024-03-30 09:34:23 -04:00
										 |  |  |     size_t m_number_of_elements_playing_audio { 0 }; | 
					
						
							| 
									
										
										
										
											2024-03-30 09:41:15 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     Web::HTML::MuteState m_mute_state { Web::HTML::MuteState::Unmuted }; | 
					
						
							| 
									
										
										
										
											2025-02-15 08:06:36 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // FIXME: Reconcile this ID with `page_id`. The latter is only unique per WebContent connection, whereas the view ID
 | 
					
						
							|  |  |  |     //        is required to be globally unique for Firefox DevTools.
 | 
					
						
							|  |  |  |     u64 m_view_id { 0 }; | 
					
						
							| 
									
										
										
										
											2022-10-05 14:32:17 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |