1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-24 21:25:07 +00:00
serenity/Userland/Libraries/LibWeb/Internals/Internals.h
Timothy Flynn 78d455e231 LibWeb: Add an Internals API to trigger a user-activated (trusted) event
Some DOM APIs are restricted to user-activated events. For example, you
can't just invoke `navigator.clipboard.writeText` from JS - it has to be
accompanied by a user gesture, such as a mouse-down event. This adds an
Internals API to simulate such a gesture.
2023-11-11 08:54:37 +01:00

31 lines
665 B
C++

/*
* Copyright (c) 2023, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Bindings/PlatformObject.h>
namespace Web::Internals {
class Internals final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(Internals, Bindings::PlatformObject);
public:
virtual ~Internals() override;
void signal_text_test_is_done();
void gc();
JS::Object* hit_test(double x, double y);
WebIDL::ExceptionOr<bool> dispatch_user_activated_event(DOM::EventTarget&, DOM::Event& event);
private:
explicit Internals(JS::Realm&);
virtual void initialize(JS::Realm&) override;
};
}