/* * Copyright (c) 2018-2020, Andreas Kling * Copyright (c) 2021, Tobias Christiansen * Copyright (c) 2021-2023, Sam Atkins * Copyright (c) 2022-2023, MacDue * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include namespace Web::CSS { class BorderRadiusShorthandStyleValue final : public StyleValueWithDefaultOperators { public: static ErrorOr> create( ValueComparingNonnullRefPtr top_left, ValueComparingNonnullRefPtr top_right, ValueComparingNonnullRefPtr bottom_right, ValueComparingNonnullRefPtr bottom_left) { return adopt_nonnull_ref_or_enomem(new (nothrow) BorderRadiusShorthandStyleValue(move(top_left), move(top_right), move(bottom_right), move(bottom_left))); } virtual ~BorderRadiusShorthandStyleValue() override = default; auto top_left() const { return m_properties.top_left; } auto top_right() const { return m_properties.top_right; } auto bottom_right() const { return m_properties.bottom_right; } auto bottom_left() const { return m_properties.bottom_left; } virtual ErrorOr to_string() const override; bool properties_equal(BorderRadiusShorthandStyleValue const& other) const { return m_properties == other.m_properties; } private: BorderRadiusShorthandStyleValue( ValueComparingNonnullRefPtr top_left, ValueComparingNonnullRefPtr top_right, ValueComparingNonnullRefPtr bottom_right, ValueComparingNonnullRefPtr bottom_left) : StyleValueWithDefaultOperators(Type::BorderRadiusShorthand) , m_properties { .top_left = move(top_left), .top_right = move(top_right), .bottom_right = move(bottom_right), .bottom_left = move(bottom_left) } { } struct Properties { ValueComparingNonnullRefPtr top_left; ValueComparingNonnullRefPtr top_right; ValueComparingNonnullRefPtr bottom_right; ValueComparingNonnullRefPtr bottom_left; bool operator==(Properties const&) const = default; } m_properties; }; }