mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
LibWeb: Add an InternalAnimationTimeline object
This will allow fine grained control over animation times, which will allow us to write timing tests that can reliably pass on the much slower CI machines.
This commit is contained in:
parent
8d765f1084
commit
a1f4d1875e
Notes:
sideshowbarker
2024-07-18 03:23:00 +09:00
Author: https://github.com/mattco98 Commit: https://github.com/SerenityOS/serenity/commit/a1f4d1875e Pull-request: https://github.com/SerenityOS/serenity/pull/23750
8 changed files with 87 additions and 1 deletions
|
@ -435,6 +435,7 @@ set(SOURCES
|
|||
Infra/JSON.cpp
|
||||
Infra/Strings.cpp
|
||||
Internals/Inspector.cpp
|
||||
Internals/InternalAnimationTimeline.cpp
|
||||
Internals/Internals.cpp
|
||||
IntersectionObserver/IntersectionObserver.cpp
|
||||
IntersectionObserver/IntersectionObserverEntry.cpp
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Matthew Olsson <mattco@serenityos.org>.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Internals/InternalAnimationTimeline.h>
|
||||
|
||||
namespace Web::Internals {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(InternalAnimationTimeline);
|
||||
|
||||
void InternalAnimationTimeline::set_current_time(Optional<double> current_time)
|
||||
{
|
||||
// Do nothing
|
||||
(void)current_time;
|
||||
}
|
||||
|
||||
void InternalAnimationTimeline::set_time(Optional<double> time)
|
||||
{
|
||||
Base::set_current_time(time);
|
||||
}
|
||||
|
||||
InternalAnimationTimeline::InternalAnimationTimeline(JS::Realm& realm)
|
||||
: AnimationTimeline(realm)
|
||||
{
|
||||
m_current_time = 0.0;
|
||||
}
|
||||
|
||||
void InternalAnimationTimeline::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(InternalAnimationTimeline);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Matthew Olsson <mattco@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/Animations/AnimationTimeline.h>
|
||||
|
||||
namespace Web::Internals {
|
||||
|
||||
class InternalAnimationTimeline : public Web::Animations::AnimationTimeline {
|
||||
public:
|
||||
WEB_PLATFORM_OBJECT(InternalAnimationTimeline, Web::Animations::AnimationTimeline);
|
||||
JS_DECLARE_ALLOCATOR(InternalAnimationTimeline);
|
||||
|
||||
virtual void set_current_time(Optional<double> current_time) override;
|
||||
|
||||
void set_time(Optional<double> time);
|
||||
|
||||
private:
|
||||
explicit InternalAnimationTimeline(JS::Realm&);
|
||||
virtual ~InternalAnimationTimeline() override = default;
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#import <Animations/AnimationTimeline.idl>
|
||||
|
||||
[Exposed=Nobody]
|
||||
interface InternalAnimationTimeline : AnimationTimeline {
|
||||
undefined setTime(double? time);
|
||||
};
|
|
@ -101,4 +101,10 @@ WebIDL::ExceptionOr<bool> Internals::dispatch_user_activated_event(DOM::EventTar
|
|||
return target.dispatch_event(event);
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<InternalAnimationTimeline> Internals::create_internal_animation_timeline()
|
||||
{
|
||||
auto& realm = this->realm();
|
||||
return realm.heap().allocate<InternalAnimationTimeline>(realm, realm);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/Internals/InternalAnimationTimeline.h>
|
||||
|
||||
namespace Web::Internals {
|
||||
|
||||
|
@ -31,6 +32,8 @@ public:
|
|||
|
||||
WebIDL::ExceptionOr<bool> dispatch_user_activated_event(DOM::EventTarget&, DOM::Event& event);
|
||||
|
||||
JS::NonnullGCPtr<InternalAnimationTimeline> create_internal_animation_timeline();
|
||||
|
||||
private:
|
||||
explicit Internals(JS::Realm&);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#import <DOM/EventTarget.idl>
|
||||
#import <HTML/HTMLElement.idl>
|
||||
#import <Internals/InternalAnimationTimeline.idl>
|
||||
|
||||
[Exposed=Nobody] interface Internals {
|
||||
[Exposed=Nobody]
|
||||
interface Internals {
|
||||
|
||||
undefined signalTextTestIsDone();
|
||||
undefined gc();
|
||||
|
@ -16,4 +18,5 @@
|
|||
|
||||
boolean dispatchUserActivatedEvent(EventTarget target, Event event);
|
||||
|
||||
InternalAnimationTimeline createInternalAnimationTimeline();
|
||||
};
|
||||
|
|
|
@ -209,6 +209,7 @@ libweb_js_bindings(HTML/WorkerLocation)
|
|||
libweb_js_bindings(HTML/WorkerNavigator)
|
||||
libweb_js_bindings(HighResolutionTime/Performance)
|
||||
libweb_js_bindings(Internals/Inspector)
|
||||
libweb_js_bindings(Internals/InternalAnimationTimeline)
|
||||
libweb_js_bindings(Internals/Internals)
|
||||
libweb_js_bindings(IntersectionObserver/IntersectionObserver)
|
||||
libweb_js_bindings(IntersectionObserver/IntersectionObserverEntry)
|
||||
|
|
Loading…
Add table
Reference in a new issue