StyleRule.h 870 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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/StyleBlockRule.h>
  11. #include <LibWeb/CSS/Parser/StyleComponentValueRule.h>
  12. namespace Web::CSS {
  13. class StyleRule : public RefCounted<StyleRule> {
  14. friend class Parser;
  15. public:
  16. enum class Type {
  17. At,
  18. Qualified,
  19. };
  20. StyleRule(Type);
  21. ~StyleRule();
  22. Vector<StyleComponentValueRule> const& prelude() const { return m_prelude; }
  23. StyleBlockRule const& block() const { return *m_block; }
  24. String to_string() const;
  25. private:
  26. Type const m_type;
  27. String m_name; // At-rules only
  28. Vector<StyleComponentValueRule> m_prelude;
  29. RefPtr<StyleBlockRule> m_block;
  30. };
  31. }