2023-07-21 11:59:49 +02:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2023, Andreas Kling <andreas@ladybird.org>
|
2023-07-21 11:59:49 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-03-27 15:30:54 +00:00
|
|
|
#include <LibWeb/Internals/InternalAnimationTimeline.h>
|
2025-03-16 09:32:07 -04:00
|
|
|
#include <LibWeb/Internals/InternalsBase.h>
|
2024-06-21 22:35:12 +01:00
|
|
|
#include <LibWeb/UIEvents/MouseButton.h>
|
2024-10-09 18:47:44 -04:00
|
|
|
#include <LibWeb/WebIDL/Types.h>
|
2023-07-21 11:59:49 +02:00
|
|
|
|
|
|
|
namespace Web::Internals {
|
|
|
|
|
2025-03-16 09:32:07 -04:00
|
|
|
class Internals final : public InternalsBase {
|
|
|
|
WEB_PLATFORM_OBJECT(Internals, InternalsBase);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(Internals);
|
2023-07-21 11:59:49 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
virtual ~Internals() override;
|
|
|
|
|
2025-03-18 17:37:32 +01:00
|
|
|
void signal_test_is_done(String const& text);
|
2024-12-19 14:16:05 +00:00
|
|
|
void set_test_timeout(double milliseconds);
|
2023-09-14 19:17:32 +02:00
|
|
|
|
2023-07-21 11:59:49 +02:00
|
|
|
void gc();
|
2023-08-08 22:44:52 +02:00
|
|
|
JS::Object* hit_test(double x, double y);
|
2023-07-21 11:59:49 +02:00
|
|
|
|
2024-10-09 18:47:44 -04:00
|
|
|
void send_text(HTML::HTMLElement&, String const&, WebIDL::UnsignedShort modifiers);
|
|
|
|
void send_key(HTML::HTMLElement&, String const&, WebIDL::UnsignedShort modifiers);
|
2023-11-30 12:54:30 -05:00
|
|
|
void commit_text();
|
|
|
|
|
2023-12-03 09:54:26 -05:00
|
|
|
void click(double x, double y);
|
2024-11-01 16:20:13 +01:00
|
|
|
void doubleclick(double x, double y);
|
2024-06-21 22:35:12 +01:00
|
|
|
void middle_click(double x, double y);
|
2024-12-06 16:29:40 +01:00
|
|
|
void mouse_down(double x, double y);
|
2024-03-24 22:07:02 +01:00
|
|
|
void move_pointer_to(double x, double y);
|
2024-02-09 18:14:53 +01:00
|
|
|
void wheel(double x, double y, double delta_x, double delta_y);
|
2023-12-03 09:54:26 -05:00
|
|
|
|
2024-02-24 16:28:53 -05:00
|
|
|
WebIDL::ExceptionOr<bool> dispatch_user_activated_event(DOM::EventTarget&, DOM::Event& event);
|
2023-11-10 16:19:37 -05:00
|
|
|
|
2024-09-14 21:16:46 -06:00
|
|
|
void spoof_current_url(String const& url);
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ref<InternalAnimationTimeline> create_internal_animation_timeline();
|
2024-03-27 15:30:54 +00:00
|
|
|
|
2024-08-17 13:29:55 -04:00
|
|
|
void simulate_drag_start(double x, double y, String const& name, String const& contents);
|
|
|
|
void simulate_drag_move(double x, double y);
|
|
|
|
void simulate_drop(double x, double y);
|
|
|
|
|
2024-10-22 13:47:06 -04:00
|
|
|
void enable_cookies_on_file_domains();
|
2024-10-13 08:56:46 -04:00
|
|
|
void expire_cookies_with_time_offset(WebIDL::LongLong seconds);
|
|
|
|
|
2024-12-06 16:29:11 +09:00
|
|
|
String get_computed_role(DOM::Element& element);
|
2024-10-30 02:35:14 +09:00
|
|
|
String get_computed_label(DOM::Element& element);
|
|
|
|
|
2024-12-02 19:43:51 -06:00
|
|
|
static u16 get_echo_server_port();
|
|
|
|
static void set_echo_server_port(u16 port);
|
|
|
|
|
2024-12-23 22:15:06 +01:00
|
|
|
void set_browser_zoom(double factor);
|
|
|
|
|
2024-12-09 21:53:31 +00:00
|
|
|
bool headless();
|
|
|
|
|
2023-07-21 11:59:49 +02:00
|
|
|
private:
|
|
|
|
explicit Internals(JS::Realm&);
|
2025-03-16 09:32:07 -04:00
|
|
|
|
2023-08-07 08:41:28 +02:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2024-06-21 22:35:12 +01:00
|
|
|
|
|
|
|
void click(double x, double y, UIEvents::MouseButton);
|
2024-12-06 16:29:40 +01:00
|
|
|
void mouse_down(double x, double y, UIEvents::MouseButton);
|
2023-07-21 11:59:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|