2023-03-24 17:59:33 +00:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
|
2023-03-24 17:59:33 +00:00
|
|
|
* Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
|
2025-01-15 14:53:18 +00:00
|
|
|
* Copyright (c) 2021-2025, Sam Atkins <sam@ladybird.org>
|
2023-03-24 17:59:33 +00:00
|
|
|
* Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2025-08-08 10:11:51 +01:00
|
|
|
#include <LibWeb/CSS/StyleValues/StyleValue.h>
|
2023-03-24 17:59:33 +00:00
|
|
|
#include <LibWeb/CSS/TransformFunctions.h>
|
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
|
|
|
class TransformationStyleValue final : public StyleValueWithDefaultOperators<TransformationStyleValue> {
|
|
|
|
public:
|
2025-04-15 15:18:27 -06:00
|
|
|
static ValueComparingNonnullRefPtr<TransformationStyleValue const> create(PropertyID property, TransformFunction transform_function, StyleValueVector&& values)
|
2023-03-24 17:59:33 +00:00
|
|
|
{
|
2025-01-15 14:58:23 +00:00
|
|
|
return adopt_ref(*new (nothrow) TransformationStyleValue(property, transform_function, move(values)));
|
2023-03-24 17:59:33 +00:00
|
|
|
}
|
|
|
|
virtual ~TransformationStyleValue() override = default;
|
|
|
|
|
2025-01-15 14:53:18 +00:00
|
|
|
TransformFunction transform_function() const { return m_properties.transform_function; }
|
|
|
|
StyleValueVector const& values() const { return m_properties.values; }
|
2023-03-24 17:59:33 +00:00
|
|
|
|
2025-01-15 16:03:06 +00:00
|
|
|
Transformation to_transformation() const;
|
|
|
|
|
2024-12-07 00:59:49 +01:00
|
|
|
virtual String to_string(SerializationMode) const override;
|
2025-09-18 12:32:21 +01:00
|
|
|
GC::Ref<CSSTransformComponent> reify_a_transform_function(JS::Realm&) const;
|
2023-03-24 17:59:33 +00:00
|
|
|
|
|
|
|
bool properties_equal(TransformationStyleValue const& other) const { return m_properties == other.m_properties; }
|
|
|
|
|
|
|
|
private:
|
2025-01-15 14:58:23 +00:00
|
|
|
TransformationStyleValue(PropertyID property, TransformFunction transform_function, StyleValueVector&& values)
|
2023-03-24 17:59:33 +00:00
|
|
|
: StyleValueWithDefaultOperators(Type::Transformation)
|
2025-01-15 14:58:23 +00:00
|
|
|
, m_properties { .property = property, .transform_function = transform_function, .values = move(values) }
|
2023-03-24 17:59:33 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Properties {
|
2025-01-15 14:58:23 +00:00
|
|
|
PropertyID property;
|
|
|
|
TransformFunction transform_function;
|
2023-03-24 17:59:33 +00:00
|
|
|
StyleValueVector values;
|
|
|
|
bool operator==(Properties const& other) const;
|
|
|
|
} m_properties;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|