FlexStyleValue.h 924 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/CSS/Flex.h>
  8. #include <LibWeb/CSS/StyleValue.h>
  9. namespace Web::CSS {
  10. class FlexStyleValue final : public StyleValueWithDefaultOperators<FlexStyleValue> {
  11. public:
  12. static ValueComparingNonnullRefPtr<FlexStyleValue> create(Flex flex)
  13. {
  14. return adopt_ref(*new (nothrow) FlexStyleValue(move(flex)));
  15. }
  16. virtual ~FlexStyleValue() override = default;
  17. Flex const& flex() const { return m_flex; }
  18. Flex& flex() { return m_flex; }
  19. virtual String to_string() const override { return m_flex.to_string(); }
  20. bool properties_equal(FlexStyleValue const& other) const { return m_flex == other.m_flex; }
  21. private:
  22. FlexStyleValue(Flex&& flex)
  23. : StyleValueWithDefaultOperators(Type::Flex)
  24. , m_flex(flex)
  25. {
  26. }
  27. Flex m_flex;
  28. };
  29. }