mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 13:20:59 +00:00 
			
		
		
		
	 48f43a7429
			
		
	
	
		48f43a7429
		
	
	
	
	
		
			
			Okay, I got that a bit wrong. Here's what CSS 2.1 says: "The properties of anonymous boxes are inherited from the enclosing non-anonymous box. Non-inherited properties have their initial value." This patch implements a better behavior by only copying the inherited properties from the parent style.
		
			
				
	
	
		
			32 lines
		
	
	
	
		
			774 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
	
		
			774 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_properties) const;
 | |
| 
 | |
|     NonnullRefPtrVector<StyleRule> collect_matching_rules(const Element&) const;
 | |
| 
 | |
|     static bool is_inherited_property(const StringView&);
 | |
| 
 | |
| private:
 | |
|     template<typename Callback>
 | |
|     void for_each_stylesheet(Callback) const;
 | |
| 
 | |
|     Document& m_document;
 | |
| };
 |