StyleBlockRule.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2020-2021, the SerenityOS developers.
  3. * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <AK/RefCounted.h>
  9. #include <AK/Vector.h>
  10. #include <LibWeb/CSS/Parser/StyleComponentValueRule.h>
  11. #include <LibWeb/CSS/Parser/Token.h>
  12. namespace Web::CSS {
  13. class StyleBlockRule : public RefCounted<StyleBlockRule> {
  14. friend class Parser;
  15. public:
  16. StyleBlockRule();
  17. explicit StyleBlockRule(Token token, Vector<StyleComponentValueRule>&& values)
  18. : m_token(move(token))
  19. , m_values(move(values))
  20. {
  21. }
  22. ~StyleBlockRule();
  23. bool is_curly() const { return m_token.is(Token::Type::OpenCurly); }
  24. bool is_paren() const { return m_token.is(Token::Type::OpenParen); }
  25. bool is_square() const { return m_token.is(Token::Type::OpenSquare); }
  26. Token const& token() const { return m_token; }
  27. Vector<StyleComponentValueRule> const& values() const { return m_values; }
  28. String to_string() const;
  29. private:
  30. Token m_token;
  31. Vector<StyleComponentValueRule> m_values;
  32. };
  33. }