mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 07:42:43 +00:00 
			
		
		
		
	 31ac19543a
			
		
	
	
		31ac19543a
		
	
	
	
	
		
			
			Instead of using string everywhere, have the CSS parser produce enum values, since they are a lot nicer to work with. In the future we should generate most of this code based on a list of supported CSS properties.
		
			
				
	
	
		
			32 lines
		
	
	
	
		
			767 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
	
		
			767 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <AK/NonnullRefPtrVector.h>
 | |
| #include <AK/OwnPtr.h>
 | |
| #include <LibHTML/CSS/StyleProperties.h>
 | |
| 
 | |
| class Document;
 | |
| class Element;
 | |
| class ParentNode;
 | |
| class StyleRule;
 | |
| class StyleSheet;
 | |
| 
 | |
| class StyleResolver {
 | |
| public:
 | |
|     explicit StyleResolver(Document&);
 | |
|     ~StyleResolver();
 | |
| 
 | |
|     Document& document() { return m_document; }
 | |
|     const Document& document() const { return m_document; }
 | |
| 
 | |
|     NonnullRefPtr<StyleProperties> resolve_style(const Element&, const StyleProperties* parent_style) const;
 | |
| 
 | |
|     NonnullRefPtrVector<StyleRule> collect_matching_rules(const Element&) const;
 | |
| 
 | |
|     static bool is_inherited_property(CSS::PropertyID);
 | |
| 
 | |
| private:
 | |
|     template<typename Callback>
 | |
|     void for_each_stylesheet(Callback) const;
 | |
| 
 | |
|     Document& m_document;
 | |
| };
 |