1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 02:13:56 +09:00

LibWeb: Stub out SVGTransform

This commit is contained in:
MacDue 2024-03-31 14:41:00 +01:00 committed by Alexander Kalenik
parent ce11a34fc6
commit a6a40a5bc6
Notes: sideshowbarker 2024-07-17 18:49:10 +09:00
6 changed files with 86 additions and 0 deletions

View file

@ -68,6 +68,7 @@ static bool is_platform_object(Type const& type)
"ReadableStream"sv,
"Request"sv,
"Selection"sv,
"SVGTransform"sv,
"Table"sv,
"Text"sv,
"TextMetrics"sv,

View file

@ -622,6 +622,7 @@ set(SOURCES
SVG/SVGTextPathElement.cpp
SVG/SVGTextPositioningElement.cpp
SVG/SVGTitleElement.cpp
SVG/SVGTransform.cpp
SVG/SVGTSpanElement.cpp
SVG/SVGUseElement.cpp
SVG/TagNames.cpp

View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2024, MacDue <macdue@dueutil.tech>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/SVG/SVGTransform.h>
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGTransform);
JS::NonnullGCPtr<SVGTransform> SVGTransform::create(JS::Realm& realm)
{
return realm.heap().allocate<SVGTransform>(realm, realm);
}
SVGTransform::SVGTransform(JS::Realm& realm)
: PlatformObject(realm) {};
SVGTransform::~SVGTransform() = default;
void SVGTransform::initialize(JS::Realm& realm)
{
Base::initialize(realm);
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGTransform);
}
}

View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2024, MacDue <macdue@dueutil.tech>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Bindings/PlatformObject.h>
namespace Web::SVG {
// FIXME: This class is just a stub.
// https://svgwg.org/svg2-draft/single-page.html#coords-InterfaceSVGTransform
class SVGTransform final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(SVGTransform, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(SVGTransform);
public:
[[nodiscard]] static JS::NonnullGCPtr<SVGTransform> create(JS::Realm& realm);
virtual ~SVGTransform() override;
private:
SVGTransform(JS::Realm& realm);
virtual void initialize(JS::Realm& realm) override;
};
}

View file

@ -0,0 +1,24 @@
// https://svgwg.org/svg2-draft/single-page.html#coords-InterfaceSVGTransform
[Exposed=Window]
interface SVGTransform {
// Transform Types
const unsigned short SVG_TRANSFORM_UNKNOWN = 0;
const unsigned short SVG_TRANSFORM_MATRIX = 1;
const unsigned short SVG_TRANSFORM_TRANSLATE = 2;
const unsigned short SVG_TRANSFORM_SCALE = 3;
const unsigned short SVG_TRANSFORM_ROTATE = 4;
const unsigned short SVG_TRANSFORM_SKEWX = 5;
const unsigned short SVG_TRANSFORM_SKEWY = 6;
// FIXME: readonly attribute unsigned short type;
// FIXME: [SameObject] readonly attribute DOMMatrix matrix;
// FIXME: readonly attribute float angle;
// FIXME: undefined setMatrix(optional DOMMatrix2DInit matrix = {});
// FIXME: undefined setTranslate(float tx, float ty);
// FIXME: undefined setScale(float sx, float sy);
// FIXME: undefined setRotate(float angle, float cx, float cy);
// FIXME: undefined setSkewX(float angle);
// FIXME: undefined setSkewY(float angle);
};

View file

@ -269,6 +269,7 @@ libweb_js_bindings(SVG/SVGTextElement)
libweb_js_bindings(SVG/SVGTextPathElement)
libweb_js_bindings(SVG/SVGTextPositioningElement)
libweb_js_bindings(SVG/SVGTitleElement)
libweb_js_bindings(SVG/SVGTransform)
libweb_js_bindings(SVG/SVGTSpanElement)
libweb_js_bindings(SVG/SVGUseElement)
libweb_js_bindings(Selection/Selection)