mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
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.
This commit is contained in:
Notes:
github-actions[bot]
2025-09-24 11:29:53 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/8e86bf2dd04 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6227
41
Libraries/LibWeb/CSS/CSSTransformComponent.h
Normal file
41
Libraries/LibWeb/CSS/CSSTransformComponent.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user