1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:37:35 +00:00

LibWeb: Implement Flex and FlexStyleValue types

This commit is contained in:
Sam Atkins 2023-09-28 15:18:14 +01:00 committed by Sam Atkins
parent f1d7ea67c0
commit b0317bb3a1
15 changed files with 258 additions and 6 deletions

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/CSS/Flex.h>
#include <LibWeb/CSS/StyleValue.h>
namespace Web::CSS {
class FlexStyleValue final : public StyleValueWithDefaultOperators<FlexStyleValue> {
public:
static ValueComparingNonnullRefPtr<FlexStyleValue> create(Flex flex)
{
return adopt_ref(*new (nothrow) FlexStyleValue(move(flex)));
}
virtual ~FlexStyleValue() override = default;
Flex const& flex() const { return m_flex; }
Flex& flex() { return m_flex; }
virtual String to_string() const override { return m_flex.to_string(); }
bool properties_equal(FlexStyleValue const& other) const { return m_flex == other.m_flex; }
private:
FlexStyleValue(Flex&& flex)
: StyleValueWithDefaultOperators(Type::Flex)
, m_flex(flex)
{
}
Flex m_flex;
};
}