mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-05 10:42:51 +00:00
LibGC+Everywhere: Factor out a LibGC from LibJS
Resulting in a massive rename across almost everywhere! Alongside the namespace change, we now have the following names: * JS::NonnullGCPtr -> GC::Ref * JS::GCPtr -> GC::Ptr * JS::HeapFunction -> GC::Function * JS::CellImpl -> GC::Cell * JS::Handle -> GC::Root
This commit is contained in:
parent
ce23efc5f6
commit
f87041bf3a
Notes:
github-actions[bot]
2024-11-15 13:50:17 +00:00
Author: https://github.com/shannonbooth
Commit: f87041bf3a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2345
1722 changed files with 9939 additions and 9906 deletions
|
@ -18,7 +18,7 @@
|
|||
|
||||
namespace Web::Animations {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(KeyframeEffect);
|
||||
GC_DEFINE_ALLOCATOR(KeyframeEffect);
|
||||
|
||||
template<typename T>
|
||||
WebIDL::ExceptionOr<Variant<T, Vector<T>>> convert_value_to_maybe_list(JS::Realm& realm, JS::Value value, Function<WebIDL::ExceptionOr<T>(JS::Value)>& value_converter)
|
||||
|
@ -312,7 +312,7 @@ static bool is_loosely_sorted_by_offset(Vector<BaseKeyframe> const& keyframes)
|
|||
}
|
||||
|
||||
// https://www.w3.org/TR/web-animations-1/#process-a-keyframes-argument
|
||||
static WebIDL::ExceptionOr<Vector<BaseKeyframe>> process_a_keyframes_argument(JS::Realm& realm, JS::GCPtr<JS::Object> object)
|
||||
static WebIDL::ExceptionOr<Vector<BaseKeyframe>> process_a_keyframes_argument(JS::Realm& realm, GC::Ptr<JS::Object> object)
|
||||
{
|
||||
auto& vm = realm.vm();
|
||||
|
||||
|
@ -617,7 +617,7 @@ void KeyframeEffect::generate_initial_and_final_frames(RefPtr<KeyFrameSet> keyfr
|
|||
}
|
||||
|
||||
// https://www.w3.org/TR/web-animations-1/#animation-composite-order
|
||||
int KeyframeEffect::composite_order(JS::NonnullGCPtr<KeyframeEffect> a, JS::NonnullGCPtr<KeyframeEffect> b)
|
||||
int KeyframeEffect::composite_order(GC::Ref<KeyframeEffect> a, GC::Ref<KeyframeEffect> b)
|
||||
{
|
||||
// 1. Let the associated animation of an animation effect be the animation associated with the animation effect.
|
||||
auto a_animation = a->associated_animation();
|
||||
|
@ -646,16 +646,16 @@ int KeyframeEffect::composite_order(JS::NonnullGCPtr<KeyframeEffect> a, JS::Nonn
|
|||
return a_animation->global_animation_list_order() - b_animation->global_animation_list_order();
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<KeyframeEffect> KeyframeEffect::create(JS::Realm& realm)
|
||||
GC::Ref<KeyframeEffect> KeyframeEffect::create(JS::Realm& realm)
|
||||
{
|
||||
return realm.create<KeyframeEffect>(realm);
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/web-animations-1/#dom-keyframeeffect-keyframeeffect
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<KeyframeEffect>> KeyframeEffect::construct_impl(
|
||||
WebIDL::ExceptionOr<GC::Ref<KeyframeEffect>> KeyframeEffect::construct_impl(
|
||||
JS::Realm& realm,
|
||||
JS::Handle<DOM::Element> const& target,
|
||||
Optional<JS::Handle<JS::Object>> const& keyframes,
|
||||
GC::Root<DOM::Element> const& target,
|
||||
Optional<GC::Root<JS::Object>> const& keyframes,
|
||||
Variant<double, KeyframeEffectOptions> options)
|
||||
{
|
||||
// 1. Create a new KeyframeEffect object, effect.
|
||||
|
@ -717,7 +717,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<KeyframeEffect>> KeyframeEffect::construct_
|
|||
}
|
||||
|
||||
// https://www.w3.org/TR/web-animations-1/#dom-keyframeeffect-keyframeeffect-source
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<KeyframeEffect>> KeyframeEffect::construct_impl(JS::Realm& realm, JS::NonnullGCPtr<KeyframeEffect> source)
|
||||
WebIDL::ExceptionOr<GC::Ref<KeyframeEffect>> KeyframeEffect::construct_impl(JS::Realm& realm, GC::Ref<KeyframeEffect> source)
|
||||
{
|
||||
// 1. Create a new KeyframeEffect object, effect.
|
||||
auto effect = realm.create<KeyframeEffect>(realm);
|
||||
|
@ -798,7 +798,7 @@ Optional<CSS::Selector::PseudoElement::Type> KeyframeEffect::pseudo_element_type
|
|||
}
|
||||
|
||||
// https://www.w3.org/TR/web-animations-1/#dom-keyframeeffect-getkeyframes
|
||||
WebIDL::ExceptionOr<JS::MarkedVector<JS::Object*>> KeyframeEffect::get_keyframes()
|
||||
WebIDL::ExceptionOr<GC::MarkedVector<JS::Object*>> KeyframeEffect::get_keyframes()
|
||||
{
|
||||
if (m_keyframe_objects.size() != m_keyframes.size()) {
|
||||
auto& vm = this->vm();
|
||||
|
@ -833,17 +833,17 @@ WebIDL::ExceptionOr<JS::MarkedVector<JS::Object*>> KeyframeEffect::get_keyframes
|
|||
}
|
||||
}
|
||||
|
||||
JS::MarkedVector<JS::Object*> keyframes { heap() };
|
||||
GC::MarkedVector<JS::Object*> keyframes { heap() };
|
||||
for (auto const& keyframe : m_keyframe_objects)
|
||||
keyframes.append(keyframe);
|
||||
return keyframes;
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/web-animations-1/#dom-keyframeeffect-setkeyframes
|
||||
WebIDL::ExceptionOr<void> KeyframeEffect::set_keyframes(Optional<JS::Handle<JS::Object>> const& keyframe_object)
|
||||
WebIDL::ExceptionOr<void> KeyframeEffect::set_keyframes(Optional<GC::Root<JS::Object>> const& keyframe_object)
|
||||
{
|
||||
m_keyframe_objects.clear();
|
||||
m_keyframes = TRY(process_a_keyframes_argument(realm(), keyframe_object.has_value() ? JS::GCPtr { keyframe_object->ptr() } : JS::GCPtr<Object> {}));
|
||||
m_keyframes = TRY(process_a_keyframes_argument(realm(), keyframe_object.has_value() ? GC::Ptr { keyframe_object->ptr() } : GC::Ptr<Object> {}));
|
||||
// FIXME: After processing the keyframe argument, we need to turn the set of keyframes into a set of computed
|
||||
// keyframes using the procedure outlined in the second half of
|
||||
// https://www.w3.org/TR/web-animations-1/#calculating-computed-keyframes. For now, just compute the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue