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/SVGTransform.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

87 lines
2.3 KiB
C++

/*
* Copyright (c) 2024, MacDue <macdue@dueutil.tech>
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Bindings/SVGTransformPrototype.h>
#include <LibWeb/SVG/SVGTransform.h>
namespace Web::SVG {
GC_DEFINE_ALLOCATOR(SVGTransform);
GC::Ref<SVGTransform> SVGTransform::create(JS::Realm& realm)
{
return realm.create<SVGTransform>(realm);
}
SVGTransform::SVGTransform(JS::Realm& realm)
: PlatformObject(realm)
{
}
SVGTransform::~SVGTransform() = default;
void SVGTransform::initialize(JS::Realm& realm)
{
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGTransform);
Base::initialize(realm);
}
// https://svgwg.org/svg2-draft/single-page.html#coords-__svg__SVGTransform__type
SVGTransform::Type SVGTransform::type()
{
dbgln("FIXME: Implement SVGTransform::type()");
return SVGTransform::Type::Unknown;
}
// https://svgwg.org/svg2-draft/single-page.html#coords-__svg__SVGTransform__angle
float SVGTransform::angle()
{
dbgln("FIXME: Implement SVGTransform::angle()");
return 0;
}
// https://svgwg.org/svg2-draft/single-page.html#coords-__svg__SVGTransform__setTranslate
void SVGTransform::set_translate(float tx, float ty)
{
(void)tx;
(void)ty;
dbgln("FIXME: Implement SVGTransform::set_translate(float tx, float ty)");
}
// https://svgwg.org/svg2-draft/single-page.html#coords-__svg__SVGTransform__setScale
void SVGTransform::set_scale(float sx, float sy)
{
(void)sx;
(void)sy;
dbgln("FIXME: Implement SVGTransform::set_scale(float sx, float sy)");
}
// https://svgwg.org/svg2-draft/single-page.html#coords-__svg__SVGTransform__setRotate
void SVGTransform::set_rotate(float angle, float cx, float cy)
{
(void)angle;
(void)cx;
(void)cy;
dbgln("FIXME: Implement SVGTransform::set_rotate(float angle, float cx, float cy)");
}
// https://svgwg.org/svg2-draft/single-page.html#coords-__svg__SVGTransform__setSkewX
void SVGTransform::set_skew_x(float angle)
{
(void)angle;
dbgln("FIXME: Implement SVGTransform::set_skew_x(float angle)");
}
// https://svgwg.org/svg2-draft/single-page.html#coords-__svg__SVGTransform__setSkewY
void SVGTransform::set_skew_y(float angle)
{
(void)angle;
dbgln("FIXME: Implement SVGTransform::set_skew_y(float angle)");
}
}