ladybird/Libraries/LibWeb/CSS/CSSTransformComponent.h
Sam Atkins 8e86bf2dd0 LibWeb/CSS: Implement CSSTransformComponent
This is a base type for the various transform functions.

CSSMatrixComponent's to_string() can throw exceptions, so to_string() is
implemented that way. https://github.com/w3c/fxtf-drafts/issues/611

+9 WPT subtests.
2025-09-24 12:27:05 +01:00

41 lines
976 B
C++

/*
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Bindings/PlatformObject.h>
namespace Web::CSS {
// https://drafts.css-houdini.org/css-typed-om-1/#csstransformcomponent
class CSSTransformComponent : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(CSSTransformComponent, Bindings::PlatformObject);
GC_DECLARE_ALLOCATOR(CSSTransformComponent);
public:
enum class Is2D : u8 {
No,
Yes,
};
virtual void initialize(JS::Realm&) override;
virtual ~CSSTransformComponent() override;
virtual WebIDL::ExceptionOr<Utf16String> to_string() const = 0;
bool is_2d() const { return m_is_2d; }
virtual void set_is_2d(bool value) { m_is_2d = value; }
virtual WebIDL::ExceptionOr<GC::Ref<Geometry::DOMMatrix>> to_matrix() const = 0;
protected:
explicit CSSTransformComponent(JS::Realm&, Is2D is_2d);
private:
bool m_is_2d;
};
}