RectStyleValue.h 992 B

12345678910111213141516171819202122232425262728293031323334353637
  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/EdgeRect.h>
  11. #include <LibWeb/CSS/StyleValue.h>
  12. namespace Web::CSS {
  13. class RectStyleValue : public StyleValueWithDefaultOperators<RectStyleValue> {
  14. public:
  15. static ValueComparingNonnullRefPtr<RectStyleValue> create(EdgeRect rect);
  16. virtual ~RectStyleValue() override = default;
  17. EdgeRect rect() const { return m_rect; }
  18. virtual String to_string() const override;
  19. bool properties_equal(RectStyleValue const& other) const { return m_rect == other.m_rect; }
  20. private:
  21. explicit RectStyleValue(EdgeRect rect)
  22. : StyleValueWithDefaultOperators(Type::Rect)
  23. , m_rect(move(rect))
  24. {
  25. }
  26. EdgeRect m_rect;
  27. };
  28. }