PlaceSelfStyleValue.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2023, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/CSS/StyleValue.h>
  8. namespace Web::CSS {
  9. class PlaceSelfStyleValue final : public StyleValueWithDefaultOperators<PlaceSelfStyleValue> {
  10. public:
  11. static ValueComparingNonnullRefPtr<PlaceSelfStyleValue> create(ValueComparingNonnullRefPtr<StyleValue> align_self, ValueComparingNonnullRefPtr<StyleValue> justify_self)
  12. {
  13. return adopt_ref(*new (nothrow) PlaceSelfStyleValue(move(align_self), move(justify_self)));
  14. }
  15. virtual ~PlaceSelfStyleValue() override = default;
  16. ValueComparingNonnullRefPtr<StyleValue> align_self() const { return m_properties.align_self; }
  17. ValueComparingNonnullRefPtr<StyleValue> justify_self() const { return m_properties.justify_self; }
  18. virtual String to_string() const override;
  19. bool properties_equal(PlaceSelfStyleValue const& other) const { return m_properties == other.m_properties; }
  20. private:
  21. PlaceSelfStyleValue(ValueComparingNonnullRefPtr<StyleValue> align_self, ValueComparingNonnullRefPtr<StyleValue> justify_self)
  22. : StyleValueWithDefaultOperators(Type::PlaceSelf)
  23. , m_properties { .align_self = move(align_self), .justify_self = move(justify_self) }
  24. {
  25. }
  26. struct Properties {
  27. ValueComparingNonnullRefPtr<StyleValue> align_self;
  28. ValueComparingNonnullRefPtr<StyleValue> justify_self;
  29. bool operator==(Properties const&) const = default;
  30. } m_properties;
  31. };
  32. }