1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:17:46 +00:00

LibWeb: Split AngleStyleValue out of StyleValue.{h,cpp}

This commit is contained in:
Sam Atkins 2023-03-23 17:26:13 +00:00 committed by Linus Groh
parent 36c5afdfb2
commit 777d3e73f9
7 changed files with 74 additions and 25 deletions

View file

@ -0,0 +1,32 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
* Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
* Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "AngleStyleValue.h"
namespace Web::CSS {
AngleStyleValue::AngleStyleValue(Angle angle)
: StyleValueWithDefaultOperators(Type::Angle)
, m_angle(move(angle))
{
}
AngleStyleValue::~AngleStyleValue() = default;
ErrorOr<String> AngleStyleValue::to_string() const
{
return m_angle.to_string();
}
bool AngleStyleValue::properties_equal(AngleStyleValue const& other) const
{
return m_angle == other.m_angle;
}
}

View file

@ -0,0 +1,37 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
* Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/CSS/Angle.h>
#include <LibWeb/CSS/StyleValue.h>
namespace Web::CSS {
class AngleStyleValue : public StyleValueWithDefaultOperators<AngleStyleValue> {
public:
static ValueComparingNonnullRefPtr<AngleStyleValue> create(Angle angle)
{
return adopt_ref(*new AngleStyleValue(move(angle)));
}
virtual ~AngleStyleValue() override;
Angle const& angle() const { return m_angle; }
virtual ErrorOr<String> to_string() const override;
bool properties_equal(AngleStyleValue const& other) const;
private:
explicit AngleStyleValue(Angle angle);
Angle m_angle;
};
}