1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 05:27:14 +09:00
ladybird/Libraries/LibWeb/SVG/SVGAnimatedNumber.cpp
Andreas Kling a6dfc74e93 LibWeb: Only set prototype once for object with IDL interface
Before this change, we were going through the chain of base classes for
each IDL interface object and having them set the prototype to their
prototype.

Instead of doing that, reorder things so that we set the right prototype
immediately in Foo::initialize(), and then don't bother in all the base
class overrides.

This knocks off a ~1% profile item on Speedometer 3.
2025-04-20 18:43:11 +02:00

35 lines
856 B
C++

/*
* Copyright (c) 2023, MacDue <macdue@dueutil.tech>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Bindings/SVGAnimatedNumberPrototype.h>
#include <LibWeb/SVG/SVGAnimatedNumber.h>
namespace Web::SVG {
GC_DEFINE_ALLOCATOR(SVGAnimatedNumber);
GC::Ref<SVGAnimatedNumber> SVGAnimatedNumber::create(JS::Realm& realm, float base_val, float anim_val)
{
return realm.create<SVGAnimatedNumber>(realm, base_val, anim_val);
}
SVGAnimatedNumber::SVGAnimatedNumber(JS::Realm& realm, float base_val, float anim_val)
: PlatformObject(realm)
, m_base_val(base_val)
, m_anim_val(anim_val)
{
}
SVGAnimatedNumber::~SVGAnimatedNumber() = default;
void SVGAnimatedNumber::initialize(JS::Realm& realm)
{
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGAnimatedNumber);
Base::initialize(realm);
}
}