RectStyleValue.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 ErrorOr<String> to_string() const override;
  19. virtual bool has_rect() const override { return true; }
  20. bool properties_equal(RectStyleValue const& other) const { return m_rect == other.m_rect; }
  21. private:
  22. explicit RectStyleValue(EdgeRect rect)
  23. : StyleValueWithDefaultOperators(Type::Rect)
  24. , m_rect(rect)
  25. {
  26. }
  27. EdgeRect m_rect;
  28. };
  29. }