mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 13:20:59 +00:00 
			
		
		
		
	 c449cabae3
			
		
	
	
		c449cabae3
		
	
	
	
	
		
			
			The goal here is to move the parser-internal classes into this namespace so they can have more convenient names without causing collisions. The Parser itself won't collide, and would be more convenient to just remain `CSS::Parser`, but having a namespace and a class with the same name makes C++ unhappy.
		
			
				
	
	
		
			45 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020-2021, the SerenityOS developers.
 | |
|  * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/RefCounted.h>
 | |
| #include <AK/Vector.h>
 | |
| #include <LibWeb/CSS/Parser/ComponentValue.h>
 | |
| #include <LibWeb/CSS/Parser/StyleBlockRule.h>
 | |
| 
 | |
| namespace Web::CSS {
 | |
| 
 | |
| class StyleRule : public RefCounted<StyleRule> {
 | |
|     friend class Parser::Parser;
 | |
| 
 | |
| public:
 | |
|     enum class Type {
 | |
|         At,
 | |
|         Qualified,
 | |
|     };
 | |
| 
 | |
|     StyleRule(Type);
 | |
|     ~StyleRule();
 | |
| 
 | |
|     bool is_qualified_rule() const { return m_type == Type::Qualified; }
 | |
|     bool is_at_rule() const { return m_type == Type::At; }
 | |
| 
 | |
|     Vector<ComponentValue> const& prelude() const { return m_prelude; }
 | |
|     RefPtr<StyleBlockRule const> block() const { return m_block; }
 | |
|     String const& at_rule_name() const { return m_at_rule_name; }
 | |
| 
 | |
|     String to_string() const;
 | |
| 
 | |
| private:
 | |
|     Type const m_type;
 | |
|     String m_at_rule_name;
 | |
|     Vector<ComponentValue> m_prelude;
 | |
|     RefPtr<StyleBlockRule> m_block;
 | |
| };
 | |
| 
 | |
| }
 |