ladybird/Libraries/LibWeb/CSS/CSSTransformValue.h
Sam Atkins d5977b9f74 LibWeb/CSS: Implement CSSTransformValue
This is the final CSSStyleValue class used by the per-property test
harness, so those now actually run instead of throwing an exception on
load. 🎉

+39 WPT subtests. (Plus however many from the per-property tests finally
running.)

The two failing serialization tests are also failed by Safari in exactly
the same way, so that seems more like a spec issue. (The spec is
incomplete in quite a few places.) The failing subtest for toMatrix() is
also a spec issue: is2D is handled oddly by CSSMatrixComponent and this
subtest fails because of the `matrix` getter, which is unspecified. See
https://github.com/w3c/css-houdini-drafts/issues/1155 for details.
2025-09-24 12:27:05 +01:00

44 lines
1.4 KiB
C++

/*
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/CSS/CSSStyleValue.h>
#include <LibWeb/WebIDL/Types.h>
namespace Web::CSS {
// https://drafts.css-houdini.org/css-typed-om-1/#csstransformvalue
class CSSTransformValue final : public CSSStyleValue {
WEB_PLATFORM_OBJECT(CSSTransformValue, CSSStyleValue);
GC_DECLARE_ALLOCATOR(CSSTransformValue);
public:
[[nodiscard]] static GC::Ref<CSSTransformValue> create(JS::Realm&, Vector<GC::Ref<CSSTransformComponent>>);
static WebIDL::ExceptionOr<GC::Ref<CSSTransformValue>> construct_impl(JS::Realm&, GC::RootVector<GC::Root<CSSTransformComponent>>);
virtual ~CSSTransformValue() override;
WebIDL::UnsignedLong length() const;
virtual Optional<JS::Value> item_value(size_t index) const override;
virtual WebIDL::ExceptionOr<void> set_value_of_existing_indexed_property(u32, JS::Value) override;
virtual WebIDL::ExceptionOr<void> set_value_of_new_indexed_property(u32, JS::Value) override;
bool is_2d() const;
WebIDL::ExceptionOr<GC::Ref<Geometry::DOMMatrix>> to_matrix() const;
virtual WebIDL::ExceptionOr<String> to_string() const override;
private:
explicit CSSTransformValue(JS::Realm&, Vector<GC::Ref<CSSTransformComponent>>);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Visitor&) override;
Vector<GC::Ref<CSSTransformComponent>> m_transforms;
};
}