2023-03-23 17:26:13 +00:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
|
2023-03-23 17:26:13 +00:00
|
|
|
* Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
|
2024-08-14 16:25:48 +01:00
|
|
|
* Copyright (c) 2021-2024, Sam Atkins <sam@ladybird.org>
|
2023-03-23 17:26:13 +00:00
|
|
|
* Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibWeb/CSS/Angle.h>
|
2024-08-14 16:25:48 +01:00
|
|
|
#include <LibWeb/CSS/StyleValues/CSSUnitValue.h>
|
2023-03-23 17:26:13 +00:00
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
2024-08-14 16:25:48 +01:00
|
|
|
class AngleStyleValue : public CSSUnitValue {
|
2023-03-23 17:26:13 +00:00
|
|
|
public:
|
2023-08-19 14:00:10 +01:00
|
|
|
static ValueComparingNonnullRefPtr<AngleStyleValue> create(Angle angle)
|
2023-03-23 17:26:13 +00:00
|
|
|
{
|
2023-08-19 14:00:10 +01:00
|
|
|
return adopt_ref(*new (nothrow) AngleStyleValue(move(angle)));
|
2023-03-23 17:26:13 +00:00
|
|
|
}
|
|
|
|
virtual ~AngleStyleValue() override;
|
|
|
|
|
|
|
|
Angle const& angle() const { return m_angle; }
|
2024-08-14 16:25:48 +01:00
|
|
|
virtual double value() const override { return m_angle.raw_value(); }
|
|
|
|
virtual StringView unit() const override { return m_angle.unit_name(); }
|
2023-03-23 17:26:13 +00:00
|
|
|
|
2024-12-07 00:59:49 +01:00
|
|
|
virtual String to_string(SerializationMode) const override;
|
2023-03-23 17:26:13 +00:00
|
|
|
|
2024-08-14 16:25:48 +01:00
|
|
|
bool equals(CSSStyleValue const& other) const override;
|
2023-03-23 17:26:13 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
explicit AngleStyleValue(Angle angle);
|
|
|
|
|
|
|
|
Angle m_angle;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|