BackgroundRepeatStyleValue.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
  4. * Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
  5. * Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
  6. *
  7. * SPDX-License-Identifier: BSD-2-Clause
  8. */
  9. #pragma once
  10. #include <LibWeb/CSS/Enums.h>
  11. #include <LibWeb/CSS/StyleValue.h>
  12. namespace Web::CSS {
  13. class BackgroundRepeatStyleValue final : public StyleValueWithDefaultOperators<BackgroundRepeatStyleValue> {
  14. public:
  15. static ValueComparingNonnullRefPtr<BackgroundRepeatStyleValue> create(Repeat repeat_x, Repeat repeat_y)
  16. {
  17. return adopt_ref(*new BackgroundRepeatStyleValue(repeat_x, repeat_y));
  18. }
  19. virtual ~BackgroundRepeatStyleValue() override;
  20. Repeat repeat_x() const { return m_properties.repeat_x; }
  21. Repeat repeat_y() const { return m_properties.repeat_y; }
  22. virtual ErrorOr<String> to_string() const override;
  23. bool properties_equal(BackgroundRepeatStyleValue const& other) const { return m_properties == other.m_properties; }
  24. private:
  25. BackgroundRepeatStyleValue(Repeat repeat_x, Repeat repeat_y);
  26. struct Properties {
  27. Repeat repeat_x;
  28. Repeat repeat_y;
  29. bool operator==(Properties const&) const = default;
  30. } m_properties;
  31. };
  32. }