/* * 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 namespace Web::CSS { class FlexStyleValue final : public StyleValueWithDefaultOperators { public: static ValueComparingNonnullRefPtr create( ValueComparingNonnullRefPtr grow, ValueComparingNonnullRefPtr shrink, ValueComparingNonnullRefPtr basis) { return adopt_ref(*new (nothrow) FlexStyleValue(move(grow), move(shrink), move(basis))); } virtual ~FlexStyleValue() override = default; ValueComparingNonnullRefPtr grow() const { return m_properties.grow; } ValueComparingNonnullRefPtr shrink() const { return m_properties.shrink; } ValueComparingNonnullRefPtr basis() const { return m_properties.basis; } virtual ErrorOr to_string() const override; bool properties_equal(FlexStyleValue const& other) const { return m_properties == other.m_properties; } private: FlexStyleValue( ValueComparingNonnullRefPtr grow, ValueComparingNonnullRefPtr shrink, ValueComparingNonnullRefPtr basis) : StyleValueWithDefaultOperators(Type::Flex) , m_properties { .grow = move(grow), .shrink = move(shrink), .basis = move(basis) } { } struct Properties { ValueComparingNonnullRefPtr grow; ValueComparingNonnullRefPtr shrink; ValueComparingNonnullRefPtr basis; bool operator==(Properties const&) const = default; } m_properties; }; }