mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 07:32:44 +00:00 
			
		
		
		
	 82d12b170a
			
		
	
	
		82d12b170a
		
	
	
	
	
		
			
			AtStyleRule being a subclass of QualifiedStyleRule was causing problems when trying to distinguish between them. Combining them and then distinguishing between them with a Type enum makes that check simpler, and is in line with how similar checks are done elsewhere in the parser.
		
			
				
	
	
		
			41 lines
		
	
	
	
		
			865 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
	
		
			865 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020-2021, the SerenityOS developers.
 | |
|  * Copyright (c) 2021, Sam Atkins <atkinssj@gmail.com>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/RefCounted.h>
 | |
| #include <AK/Vector.h>
 | |
| #include <LibWeb/CSS/Parser/StyleBlockRule.h>
 | |
| #include <LibWeb/CSS/Parser/StyleComponentValueRule.h>
 | |
| 
 | |
| namespace Web::CSS {
 | |
| 
 | |
| class StyleRule : public RefCounted<StyleRule> {
 | |
|     friend class Parser;
 | |
| 
 | |
| public:
 | |
|     enum class Type {
 | |
|         At,
 | |
|         Qualified,
 | |
|     };
 | |
| 
 | |
|     StyleRule(Type);
 | |
|     ~StyleRule();
 | |
| 
 | |
|     Vector<StyleComponentValueRule> const& prelude() const { return m_prelude; }
 | |
|     StyleBlockRule const& block() const { return *m_block; }
 | |
| 
 | |
|     String to_string() const;
 | |
| 
 | |
| private:
 | |
|     Type const m_type;
 | |
|     String m_name; // At-rules only
 | |
|     Vector<StyleComponentValueRule> m_prelude;
 | |
|     RefPtr<StyleBlockRule> m_block;
 | |
| };
 | |
| 
 | |
| }
 |