StyleBlockRule.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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/ComponentValue.h>
  11. #include <LibWeb/CSS/Parser/Token.h>
  12. #include <LibWeb/Forward.h>
  13. namespace Web::CSS {
  14. class StyleBlockRule : public RefCounted<StyleBlockRule> {
  15. friend class Parser::Parser;
  16. public:
  17. StyleBlockRule();
  18. explicit StyleBlockRule(Token token, Vector<ComponentValue>&& values)
  19. : m_token(move(token))
  20. , m_values(move(values))
  21. {
  22. }
  23. ~StyleBlockRule();
  24. bool is_curly() const { return m_token.is(Token::Type::OpenCurly); }
  25. bool is_paren() const { return m_token.is(Token::Type::OpenParen); }
  26. bool is_square() const { return m_token.is(Token::Type::OpenSquare); }
  27. Token const& token() const { return m_token; }
  28. Vector<ComponentValue> const& values() const { return m_values; }
  29. String to_string() const;
  30. private:
  31. Token m_token;
  32. Vector<ComponentValue> m_values;
  33. };
  34. }