GridAutoFlowStyleValue.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) 2023, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/CSS/StyleValue.h>
  8. namespace Web::CSS {
  9. class GridAutoFlowStyleValue final : public StyleValueWithDefaultOperators<GridAutoFlowStyleValue> {
  10. public:
  11. enum Axis {
  12. Row,
  13. Column,
  14. };
  15. enum Dense {
  16. No,
  17. Yes,
  18. };
  19. static ValueComparingNonnullRefPtr<GridAutoFlowStyleValue> create(Axis, Dense);
  20. virtual ~GridAutoFlowStyleValue() override = default;
  21. [[nodiscard]] bool is_row() const { return m_row; }
  22. [[nodiscard]] bool is_column() const { return !m_row; }
  23. [[nodiscard]] bool is_dense() const { return m_dense; }
  24. virtual String to_string() const override;
  25. bool properties_equal(GridAutoFlowStyleValue const& other) const { return m_row == other.m_row && m_dense == other.m_dense; }
  26. private:
  27. explicit GridAutoFlowStyleValue(Axis axis, Dense dense)
  28. : StyleValueWithDefaultOperators(Type::GridAutoFlow)
  29. , m_row(axis == Axis::Row)
  30. , m_dense(dense == Dense::Yes)
  31. {
  32. }
  33. bool m_row { false };
  34. bool m_dense { false };
  35. };
  36. }